Sending to NAV 2009 Webservice from NAV 4.X

lyot
Member Posts: 202
I've been messing around for some while now this subject.
But I guess now I've really hit a brick wall.
I'm trying to send the result of an xml port in NAV 4 SP1 to a 2009 web service.
First of all I've written a similar application in .NET, who uses to exposed xmlport in the 2009 web service to insert a customer.
This works like a charm. I've captured the xml file that is send by the .Net application with Wireshark.
It looks like this:
Then I made a xmlport in NAV 4 SP1 who generates the (almost) thesame xml file as the one above.
The result of the xmlport is:
This xml file is loaded in a xmlDocument automation ('Microsoft XML, v6.0'.DOMDocument) through an instream ad the sent with a xmlHttp automation ('Microsoft XML, v6.0'.XMLHTTP60)
I keep getting the following answer back from the webservice:
a:System.Net.WebException Soap message is invalid!
Ok some might have noticed that the two xml files are not exactly the same.
encoding="UTF-8" <> encoding="utf-8"
standalone="no" <> not present
So I've made a test function that loads the xml content (text without use of xmlport) in a xmlHttp automation.
This however works fine! ](*,) ](*,) ](*,) ](*,) ](*,) ](*,)
This is really getting on my nerves because working without xmlports in NOT an option.
But I guess now I've really hit a brick wall.
I'm trying to send the result of an xml port in NAV 4 SP1 to a 2009 web service.
First of all I've written a similar application in .NET, who uses to exposed xmlport in the 2009 web service to insert a customer.
This works like a charm. I've captured the xml file that is send by the .Net application with Wireshark.
It looks like this:
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <CustomerUpdate xmlns="urn:microsoft-dynamics-schemas/codeunit/WebserviceListener"> <customerWebservice> <Customer xmlns="urn:microsoft-dynamics-nav/xmlports/WebserviceListener"> <No>PROT</No> </Customer> </customerWebservice> </CustomerUpdate> </soap:Body> </soap:Envelope>
Then I made a xmlport in NAV 4 SP1 who generates the (almost) thesame xml file as the one above.
The result of the xmlport is:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <CustomerUpdate xmlns="urn:microsoft-dynamics-schemas/codeunit/WebserviceListener"> <customerWebservice> <Customer xmlns="urn:microsoft-dynamics-nav/xmlports/WebserviceListener"> <No>PROT</No> </Customer> </customerWebservice> </CustomerUpdate> </soap:Body> </soap:Envelope>
This xml file is loaded in a xmlDocument automation ('Microsoft XML, v6.0'.DOMDocument) through an instream ad the sent with a xmlHttp automation ('Microsoft XML, v6.0'.XMLHTTP60)
... lautXmlHttp.send(lautXmlDoc); ...
I keep getting the following answer back from the webservice:
a:System.Net.WebException Soap message is invalid!
Ok some might have noticed that the two xml files are not exactly the same.
encoding="UTF-8" <> encoding="utf-8"
standalone="no" <> not present
So I've made a test function that loads the xml content (text without use of xmlport) in a xmlHttp automation.
lautXmlHttp.send('<?xml version="1.0" encoding="UTF-8" standalone="no"?>'+ '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '+ 'xmlns:xsd="http://www.w3.org/2001/XMLSchema">'+ '<soap:Body>'+ '<CustomerUpdate xmlns="urn:microsoft-dynamics-schemas/codeunit/WebserviceListener">'+ '<customerWebservice>'+ '<Customer xmlns="urn:microsoft-dynamics-nav/xmlports/WebserviceListener">' + '<No>PROT3</No>' + '</Customer>' + '</customerWebservice>' + '</CustomerUpdate>' + '</soap:Body>' + '</soap:Envelope>');
This however works fine! ](*,) ](*,) ](*,) ](*,) ](*,) ](*,)
This is really getting on my nerves because working without xmlports in NOT an option.
0
Comments
-
Maybe not insignificant but the result of my xmlport is stored in a temp blob.
And then loaded with in- & outstreams in the xml document automation object.0 -
-
-
Have you looked at the following post.
It shows how to set the header and communicate with NAV 2009 webservice.
http://mibuso.com/blogs/ara3n/2009/01/2 ... companies/
It could be that xmlport add linefeed and carriage return after each element, which needs to be removed.
You could load the blob into xmldom and see if there is a way to remove0
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