HTTPConnection.Post - DHL API

The 1C:Enterprise developers forum

People who like this:0Yes/0No
Just came
Rating: 1
Joined: Mar 7, 2016
Company: 4b-software UG

I try to connect the DHL API with HHTPConnection.Post. This works with both Postman and SoadUI. Unfortunately, 1C HTTPConnection.Post returns the error message "Internet error: Failure when receiving data from the peer". I don't know why.

Does anyone have an idea, or can help with it?

Thank you in advance.

Here's my code:

Procedure DHLGetVersionServer()
    //URL = "";
    DHLServer = "";
    SOAPServicesEndpoint = "/services/sandbox/soap";
    User = Constants.User.Get();
    Password = Constants.Password.Get();
    Version = New Structure("majorRelease, minorRelease, build", "3", "0", "0");
    RequestFile = GetVersionXMLFileName(Version);
    // RequestFile content:
    //<soapenv:Envelope xmlns:ns="" xmlns:soapenv="">
    //   <soapenv:Header/>
    //   <soapenv:Body>
    //      <ns:Version>
    //         <majorRelease>3</majorRelease>
    //         <minorRelease>0</minorRelease>
    //         <build>0</build>
    //      </ns:Version>
    //   </soapenv:Body>

    ProxyServer = New InternetProxy;
    ProxyServer.Set("https", DHLServer, , User, Password); 
    SecureConnection = New OpenSSLSecureConnection;
        Connection = New HTTPConnection(DHLServer,,,, ProxyServer, , SecureConnection);
        Message("Couldn't connect to DHL server:" + Chars.LF + BriefErrorDescription(ErrorInfo()));
    // send request
    // ResponseFile content should be:
    //<soapenv:Envelope xmlns:bus="" xmlns:soapenv="">
    //       <soapenv:Header/>
    //       <soapenv:Body>
    //           <bus:GetVersionResponse>
    //               <bus:Version>
    //                   <majorRelease>3</majorRelease>
    //                   <minorRelease>0</minorRelease>
    //                   <build>0</build>
    //               </bus:Version>
    //           </bus:GetVersionResponse>
    //       </soapenv:Body>
    RequestHeaders = New Map;
    RequestHeaders["Content-Type"] = "text/xml;charset=UTF-8";
    RequestHeaders["SOAPAction"] = "urn:getVersion";
    HTTPRequest = New HTTPRequest(SOAPServicesEndpoint, RequestHeaders);
    ResponseFile = "D:\Temp\Response.txt";
        Result = Connection.Post(HTTPRequest, ResponseFile);

People who like this:0Yes/0No
Active user
Rating: 2
Joined: Sep 7, 2019

Just a guess: no internet on the machine, where your application server is installed?

You run Postman and SoadUI on our local client machine and the code, obviously, is running on the application server (&AtServer directive).

Be the first to know tips & trick on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.