webservice and proxy

RallnusRallnus Member Posts: 79
I try to send a webservice message with the recommended tools:

CREATE(locautXmlDoc);
locautXmlDoc.async := FALSE;
locautXmlDoc.load('C:\input.xml');
CREATE(locautXmlHttp);
locautXmlHttp.open('POST','https//:xxx',0);
locautXmlHttp.setRequestHeader('Content-type','text/xml');
locautXmlHttp.send(locautXmlDoc);
locautXmlDoc.load(locautXmlHttp.responseXML);
locautXmlDoc.save('C:\temp.xml');

But I get the error message "download failed"

I think the problem is, that I have to use a proxy.

How can I adress the way through a proxy?
Rallnus (Yamaha FJ1200 - '89 / 25th anniversary was great!)

Comments

  • rvduurenrvduuren Member Posts: 92
    Hello Rallnus,

    This is my attempt, and it works for me..
    Globals:
    Serializer	Automation	'Microsoft Soap Type Library'.SoapSerializer	
    Connector	Automation	'Microsoft Soap Type Library'.HttpConnector	
    XMLDOM	Automation	'Microsoft XML, v6.0'.DOMDocument
    
    IF ISCLEAR(Connector) THEN
      CREATE(Connector);
    
    Connector.Property('ProxyServer','myProxyserver:8080');
    Connector.Property('ProxyPassword','myPassword');
    Connector.Property('ProxyUser','myUsername');
    
    Connector.Property('EndPointURL','http://webservice.net:80/service.aspx');
    Connector.Connect;
    Connector.Property('SoapAction','urn:xmethodsMyMethod#Nav');
    Connector.BeginMessage;
    
    CREATE(Serializer);
    Serializer.Init(Connector.InputStream);
    
    Serializer.StartEnvelope('','STANDARD');
    Serializer.StartBody('STANDARD');
    Serializer.StartElement('method','urn:xmethodsMyMethod#Nav');
      Serializer.StartElement('myElement','urn:xmethodsMyMethod#Nav');
      Serializer.WriteString('value');
      Serializer.EndElement;
    Serializer.EndElement;
    Serializer.EndBody;
    Serializer.EndEnvelope;
        
    Connector.EndMessage;
    
    IF ISCLEAR(XMLDOM) THEN
      CREATE(XMLDOM);
    XMLDOM.load(Connector.OutputStream);
    XMLDOM.save('c:\result.xml');
    CLEAR(XMLDOM);
    CLEAR(Connector);
    
    Let me know if this is what you're looking for..
    Met vriendelijke groet, best regards,

    Rvduuren
  • RallnusRallnus Member Posts: 79
    Thanks rvduuren,
    I'll try your code. But now I've got another problem: I can't find the soap elements in my library. Whish version of the SOAP Framework shall I use?
    Now I've got .Net Framework Version 1.1sp1. Do I need V. 2.0 or 3.0? Which is the best?
    Rallnus (Yamaha FJ1200 - '89 / 25th anniversary was great!)
  • rvduurenrvduuren Member Posts: 92
    As far a I know, MS SOAP libs are default installed on XP. Take a look at
    "C:\Program Files\Common Files\MSSoap\Binaries\mssoap1.dll"
    I use MSSOAP1. This is (what I know) not related to the .Net framework.

    I have serveral Customers working with it, no complaints there..
    Good luck.

    Info
    http://support.microsoft.com/kb/307033/
    Met vriendelijke groet, best regards,

    Rvduuren
  • MauddibMauddib Member Posts: 269
    Has anyone experienced time outs with this? Basically:

    1) Our partner has a webservice which we connect to. This creates a transaction in their web system and returns an error status and a transaction number to us.

    2) ANY time i do this over the web interface in Internet Explorer it always works fine. No issues. No time outs. Transaction number and no error every time.

    3) However when using code very similar to above it errors out with the Navision standard "This message is for C/AL programmers....." screen. When we look in the partner system the transaction has been created successfully. It just has not been returned to Navision.

    4) When this happens there is a good 15 seconds of 'hang' time before the error appears.
  • todrotodro Member Posts: 117
    Mauddib wrote:
    Has anyone experienced time outs with this? Basically:

    1) Our partner has a webservice which we connect to. This creates a transaction in their web system and returns an error status and a transaction number to us.

    2) ANY time i do this over the web interface in Internet Explorer it always works fine. No issues. No time outs. Transaction number and no error every time.

    3) However when using code very similar to above it errors out with the Navision standard "This message is for C/AL programmers....." screen. When we look in the partner system the transaction has been created successfully. It just has not been returned to Navision.

    4) When this happens there is a good 15 seconds of 'hang' time before the error appears.
    2 things to consider:

    a.) always set the XMLDOM property ASYNC to false, unless you catch the asynchronous events

    b.) always check the LOAD whether it has been successful as there might be encoding problems or even a not well-formed XML

    I would expect the problem in your case to be the missing ASYNC=false as the default is true!
    Torsten
    MCP+I, MCSE NT, Navision MCT (2004,2005)
  • MauddibMauddib Member Posts: 269
    Thank you very much for this reply. I will read as much as I can about this ASYNC property. This might be the answer. Have you any other information on this property and what setting it might do? Might there be any BAD things that may happen?

    The only LOAD in my code is in the 'Microsoft XML, v6.0'.DOMDocument

    This LOAD comes AFTER the Connector.EndMessage; code where Connector is 'Microsoft Soap Type Library'.HttpConnector

    This Connector.Endmessage is where my error is occouring, so checking anything to do with the LOAD is not useful therefore.
  • todrotodro Member Posts: 117
    Mauddib wrote:
    Thank you very much for this reply. I will read as much as I can about this ASYNC property. This might be the answer. Have you any other information on this property and what setting it might do? Might there be any BAD things that may happen?

    The only LOAD in my code is in the 'Microsoft XML, v6.0'.DOMDocument

    This LOAD comes AFTER the Connector.EndMessage; code where Connector is 'Microsoft Soap Type Library'.HttpConnector

    This Connector.Endmessage is where my error is occouring, so checking anything to do with the LOAD is not useful therefore.
    this property simply ensures that the XMLDOM.load doesn not return control to the next line of code until the file was loaded (or an error occured during loading). If it is set to yes, i can be used for a multi-threaded load, especially for large XML files with ValidateOnLoad etc. Do not waste too much on this property unless you have a need and simply set it to false.

    In your case, the problem is not related to the XML load as the sending already fails at the Connector.EndMessage. This indicates a communication problem already at the request level. Do you use a proxy/ firewall ? Check the internet settings of your IE and compare them to the proxy settings for the connector (if you use a proxy), as you said it works from there.

    As you said you get a "This message is for C/AL programmers..". What exactly is the error description in the dialogbox ?
    Torsten
    MCP+I, MCSE NT, Navision MCT (2004,2005)
  • MauddibMauddib Member Posts: 269
    Thanks, ive rewritten my code totally, seems i was using SOAP when i did not need to.

    NOW I have a new problem. When i put my address into Internet Explorer it works nice when I do:

    https://myaddress.com/kdi/gui/custinfo.php

    IE gives me the proper XML document back. However when i do:

    IF NOT XMLDOC.LOAD('https://myaddress.com/kdi/gui/custinfo.php') THEN ERROR('FECK')

    I always get FECK!!
  • todrotodro Member Posts: 117
    Mauddib wrote:
    Thanks, ive rewritten my code totally, seems i was using SOAP when i did not need to.

    NOW I have a new problem. When i put my address into Internet Explorer it works nice when I do:

    https://myaddress.com/kdi/gui/custinfo.php

    IE gives me the proper XML document back. However when i do:

    IF NOT XMLDOC.LOAD('https://myaddress.com/kdi/gui/custinfo.php') THEN ERROR('FECK')

    I always get FECK!!
    you can not do that, use MSXML.XMLHTTP instead :

    Name DataType Subtype Length
    MSXMLHTTP Automation 'Microsoft XML, v6.0'.XMLHTTP

    MSXMLHTTP.open('GET', 'https://myaddress.com/kdi/gui/custinfo.php',false);
    // or when you need to send a xml request
    //MSXMLHTTP.open('POST', 'https://myaddress.com/kdi/gui/custinfo.php',false);
    if MSXMLHTTP.status = 200 then
      XMLResponseDoc := MSXMLHTTP.responseXML;
    // now parse the XMLResponseDoc
    
    Torsten
    MCP+I, MCSE NT, Navision MCT (2004,2005)
  • MauddibMauddib Member Posts: 269
    I am getting unspecified errors with that code but im sure ill work out why! Ive learned a lot now. Youve been great, thank you.
  • todrotodro Member Posts: 117
    Mauddib wrote:
    I am getting unspecified errors with that code but im sure ill work out why! Ive learned a lot now. Youve been great, thank you.
    What type of errors ?

    Of yourse, I missed the instantiation of the automation server and the send. This time, it's tested 8)

    In case you need to send a request, use it instead of the '' in the send function.

    But beware: any occuring error can not be caught! Therefore, any error,e.g. a connection error because of a unknown host, will lead to a C/SIDE error...

    IF ISCLEAR(MSXMLHTTP) THEN
      CREATE(MSXMLHTTP);
    MSXMLHTTP.open('GET', 'https://myaddress.com/kdi/gui/custinfo.php ',FALSE,'','');
    MSXMLHTTP.send('');
    IF MSXMLHTTP.status = 200 THEN BEGIN
      XMLResponseDoc := MSXMLHTTP.responseXML;
      XMLResponseDoc.save('c:\temp\xmlrequest.xml');
      //MESSAGE(XMLResponseDoc.xml);
    END;
    
    
    Torsten
    MCP+I, MCSE NT, Navision MCT (2004,2005)
  • MauddibMauddib Member Posts: 269
    Thanks, your code is perfect, and after solving a few other issues i stopped the "unspecified error" that i was getting.
  • mrudzkimrudzki Member Posts: 1
    Hi guys,

    I am using the following code to send XML files.

    IF ISCLEAR(XMLHTTP) THEN
    CREATE(XMLHTTP);

    XMLHTTP.open('POST', GLSetup."VCS Host URL", FALSE);
    XMLHTTP.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

    IF ISCLEAR(XMLDomDoc) THEN
    CREATE(XMLDomDoc);

    XMLDomDoc.load(XMLInstream);
    XMLHTTP.send(XMLDomDoc);


    It works fine for 2 URLs I tried but it doesn't work for one I need it to work. I get the following response:

    <?xml version="1.0"?>
    <AuthorisationResponse>
    <UserId></UserId>
    <Reference></Reference>
    <Response>~xmlMessage parameter is empty</Response>
    <AdditionalResponseData></AdditionalResponseData>
    </AuthorisationResponse>


    Do you have any idea why?

    Thank you,
    Marcin
Sign In or Register to comment.