HTTPS ERROR while HTTP works ?

wwestendorpwwestendorp Member Posts: 178
I'm programming an Interface between 2 Systems using POST Kommendo for transmitting XML files.

I tested it succesfully with HTTP.

If I try to change the Kommando to HTTPS Nothing goes out and I receive the follwing error:

This message is for C/AL Programmers
The Call to the member send failed. msxml5.dll returned the following message:

The download of the specified resource failed.

I use following automation

'Microsoft XML, v5.0'.XMLHTTP50 = XMLHTTP Variable

I tried this with older ones but still the same.

If my Authorization wasn't correct I receive form the webservice an other message so something is not ok from Navision side.

Who could help me out there?

Navision prompt up the error at the last line here visable.


CLEAR(XMLHTTP);
CLEAR(locautXmlDoc);
CREATE(XMLHTTP);
CREATE(locautXmlDoc);
FileSize.OPEN(XMLsetup."XML Output Path");
FSize:=FileSize.LEN;
FileSize.CLOSE;
locautXmlDoc.async:=FALSE;
locautXmlDoc.load(XMLsetup."XML Output Path");
XMLHTTP.open('POST',Vendor."XML POST Commando",0);
XMLHTTP.setRequestHeader('Content-Type: ',Vendor."XML Content Type");
XMLHTTP.setRequestHeader('Authorization: ', Vendor."XML Auhorization");
XMLHTTP.setRequestHeader('User-Agent: ', Vendor."XML User Agent");
XMLHTTP.setRequestHeader('Host: ',Vendor."XML HOST" );
XMLHTTP.setRequestHeader('Content-Length: ', FORMAT(FSize));
XMLHTTP.setRequestHeader('Connection: ', 'Keep-Alive');
XMLHTTP.setRequestHeader('Cache-Control: ', 'no-cache');
XMLHTTP.send(locautXmlDoc);
locautXmlDoc.load(XMLHTTP.responseXML);
......


](*,)

William

