webservice and proxy

Rallnus
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?
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!)
0
Comments
-
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,
Rvduuren0 -
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!)0 -
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,
Rvduuren0 -
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.0 -
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.
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)0 -
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.0 -
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.
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)0 -
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!!0 -
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!!
Name DataType Subtype Length
MSXMLHTTP Automation 'Microsoft XML, v6.0'.XMLHTTPMSXMLHTTP.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)0 -
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.0
-
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.
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)0 -
Thanks, your code is perfect, and after solving a few other issues i stopped the "unspecified error" that i was getting.0
-
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,
Marcin0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions