Sending HTTP POST via NAV

wwestendorp
wwestendorp Member Posts: 178
I want to send an XML File from Navision with HTTP POST.

Now I know that I should encode the username:Pasword But I have No Idea how to send the XML File?

What kind of Automation or OCX or... should I use?
Are there examples?

Thanks for your Imput!

Comments

  • ara3n
    ara3n Member Posts: 9,258
    here is example code. import it and play around with it.

    http://www.mibuso.com/dlinfo.asp?FileID=539
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • lzr
    lzr Member Posts: 264
    This is an easy example of posting
    CREATE(XMLHTTP);
    XMLHTTP.open('POST', 'http://whatever', FALSE);
    XMLHTTP.setRequestHeader('Content-Type: ', 'application/x-www-form-urlencoded');
    XMLHTTP.send(XMLString);
    response := XMLHTTP.responseText;
    

    XMLHTTP is an automation, 'Microsoft XML, v3.0'.XMLHTTP
    Navision developer
  • wwestendorp
    wwestendorp Member Posts: 178
    lzr wrote:
    This is an easy example of posting
    CREATE(XMLHTTP);
    XMLHTTP.open('POST', 'http://whatever', FALSE);
    XMLHTTP.setRequestHeader('Content-Type: ', 'application/x-www-form-urlencoded');
    XMLHTTP.send(XMLString);
    response := XMLHTTP.responseText;
    

    XMLHTTP is an automation, 'Microsoft XML, v3.0'.XMLHTTP

    Thanks!

    Should I use an XMLString or could I send the XML File instead?
  • wwestendorp
    wwestendorp Member Posts: 178
    lzr wrote:
    This is an easy example of posting
    CREATE(XMLHTTP);
    XMLHTTP.open('POST', 'http://whatever', FALSE);
    XMLHTTP.setRequestHeader('Content-Type: ', 'application/x-www-form-urlencoded');
    XMLHTTP.send(XMLString);
    response := XMLHTTP.responseText;
    

    XMLHTTP is an automation, 'Microsoft XML, v3.0'.XMLHTTP

    How can I send following lines (also as HTTPO Header or Body ?

    POST /invoke/ActDelivery_HTTP.Inbound/receiveXMLsynch HTTP/1.1
    Content-Type: text/xml; charset="UTF-8"
    Authorization: Basic EncryptedID...individualBase64encodedCredentials==
    User-Agent: SCHttpPostData/1.1
    Host: WEBPRG.com
    Content-Length: 547
    Connection: Keep-Alive
    Cache-Control: no-cache
    Cookie: ssnid=
  • wwestendorp
    wwestendorp Member Posts: 178
    ara3n wrote:
    here is example code. import it and play around with it.

    http://www.mibuso.com/dlinfo.asp?FileID=539

    Thanks

    I receive a error message:

    The Call to member respondsetext failed.
    msxml3.dee returned following message: The data nessecary to complete the operation is not yet avvailable.

    What does this mean? Is the DLL corrupt or ??
  • Koshe
    Koshe Member Posts: 37
    Hi,
    this could mean that you asynchronous call, and you try to do something without having the response data.
    Could you paste the lines that give this error?
  • lzr
    lzr Member Posts: 264
    How can I send following lines (also as HTTPO Header or Body ?

    POST /invoke/ActDelivery_HTTP.Inbound/receiveXMLsynch HTTP/1.1
    Content-Type: text/xml; charset="UTF-8"
    Authorization: Basic EncryptedID...individualBase64encodedCredentials==
    User-Agent: SCHttpPostData/1.1
    Host: WEBPRG.com
    Content-Length: 547
    Connection: Keep-Alive
    Cache-Control: no-cache
    Cookie: ssnid=

    I am no expert in this, the example was all I needed to get it to work. There should be some documentation around xmlhttp
    Navision developer
  • DavidB
    DavidB Member Posts: 11
    Hi wwestendorp,

    try to use PocketSOAP http://www.pocketsoap.com

    groetjes david