2

当我通过 nu soap 客户端调用肥皂网络服务时遇到问题,我使用“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">
4

1 回答 1

1

您的请求缺少reference属性。

我没有reference在你的$params.

你确定你的 php 代码是正确的吗?

于 2013-07-17T04:00:46.237 回答