Qazi Posted April 24, 2020 Share Posted April 24, 2020 I am working with myDHL API and not getting a null response from their API. When i look into the fault code its showing an env:server. Their support is not helpful so need some help here. Any help what i am doing wrong here. I tried using the Soap class using the code below $request=<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> <soap:Header><wsse:Security soapenv:mustunderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-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 > test</wsse:Username > <wsse:Password type = "PasswordText" >test</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 > 2020 - 04 - 24 20:17:21 </wsu:Created > </wsse:UsernameToken > </wsse:Security > </soap:Header> <soap:Body> <ShipmentRequest xmlns="http://scxgxtt.phx-dc.dhl.com/euExpressRateBook/ShipmentMsgRequest"> <MessageId xmlns="">c68d7150bbd611e2b09ad103c98eed12</MessageId> <ClientDetail xmlns=""/> <RequestedShipment xmlns=""> <ShipmentInfo> <DropOffType>REGULAR_PICKUP</DropOffType> <ServiceType>P</ServiceType> <Account>4324324324</Account> <Currency>EUR</Currency> <UnitOfMeasurement>SI</UnitOfMeasurement> </ShipmentInfo> <ShipTimestamp>2019-10-24T14:01:22GMT+00:00</ShipTimestamp> <PaymentInfo>DDU</PaymentInfo> <InternationalDetail> <Commodities> <NumberOfPieces>1</NumberOfPieces> <Description>Documents</Description> <CustomsValue>10</CustomsValue> <CountryOfManufacture>ES</CountryOfManufacture> </Commodities> </InternationalDetail> <Ship> <Shipper> <Contact> <PersonName>Karlos Espana</PersonName> <CompanyName>SHIPING LTD</CompanyName> <PhoneNumber>3848211</PhoneNumber> </Contact> <Address> <StreetLines>DEL STREETO 9</StreetLines> <City>SANT CUGAT DEL VALLES</City> <PostalCode>08173</PostalCode> <CountryCode>ES</CountryCode> </Address> </Shipper> <Recipient> <Contact> <PersonName>Martin Soltys</PersonName> <CompanyName>DHL</CompanyName> <PhoneNumber>731731731</PhoneNumber> </Contact> <Address> <StreetLines>V Parku 2308/10</StreetLines> <City>Prague</City> <PostalCode>14800</PostalCode> <CountryCode>CZ</CountryCode> </Address> </Recipient> </Ship> <Packages> <RequestedPackages number="1"> <Weight>1</Weight> <Dimensions> <Length>35</Length> <Width>25</Width> <Height>1</Height> </Dimensions> <CustomerReferences>LC MAGIC NUMBER 0037</CustomerReferences> </RequestedPackages> </Packages> </RequestedShipment> </ShipmentRequest> </soap:Body> </soap:Envelope> $url = 'https://wsbexpress.dhl.com:443/sndpt/expressRateBook'; $action = 'createShipmentRequest'; try { $client = new SoapClient($path_to_wsdl); $response =$client->createShipmentRequest($request); } catch (SoapFault $fault) { echo "<h2>SOAP Fault!</h2><p>"; echo "FaultCode: {$fault->faultcode} <br/>"; echo "FaultString: {$fault->faultstring} <br/>"; echo"</p/>"; } Quote Link to comment https://forums.phpfreaks.com/topic/310639-mydhl-soap-request/ Share on other sites More sharing options...
maxxd Posted April 24, 2020 Share Posted April 24, 2020 (edited) What's the fault code and string it should output on failure? The docs state that SoapClient::__construct() will throw a SoapFault exception if the WSDL URI can't be loaded - it doesn't look like your endpoint is WSDL. Edited April 24, 2020 by maxxd forgot a word Quote Link to comment https://forums.phpfreaks.com/topic/310639-mydhl-soap-request/#findComment-1577190 Share on other sites More sharing options...
Qazi Posted April 24, 2020 Author Share Posted April 24, 2020 The fault code returned is "env:server" . The WSDL endpoint is https://wsbexpress.dhl.com:443/sndpt/expressRateBook?WSDL but how can i use the WSDL end point? because if i use the WSDL end point it will return the WSDL instead. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/310639-mydhl-soap-request/#findComment-1577191 Share on other sites More sharing options...
Qazi Posted April 24, 2020 Author Share Posted April 24, 2020 Resolved the issue. I had to set the Content-Type to text/xml Quote Link to comment https://forums.phpfreaks.com/topic/310639-mydhl-soap-request/#findComment-1577193 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.