Comments

  • activ8activ8 Member Posts: 25
    Maybe if you try this:

    Make this local variables:

    Name DataType Subtype Length
    lvar Variant
    lis InStream
    myXML Automation 'Microsoft XML, v4.0'.DOMDocument40

    CREATE(myXML);
    rest of your code here
    ....
    SoapRequest.send(autXMLDom);
    lvar := SoapRequest.responseStream;
    lis := lvar;

    IF NOT myXML.load(lis) THEN BEGIN
    error('some error message')
    END ELSE BEGIN

    save your xml here or do something else

    END;
  • wwestendorpwwestendorp Member Posts: 178
    Sorry But I don't understand what the difference ist.

    Here are my variables

    XMLHTTP Automation 'Microsoft XML, v6.0'.XMLHTTP60
    locautXmlDoc Automation 'Microsoft XML, v5.0'.DOMDocument50
    FileSize File
    FSize Integer
    TestStream InStream

    I'm missing how my could will look like if I follow your directions.
  • wwestendorpwwestendorp Member Posts: 178
    No one had ever the same problems with HTTPS ?

    I'm curious how you did solve this then: 8)
  • activ8activ8 Member Posts: 25
    CLEAR(XMLHTTP);
    CLEAR(locautXmlDoc);
    CREATE(XMLHTTP);
    CREATE(locautXmlDoc);
    FileSize.OPEN(XMLsetup."XML Output Path");
    FSize:=FileSize.LEN;
    FileSize.CLOSE;
    locautXmlDoc.async:=FALSE;
    locautXmlDoc.load(XMLsetup."XML Output Path");
    XMLHTTP.open('POST',Vendor."XML POST Commando",0);
    XMLHTTP.setRequestHeader('Content-Type: ',Vendor."XML Content Type");
    XMLHTTP.setRequestHeader('Authorization: ', Vendor."XML Auhorization");
    XMLHTTP.setRequestHeader('User-Agent: ', Vendor."XML User Agent");
    XMLHTTP.setRequestHeader('Host: ',Vendor."XML HOST" );
    XMLHTTP.setRequestHeader('Content-Length: ', FORMAT(FSize));
    XMLHTTP.setRequestHeader('Connection: ', 'Keep-Alive');
    XMLHTTP.setRequestHeader('Cache-Control: ', 'no-cache');
    XMLHTTP.send(locautXmlDoc);
    //locautXmlDoc.load(XMLHTTP.responseXML);
    lvar := SoapRequest.responseStream;
    lis := lvar;

    IF NOT locautXmlDoc.load(lis) THEN BEGIN
    error('some error message')
    END ELSE BEGIN
    locautXmlDoc.save('c:\temp');
    END;


    where lvar is a local variable form the type variant
    and lis is a local variable from the type instream

    I got the same error as you, i solved it by first
    using a variant variable en then an instream.

    maybe you also have to change this
    XMLHTTP.open('POST',Vendor."XML POST Commando",0);
    to -->
    XMLHTTP.open('POST',Vendor."XML POST Commando",FALSE);
  • wwestendorpwwestendorp Member Posts: 178
    Thanks Activ8 but what varable do you use for

    SoapRequest.responseStream
  • wwestendorpwwestendorp Member Posts: 178
    When dubugging Navision stops direct after this Kommand

    XMLHTTP.send(locautXmlDoc);
  • wwestendorpwwestendorp Member Posts: 178
    I changed the code and Now Navision crashes everytime I want to POST send the XML file via HTTPS



    Name DataType Subtype Length
    XMLsetup Record XML Setup
    XMLHTTP Automation 'Microsoft XML, v6.0'.XMLHTTP60
    locautXmlDoc Automation 'Microsoft XML, v5.0'.DOMDocument50
    FileSize File
    FSize Integer
    TestStream InStream
    TestFile File
    IintWindowStyle Integer
    IblnWaitForEndOfCommand Boolean
    OintReturnValue Integer
    Laut Automation 'Windows Script Host Object Model'.WshShell
    lvar Variant
    lis InStream








    IF NOT XMLsetup.GET() THEN
    MESSAGE('Bitte XML Setup einrichten');

    Vendor.GET(PurchaseHeader."Buy-from Vendor No.");
    IF PurchaseHeader.XMLStatus<>200 THEN
    BEGIN
    CLEAR(XMLHTTP);
    CLEAR(locautXmlDoc);
    CREATE(XMLHTTP);
    CREATE(locautXmlDoc);
    FileSize.OPEN(XMLsetup."XML Output Path");
    FSize:=FileSize.LEN;
    FileSize.CLOSE;
    locautXmlDoc.async:=FALSE;
    locautXmlDoc.load(XMLsetup."XML Output Path");
    XMLHTTP.open('POST',Vendor."XML POST Commando",FALSE);
    XMLHTTP.setRequestHeader('Content-Type: ',Vendor."XML Content Type");
    XMLHTTP.setRequestHeader('Authorization: ', Vendor."XML Auhorization");
    XMLHTTP.setRequestHeader('User-Agent: ', Vendor."XML User Agent");
    XMLHTTP.setRequestHeader('Host: ',Vendor."XML HOST" );
    XMLHTTP.setRequestHeader('Content-Length: ', FORMAT(FSize));
    XMLHTTP.setRequestHeader('Connection: ', 'Keep-Alive');
    XMLHTTP.setRequestHeader('Cache-Control: ', 'no-cache');
    lvar:=XMLHTTP.responseXML;
    lis:=lvar;
    XMLHTTP.send(locautXmlDoc);
    locautXmlDoc.load(lis);
    IF XMLHTTP2.status=200 THEN
    BEGIN
    IF TestFile.OPEN(XMLsetup."XML Receive Path") THEN
    TestFile.CLOSE;
    IF EXISTS(XMLsetup."XML Receive Path") THEN
    ERASE (XMLsetup."XML Receive Path");
    locautXmlDoc.save(XMLsetup."XML Receive Path");
    TestFile.OPEN(XMLsetup."XML Receive Path");
    TestFile.READ(String);
    IF STRPOS(String,'<GeneralException>') >0 THEN
    BEGIN
    TestFile.CREATEINSTREAM(TestStream);
    XMLPORT.IMPORT(90002,TestStream);
    TestFile.CLOSE;
    END ELSE BEGIN
    TestFile.CREATEINSTREAM(TestStream);
    XMLPORT.IMPORT(90001,TestStream);
    TestFile.CLOSE;
    Respondsdata.FIND('+');
    PurchaseHeader.XMLSalesOrder:=Respondsdata.XMLDocNr;
    PurchaseHeader.XMLStatus:=XMLHTTP.status;
    PurchaseHeader.XMLStatusDescription:=XMLHTTP.statusText;
    PurchaseHeader.XMLDatumSend:=CURRENTDATETIME;
    PurchaseHeader.MODIFY;
    END;
    END;
    END ELSE BEGIN
    MESSAGE('%1', 'Dies ist bereits geliefert');
    END;
    CLEAR(XMLHTTP);
    CLEAR(locautXmlDoc);
  • wwestendorpwwestendorp Member Posts: 178
    anyone?
    iemand?
    Jemandem? :roll:
Sign In or Register to comment.