我想使用带有php SoapClient的肥皂发送以下对象。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:adin="http://3e.pl/ADInterface">
<soapenv:Header/>
<soapenv:Body>
<adin:queryData>
<adin:ModelCRUDRequest>
<adin:ModelCRUD>
<adin:serviceType>ReadSalesOrder</adin:serviceType>
<adin:TableName>XX_RV_Interface_Order</adin:TableName>
<adin:RecordID>0</adin:RecordID>
<adin:Filter></adin:Filter>
<adin:Action>Read</adin:Action>
<!--Optional:-->
<adin:DataRow>
<!--Zero or more repetitions:-->
<adin:field type="integer" column="C_BPartner_ID" lval="" disp="" edit="" error="" errorVal="">
<adin:val>1000643</adin:val>
</adin:field>
</adin:DataRow>
</adin:ModelCRUD>
<adin:ADLoginRequest>
<adin:user>username</adin:user>
<adin:pass>password</adin:pass>
<adin:lang>zh_CN</adin:lang>
<adin:ClientID>1000000</adin:ClientID>
<adin:RoleID>1000029</adin:RoleID>
<adin:OrgID>1000000</adin:OrgID>
<adin:WarehouseID>1000023</adin:WarehouseID>
</adin:ADLoginRequest>
</adin:ModelCRUDRequest>
</adin:queryData>
</soapenv:Body>
</soapenv:Envelope>
我试过以下内容:
$wsdl = 'http://example.com/ModelADService?wsdl';
$client = new SoapClient($wsdl);
$result = $client->__soapCall('queryData', array(
'ModelCRUDRequest' => array(
'ModelCRUD' => array(
'serviceType' => 'ReadSalesOrder',
'TableName' => 'XX_RV_Interface_Order',
'RecordID' => 0,
'Filter' => '',
'Action' => 'Read',
'DataRow' => array(
'field' => array(
'type' => 'integer',
'column' => 'C_BPartner_ID',
'lval' => '',
'disp' => '',
'edit' => '',
'error' => '',
'errorVal' => '',
'val' => 1000643,
)
)
),
'ADLoginRequest' => array(
'user' => 'username',
'pass' => 'password',
'lang' => 'zh_CN',
'ClientID' => 1000000,
'RoleID' => 1000029,
'OrgID' => 1000000,
'WarehouseID' => 1000023,
'stage' => '',
),
),
));
var_dump($result);
致命错误:未捕获的SoapFault异常:[soap:Client]参数ModelCRUDRequest不存在!
答案 0 :(得分:0)
SOAP客户端必须在执行之前初始化
$client = new SoapClient($wsdl);
答案 1 :(得分:0)
您的问题不在于肥皂通话,而在于您正在发送的数据或接收肥皂。 soap令人沮丧,因为您在另一台服务器上调用了一个函数,并且该服务器上引发的任何错误都会在您的服务器上触发。因此,如果他们的函数有致命错误,您的代码将出现致命错误。这就是所有肥皂调用必须在try catch中的原因。