XMLHTTP Automation proxy

Troubles_In_Paradise
Member Posts: 588
Hi guys, I've one question about proxy.
I use an Automation variable to make a connection to a web site to dowload an xmlfile (see code below... process runs via RTC).
I've searched the forum and I found this post: viewtopic.php?f=32&t=46478&hilit=proxy+xmlhttp
Here they use .setProxy method that is not available for Xmlhttp variable but only for serverXMLHTTP.
Since I don't know the difference between XMLHTTP and serverXMLHTTP :oops: I simply tried to change the subtype of my automation variable from the first to the latter but with this modification RTC replies with "Application timed out".
has anyone an idea?
Thanks in advance.
I use an Automation variable to make a connection to a web site to dowload an xmlfile (see code below... process runs via RTC).
Name DataType Subtype Length XmlHttp Automation 'Microsoft XML, v6.0'.XMLHTTP60 IF GUIALLOWED THEN Window.OPEN('do you want to start?'); IF ISCLEAR(XmlHttp) THEN CREATE(XmlHttp); XmlHttp.open('GET',"www.mysite.com",FALSE); XmlHttp.send; IF XmlHttp.status = 200 THEN BEGIN ...My question is, is there a way to force nav to use a specific proxy?
I've searched the forum and I found this post: viewtopic.php?f=32&t=46478&hilit=proxy+xmlhttp
Here they use .setProxy method that is not available for Xmlhttp variable but only for serverXMLHTTP.
Since I don't know the difference between XMLHTTP and serverXMLHTTP :oops: I simply tried to change the subtype of my automation variable from the first to the latter but with this modification RTC replies with "Application timed out".
has anyone an idea?
Thanks in advance.
~Rik~
It works as expected... More or Less...
It works as expected... More or Less...
0
Answers
-
I did another test:
Variables:Name DataType Subtype Length XMLHTTP Automation 'Microsoft XML, v6.0'.ServerXMLHTTP60 XMLDOC Automation 'Microsoft XML, v6.0'.DOMDocument
Code:IF CONFIRM('Let''s go') THEN BEGIN IF ISCLEAR(XMLHTTP) THEN CREATE(XMLHTTP); IF ISCLEAR(XMLDOC) THEN CREATE(XMLDOC); XMLHTTP.setProxy(2,'proxy::8080'); XMLHTTP.open('POST','http://www.google.com',FALSE); XMLHTTP.send; XMLDOC.load(XMLHTTP.responseXML); XMLDOC.save('C:\Temp\test.xml'); MESSAGE('done'); END;
but I receive the following error:--------------------------- Microsoft Dynamics NAV Classic --------------------------- This message is for C/AL programmers: The call to member open failed. msxml6.dll returned the following message: The parameter is incorrect.
~Rik~
It works as expected... More or Less...0 -
Changing Approach I found a solution.
This is the post that helped me: viewtopic.php?f=23&t=37522&hilit=winhttp
Variables used:Name DataType Subtype Length WINHTTP Automation 'Microsoft WinHTTP Services, version 5.1'.WinHttpRequest _InStream InStream URL Text 1024 Received Text 128
Code:IF CONFIRM('Let''s go!') THEN BEGIN URL := 'http://www.google.com'; IF ISCLEAR(WINHTTP) THEN CREATE(WINHTTP); WINHTTP.SetProxy(2,'myproxy:8080'); WINHTTP.Open('GET',URL,FALSE); WINHTTP.Send; CLEAR(_InStream); IF WINHTTP.Status = 200 THEN BEGIN _InStream := WINHTTP.ResponseStream; //do what you want _InStream.READTEXT(Received,128); MESSAGE(Received); END; END;
~Rik~
It works as expected... More or Less...0 -
Hi,
I am aware of this thread is old, but I had an issue in this direction.
The solution with XMLHTTP should also work, if you use only one colon ':', maybe that was only a typo.
So instead ofXMLHTTP.setProxy(2,'proxy::8080');
you have to setXMLHTTP.setProxy(2,'proxy:8080');
and it should work.
It seems also to me that the current user credentials are used, because I do not need to setup these information.
Kind regards,
jaja_bings0
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