XMLHTTPRequest Problem while using SSL

SWZSWZ Member Posts: 8
edited 2014-10-16 in Dynamics AX
Hello All,

I have the following problem, I wonder if you could help me:

I am sending XML files to a Webservice using Microsoft.XMLHTTP Com object which in Axapta is used using the XMLHTTPRequest class.

The problem is with sending files to a URL which is secured with SSL. (https://...)
When I send to a site with no SSL (http://...) all works fine.

During the call of send method I get the following errors depending if I use GET or POST send method:

using GET I have:
Method 'send' in COM object of class 'Msxml2.XMLHTTP.6.0' returned error code 0x800C000E (<unknown>) which means: [here I translate] Security problem occured

using POST I have:
Method 'send' in COM object of class 'Msxml2.XMLHTTP.6.0' returned error code 0x800C0008 (<unknown>) which means: [here I translate] PResource are not available

When I log with IE to this SSL URL everything looks ok (looks that the service is running)

My code is more or less as follows:

XMLHTTPRequest req = new XMLHTTPRequest();
XMLDocument d;
int status;

;

d = XMLDocument::newXML(this.xmlSource());


req.open('POST', 'https://10.1.1.1/ws.dll', 'USER', 'Pass'); //<- POST/GET
req.sendXML(d); //<- here the error is thrown with above message

If you ever faced this problem coudl you please describe what causes this error?
Regards,

Sebastian

Comments

  • SWZSWZ Member Posts: 8
    If anyone used the XMLHTTPRequest class in the same way with SSL and did not have any errors please let me know, the problem might not neccessarly lay on the Axapta side but on the IIS or the WebService itself.

    Regards,

    Sebastian
    Regards,

    Sebastian
  • MarceldeWinterMarceldeWinter Member Posts: 1
    Hello Sebastian,

    I experienced the same problem today. Posting to http: works fine, but https: results in an error.

    My solution to this problem was not to use the HTTPRequest class but the WINHTTPREQUEST. This is found in winhttp.dll in windows\system32.

    It is almost the same, but it gives you the option to select cerficates and to set timeout periods. It solved my problem :D
  • massimopasqualimassimopasquali Member Posts: 82
    hello guys,

    I need to do the same thing, I'm explaing better: Trought a webservices codeunit in NAV2009 calling an external server with HTTPS protocol using a certificate that I have in a directory on NAV server.

    How did you do? Below I have attached my code with XMLHTTP request, but don't work NAV asks me a certificate, that I have import by MMC on NAV server.

    XMLHTTP.open('POST','https://www.sgate.anci.it/sgate-gas-web-services/services',FALSE);
    XMLHTTP.setOption(2,12800);
    XMLHTTP.setTimeouts(10000,10000,10000,0); //change last parameter to zero to wait till webservice finishes the job

    XMLHTTP.send('<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"'
    + ' xmlns:xsd="http://www.sgate.ancitel.it/xsd/">'
    + ' <soapenv:Header/>'
    + ' <soapenv:Body>'
    + ' <xsd:richiestaPresaInCaricoLotto>'
    + ' <xsd:mittente>'
    + ' <xsd:login>YYYYY</xsd:login>'
    + ' <xsd:password>XXXX</xsd:password>'
    + ' </xsd:mittente>'
    + ' <xsd:idUltimoLottoRicevutoCorrettamente>000000</xsd:idUltimoLottoRicevutoCorrettamente>'
    + ' <xsd:numeroMessaggi>5</xsd:numeroMessaggi>'
    + ' </xsd:richiestaPresaInCaricoLotto>'
    + ' </soapenv:Body>'
    + '</soapenv:Envelope>');

    thanks
Sign In or Register to comment.