Archived Forum Post

Index of archived forum posts

Question:

HTTP POSTXML non standard port

Nov 25 '13 at 13:09

How do I submit an HTTP.POSTXML using a non standard port?

Currently the following applies:

PRC: Sending HTTP request using ChilKat PRC: Target URL: http://192.168.16.21:8888 PRC: HTTP error: ChilkatLog: PostXml: DllDate: Aug 15 2013 ChilkatVersion: 9.4.1.42 Username: WINDOWS-ONM6IYQ:gkristjansson Architecture: Little Endian; 32-bit Language: ActiveX VerboseLogging: 0 url: http://192.168.16.21:8888 charset: utf-8 xmlSizeInChars: 399 httpConnect: hostname: 192.168.16.21 port: 80 ssl: 0 Need to establish connection to the HTTP server... ConnectTimeoutMs_1: 10000 calling ConnectSocket2 IPV6 enabled connect with NO heartbeat. This is an IPV4 numeric address... AddrInfoList: AddrInfo: ai_flags: 4 ai_family: 2 ai_socktype: 1 ai_protocol: 0 ai_addrlen: 16 ai_canonname: (NULL) --AddrInfo --AddrInfoList Connect using IPV4. ipAddress1: 192.168.16.21 timeout waiting for connect to complete numSec: 10 numMicroSec: 0 HostOrIpAddress: 192.168.16.21 SocketHandle: 0x30c sockError: 10022 Connect function failed.. SocketError: WSAEINVAL An invalid argument was supplied. connectTimeoutMs: 10000 idleTimeoutMs: 20000 Failed to connect. --httpConnect connectTime1: Elapsed time: 10109 millisec PostXml request failed. --PostXml --ChilkatLog

The "endpoint" URL includes a port definition (url: http://192.168.16.21:8888) but the actual HTTP POST still seems to use the standard HTTP port (80):

httpConnect:
  hostname: 192.168.16.21
  port: 80

I'm sure I'm missing some basic parameter setup here but I can't find a reference in the documentation on how to set the actual port to be used in the HTTP POST request?

Thanks,

Gudfinnur Kristjansson


Answer

This new build fixes it: http://www.chilkatsoft.com/preRelease/ChilkatHttp-9.4.1-win32.zip


Answer

Please test using this new build:

http://www.chilkatsoft.com/preRelease/ChilkatHttp-9.4.1-win32.zip

If the problem persists, please post the contents of the LastErrorText using this new build. Please be sure to use <pre> tag to encapsulate the LastErrorText when posting to this forum, so that the LastErrorText is readable.


Answer

Dear Sirs,

Unfortunately the problem still persists:

  PostXml:
    DllDate: Nov 25 2013
    ChilkatVersion: 9.4.1.74
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    url: http://192.168.2.105:8888
    charset: utf-8
    xmlSizeInChars: 393
    fullRequest:
      a_synchronousRequest:
        generateRequest:
          httpRequestGenStartLine:
            genStartLine:
              startLine: POST / HTTP/1.1
            --genStartLine
          --httpRequestGenStartLine
          addCookies:
            Not auto-adding cookies.
          --addCookies
        --generateRequest
        fullHttpRequest:
          domain: 192.168.2.105
          port: 80
          ssl: 0
          openHttpConnection:
            Opening connection to HTTP server.
            hostname: 192.168.2.105
            port: 80
            ssl: 0
            connectElapsedMs: 31
            HTTP connection succeeded.
          --openHttpConnection
          connectTime: Elapsed time: 31 millisec
          sendRequestHeader:
            sendHeaderElapsedMs: 0
          --sendRequestHeader
          sendRequestBody:
            sendBodyElapsedMs: 0
          --sendRequestBody
          statusCode: 404
          statusText: Not Found
          readResponseBody:
            contentLength: 198
          --readResponseBody
        --fullHttpRequest
      --a_synchronousRequest
    --fullRequest
    Success.
  --PostXml
--ChilkatLog

The POSTXML is still going out on port 80.

I was, however, able to bypass this problem by using http.SynchronousRequest instead of POSTXML so the problem is no longer "urgent".

Thanks,

Gudfinnur Kristjansson


Answer

I found the problem: The port number is not parsed when it is the last part of the URL. If you add a single forward slash, like this: "http://192.168.1.105:8888/" then the port is correctly used.

I'll make the fix though..


Answer

Thanks for the quick response. For now I'll stick with the SynchronousRequest as it is working but I'll try using POSTXML in the next SOAP related project.