gpt4 book ai didi

php - DHL 跟踪装运请求 - WSDL - PHP - SOAP

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:47:59 25 4
gpt4 key购买 nike

第一次发帖,如有违反论坛规则等,请见谅。我正在尝试使用 DHL api 来跟踪 cargo 。

这是我目前的代码

$client = new SoapClient("https://wsbuat.dhl.com:8300/gbl/glDHLExpressTrack?wsdl");
//$header = new SoapHeader("https://wsbuat.dhl.com:8300/gbl/glDHLExpressTrack?wsdl", "APICredentials", $auth, false);
//$client->__setLocation('https://wsbuat.dhl.com:8300/gbl/glDHLExpressTrack?wsdl');

$header_part = '<soapenv:Envelope xmlns:rat="https://wsbuat.dhl.com:8300/gbl/glDHLExpressTrack?wsdl"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wsswssecurity-
secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-5" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-
wss-wssecurity-utility-1.0.xsd">
<wsse:Username>myusername</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-
1.0#PasswordText">mypassword</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-
1.0#Base64Binary">eUYebYfsjztETJ4Urt8AJw==</wsse:Nonce>
<wsu:Created>2010-02-12T17:40:39.124Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>';




$soap_var_header = new SoapVar( $header_part, XSD_ANYXML, null, null, null );
$soap_header = new SoapHeader( 'https://wsbuat.dhl.com:8300/gbl/glDHLExpressTrack', 'wsse', $soap_var_header, true );
$client->__setSoapHeaders($soap_header);

如果我这样做

var_dump($client->__getFunctions())

我得到以下信息:

array(1) { [0]=> string(83) "trackShipmentRequestResponse trackShipmentRequest(trackShipmentRequest $parameters)" }

我的问题真的是有人知道如何格式化 trackShipmentRequest

$client->trackShipmentRequest(what goes here);

这里是DHL给我的xml的例子,要在soapui中使用

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:trac="http://scxgxtt.phx-dc.dhl.com/glDHLExpressTrack/providers/services/trackShipment" xmlns:dhl="http://www.dhl.com">
<soapenv:Header/>
<soapenv:Body>
<trac:trackShipmentRequest>
<trackingRequest>
<dhl:TrackingRequest>
<Request>
<ServiceHeader>
<MessageTime>2013-05-13T10:17:20Z</MessageTime>
<MessageReference>c68d7150bbd611e2b09ad103c98eed12</MessageReference>
</ServiceHeader>
</Request>
<!--Optional:-->
<AWBNumber>
<!--1 or more repetitions:-->
<ArrayOfAWBNumberItem>2786552086</ArrayOfAWBNumberItem>
</AWBNumber>
<!--Optional:-->
<LPNumber>
<!--1 or more repetitions:-->
<ArrayOfTrackingPieceIDItem>?</ArrayOfTrackingPieceIDItem>
</LPNumber>
<LevelOfDetails>ALL_CHECK_POINTS</LevelOfDetails>
<!--Optional:-->
<PiecesEnabled>B</PiecesEnabled>
</dhl:TrackingRequest>
</trackingRequest>
</trac:trackShipmentRequest>
</soapenv:Body>

</soapenv:Envelope>

我发现这个网站上有类似的主题,但似乎没有帮助。

最佳答案

您在第一行中使用的 WSDL 端点

new SoapClient("https://wsbuat.dhl.com:8300/gbl/glDHLExpressTrack?wsdl");

甚至没有解决。我不认为它会工作。通常如果你只是粘贴 https://wsbuat.dhl.com:8300/gbl/glDHLExpressTrack?wsdl在您的浏览器中,您应该能够看到我所知道的大多数 SOAP 服务的定义。

根据 user555 的评论,端点可能已被弃用,因此您应该联系 DHL。

关于php - DHL 跟踪装运请求 - WSDL - PHP - SOAP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16860991/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com