HTTPPOST

THIS WAS THE OLD CODE BUT DOES NOT WORK WITH ACUTOWEB

CAN ANYONE TELL ME HOW TO CONVERT THIS TO THE HTTPPOST STATEMENT?

 

KIND REGARDS

 

* Open connection
MODIFY objHTTP @Open("Post" strSoapAction 0
"USERNAME" "PASWORD").
* Set Soap headers
MODIFY objHTTP@setRequestHeader
("Content-Type", "text/xml; charset=utf-8")
MODIFY objHTTP@setRequestHeader
("host",
"dbrbms.agro.nl/.../dierenWS_v2_0.wsdll")
MODIFY objHTTP@setRequestHeader
("length", 10000)
MODIFY objHTTP@setRequestHeader
("soapAction ", strSoapAction)
*
* send the message
display message box strrequest
MODIFY objHTTP@send (strRequest)
* get the response
INQUIRE objHTTP@responseText()
IN strResponse.

DESTROY objHTTP.

  • From the code you've posted, it appears that you are working with a .Net assembly. Currently .Net asssemblies will not work on the client machine when running AcuToWeb (and AcuToWeb desktop on the client). There is another option. You could have the assembly run on the server.

    in the CREATE syntax for the .Net assembly add SERVER-NAME "Local:ip-address-of-server"

    That should alow you program to run, as long as the .Net assembly and all of the resources it needs resides on the server.
  • Yes that is correct but I thought I could replace this with the HTTPPOST command.
    I rewrote the .NET commands to COBOL commands to write the XML request only that last part is missing
    How would my create statement look then: it is now:
    CREATE XMLHTTP60 OF MSXML2 HANDLE
    IN objHTTP.
    In my HTTPPOST command it seems only the logon is missing:
    CALL "NetInit"
    GIVING
    RESPONSE-STATUS

    CALL "HttpPost"
    using
    strUrl
    "text/xml; charset=utf-8"
    REQ-POINTER
    req-len
    RES-POINTER
    res-len
    "Authorization"
    * "1391891:FpacA06"
    "Basic MTM5MTg5MTpGcGFjQTA2"
    x"00" x"00"
    giving
    response-status.
    IF RESPONSE-STATUS NOT = 0
    CALL "NetGetError" USING
    err-pointer
    err-len
    SET ADDRESS OF STRERROR TO ERR-POINTER
    display message box strerror
  • When using NetDefGen with the assembly that you are trying to use, is HttpPost a property that is defined in the def file created by NetDefGen?
  • No it is just a call which can be used with -y rmnet.dll in the command line. They use it in the celcius/fahrenheit example but there is no verification necessary for that webservice. In my case as you can see in the .net instructions are more parameters necessary.
  • It appears that you are attempting to construct an http header but are doing so incorrectly. I am away from my development machine at the moment. Look at the documentation for the HTTP header string. The HTTP header string is (if I recall correctly) name value pairs with a binary zero byte (octet) after both the name and value, and ended with multiple zero bytes. So try putting a zero byte after "Authorization".
  • Good morning,

    I think the first problem is to open the connection with the web-service and login to it

    OLD STATEMENTS:

    STRING "dbrbms.agro.nl/.../DierenWS"
    INTO strSoapAction.


    * Open connection
    MODIFY objHTTP @Open("Post" strSoapAction 0
    "USERID" "PASWORD").

    I don' t think it is the HTTPPOST call but I really don't know which one it is from the RMNET routines.

    Kind regards,
  • 01 Desired-SOAP-Action.
    05 filler pic x(15) value 'Authorization'.
    05 filler pic x value x"00".
    05 filler pic x(28) value 'Basic MTM5MTg5MTpGcGFjQTA2'.
    05 filler pic x value x"00".
    05 filler pic x(4) value 'host'.
    05 filler pic x value x"00".
    05 filler pic x(14) value 'dbrbms.agro.nl'.
    05 filler pic x value x"00".
    05 filler pic x value x"00".



    display message box strrequest
    SET REQ-POINTER TO ADDRESS OF StrRequest
    CALL "NetInit"
    GIVING RESPONSE-STATUS

    CALL "NetSSLVerifyPeer" USING
    PEER-FLAG
    GIVING RESPONSE-STATUS
    CALL "HttpPost"
    using
    * "dbrbms.agro.nl/.../dierenWS_v2_0.wsdll"
    strUrl
    "text/xml; charset=utf-8"
    REQ-POINTER
    req-len
    RES-POINTER
    res-len
    DESIRED-SOAP-ACTION
    giving
    response-status.
    IF RESPONSE-STATUS NOT = 0
    CALL "NetGetError" USING
    err-pointer
    err-len
    SET ADDRESS OF STRERROR TO ERR-POINTER
    display message box strerror
    else
    set address of STRRESPONSE to res-POINTER
    DISPLAY MESSAGE BOX STRRESPONSE
    END-IF
    * Create handle for sending soap envelop
    CALL "NetCleanup"
    GO TO END-PROGRAM.

    This is working a little bit better but now we got the error message: (response status 7)

    TRANSFERRED A PARTIAL FILE

    kind regards
    PS