我需要查看XML我发送的是一个Web服务,以确保其正确,但我无法使__getLastRequest()
函数正常工作。我知道它击中服务器因为我倾倒了我应该使用的方法。有人看到了吗?
try
{
$soapclient = new SoapClient('http://freight.onestopshipping.com/GTSService/services/GTSWebServiceAutoQuotes?wsdl', array('trace' => TRUE ) );
$params = array(
'RaterRequestAutoQuotes' => array(
'userName' => 'XXXXX',
'password' => 'XXXXXXXXX',
'pickupDate' => '05/29/2017',
'deliveryDate' => '06/20/2017',
'destZipCode' => '83814',
'origZipCode' => '15065',
'RaterRequestItems' => array(
'item_class' => '85',
'nmfc' => '?',
'weight' => 100,
),
),
);
$response = $soapclient->getRate($params);
//var_dump($response);
echo "REQUEST:\n" . $soapclient->__getLastRequest() . "\n";
}
catch (SoapFault $e)
{
// do some service level error stuff
echo $e;
}
catch (Exception $e)
{
// do some application level error stuff
echo $e;
}
他们发送的XML Reqeust示例如下所示:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ser="http://services.gts" xmlns:xsd="http://services.gts/xsd">
<soap:Header/>
<soap:Body>
<ser:getRate>
<!--Optional:-->
<ser:rRequest>
<!--Optional:-->
<xsd:deliveryDate>05/29/2017</xsd:deliveryDate>
<!--Optional:-->
<xsd:destZipCode>83814</xsd:destZipCode>
<!--Zero or more repetitions:-->
<xsd:items>
<!--Optional:-->
<xsd:item_class>85</xsd:item_class>
<!--Optional:-->
<xsd:nmfc>?</xsd:nmfc>
<!--Optional:-->
<xsd:weight>100</xsd:weight>
</xsd:items>
<!--Optional:-->
<xsd:origZipCode>15065-1840</xsd:origZipCode>
<!--Optional:-->
<xsd:password>XXXXXXXXXX</xsd:password>
<!--Optional:-->
<xsd:pickupDate>05/19/2017</xsd:pickupDate>
<!--Optional:-->
<xsd:userName>XXXXXX</xsd:userName>
</ser:rRequest>
</ser:getRate>
</soap:Body>
</soap:Envelope>
答案 0 :(得分:0)
如果要跟踪请求消息,可以使用Eclipse IDE的内置Traceback (most recent call last):
File "/home/padam/Downloads/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/home/padam/Downloads/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/home/padam/Downloads/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/home/padam/Documents/git/gae-fumen/app.py", line 4
from flask import Flask, render_template, jsonify, request
^
工具(更多信息:How to trace SOAP message in Eclipse IDE)。或者有关功能测试目的的更多信息,请尝试SoapUI | Functional Testing for SOAP and REST APIs。