当我通过nu soap客户端调用soap web服务时遇到问题,我使用“Storm_r1.1-Adarna”工具尝试它并且它成功但不是在PHP代码中。 请参阅以下详细信息:
示例请求消息如下所示:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns="http://www.kiala.com/schemas/psws/1.0">
<soapenv:Header/>
<soapenv:Body>
<ns:createOrder reference="260778">
<identification>
<sender>5390a7006cee11e0ae3e0800200c9a66</sender>
<hash>831f8c1ad25e1dc89cf2d8f23d2af...fa85155f5c67627</hash>
<originator>VITS-STAELENS</originator>
</identification>
<delivery>
<from country="ES" node=""/>
<to country="ES" node="0299"/>
</delivery>
<parcel>
<description>Zoethout thee</description>
<weight>0.100</weight>
<orderNumber>10K24</orderNumber>
<orderDate>2012-12-31</orderDate>
</parcel>
<receiver>
<firstName>Gladys</firstName>
<surname>Roldan de Moras</surname>
<address>
<line1>Calle General Oraá 26</line1>
<line2>(4º izda)</line2>
<postalCode>28006</postalCode>
<city>Madrid</city>
<country>ES</country>
</address>
<email>gverbruggen@kiala.com</email>
<language>es</language>
</receiver>
</ns:createOrder>
</soapenv:Body>
</soapenv:Envelope>
我的代码:
$orderId = time();
$client = new nusoap_client('http://packandship-ws.kiala.com/psws/order?wsdl', true);
$params = array(
'reference' => $orderId,
'identification' => array(
'sender' => param('kiala', 'sender_id'),
'hash' => hash('sha512', $orderId . param('kiala', 'sender_id') . param('kiala', 'password')),
),
'delivery' => array(
'from' => array(
'country' => 'ES',
'node' => '',
),
'to' => array(
'country' => 'ES',
'node' => '0299'
),
),
'parcel' => array(
'description' => 'Endado',
'weight' => 0.200,
'orderNumber' => $orderId,
'orderDate' => date('Y-m-d')
),
'receiver' => array(
'firstName' => 'Customer First Name',
'surname' => 'Customer Sur Name',
'address' => array(
'line1' => 'Line 1 Adress',
'line2' => 'Line 2 Adress',
'postalCode' => 28006,
'city' => 'Madrid',
'country' => 'ES',
),
'email' => 'test.ceres@yahoo.com',
'language' => 'es'
)
);
$result = $client->call('createOrder', $params);
var_dump($result);die;
错误:
array
'faultcode' => string 'ns2:Client' (length=10)
'faultstring' => string 'Invalid request sent' (length=20)
'detail' =>
array
'orderFault' =>
array
'faultCode' => string 'INVALID_REQUEST' (length=15)
'message' => string ''orderRequest' tag is missing mandatory 'reference' attribute' (length=61)
当我使用nusoap调用web服务时,我的请求参数可能有问题吗?
<ns:createOrder reference="260778">
答案 0 :(得分:1)
您的请求缺少reference
属性。
我的reference
中没有$params
。
你确定你的PHP代码是对的吗?