Sending to NAV 2009 Webservice from NAV 4.X

lyotlyot Member Posts: 202
edited 2010-03-29 in NAV Three Tier
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:
<?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.

Comments

Sign In or Register to comment.