Sending XML file to a remote web service in different domain

Sayan81
Member Posts: 10
Hi ,
I have two seperate domain running on two different LAN ( different location ) and NAV with 3 tier architecture has been installed in both places ( 3 tier on 3 machines ). Both the servers have got static IP. I am creating an XML file in one of the server and I need to transfer that XML file to other server. Is there any way to achieve this ? ( Apart from doing FTP ? )
Thanks in advance for your help.
Regards,
Sayan
I have two seperate domain running on two different LAN ( different location ) and NAV with 3 tier architecture has been installed in both places ( 3 tier on 3 machines ). Both the servers have got static IP. I am creating an XML file in one of the server and I need to transfer that XML file to other server. Is there any way to achieve this ? ( Apart from doing FTP ? )
Thanks in advance for your help.
Regards,
Sayan
0
Answers
-
Sayan81 wrote:Hi ,
I have two seperate domain running on two different LAN ( different location ) and NAV with 3 tier architecture has been installed in both places ( 3 tier on 3 machines ). Both the servers have got static IP. I am creating an XML file in one of the server and I need to transfer that XML file to other server. Is there any way to achieve this ? ( Apart from doing FTP ? )
Thanks in advance for your help.
Regards,
Sayan
Webservice.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
Hi Alex,
Thanks for your reply. Could you please explain a bit .
My idea is that - In one NAV server, user will be entering data in some specific tables and a batch job will b erun that will export all teh records in an XML file and then it will call a NAV web service ( a codeunit published ) in the remote computer that will read through this XML file and will populate records in the other database ( So kind of data replication ). This is working fine when both the servers are in same network i.e. domain.
But when servers are different domain , then obviously the second web service cannot read through this xml file as the file has been stored in Server A and the web service account does not have any read permission to that folder path ( there is no VPN connection , so basically two are different domains, but the two servers have static IP ). So now I am planning to tranfer the XML file to the second server before the web service starts reading it.
Is there any way to pass this XML file to that web service ? Currently I am using fairly simple code like following to call the remote web servivce -
XMLHTTP.open('POST','http://' + SubsidiaryCompany."Company NST IP" + ':' +
SubsidiaryCompany."Company NAV BS Port"+'/'+SubsidiaryCompany."Company NAV BS Name" +
'/WS/' + SubsidiaryCompany."Company Name" + '/Codeunit/' + WSName,0,SubsidiaryCompany."User ID",
SubsidiaryCompany.Password);
XMLHTTP.setRequestHeader('Content-Type','Text/xml; charset=utf-8');
XMLHTTP.setRequestHeader('SOAPAction','StartReadingFiles');
XMLHTTP.setTimeouts(ConnectTimeOut,ConnectTimeOut,ConnectTimeOut,ReceiveTimeout);
XMLHTTP.send(XMLText);
where XMLText is a simple text file that contains the web servcice name , function name in a SAOP format.0 -
Yes, that will work. Although with NAV2009, you don't need that much coding anymore.Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book0 -
But how can I send an entire xml file within than request xmmlhttp.send () ?
I tried to change XmmlText to BigText but that gives me runtime error as not a valid type for C/AL.
I am wondering if I change it to XML Dom DOc AUtomation type , will it accept? I have to try this :-k0 -
Hi
You can do 2 thing
1- Write XML structure directly on the function
XMLHttp.send(' <xml .......' +
'<tag1> sdsds </tag1>');
2- use a XML Dom Document v6 automation.
Bye0 -
Okk, finally I got it after lot of head banging \:D/
Thanks Saalek for the suggestion but option no. 1 will not work as I am sending large amount of data so I cannot encapsulate that in the text string as that will exceed 1024 charecter.
SO I figured out I have to pass it as XML Dom Doc automation. So in the receiveing function in the codeunit ( that has been exposed as web service ) I defined the parameter as XML Dom Doc also. All well but when I ran the process , the web service returned me the error that NAVAutomation is not a valid datatype.
So I changed the parameter to big text. Now everything went well excep the fact the tables in receiving end did not populate with data. After hours of investigation , I found that for some pecular reason when big text receives the XML file through web service , it just removes all XML tags and takes only the data. For eg <ID>1001</ID> will become only 1001.
So at the end, just before sending the XML file , I marked the data part within CDATA format so that web service treats that as a text string only.
And it worked !!!!!!!!!!!!! 8)0
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