Communicating with Web Service
This small example shows how to communicate with a webservice from Navision.
Both SOAP and HTTP protocol comunication is shown.
You must handle exceptions/errors yourself. The examples are just meant for you to learn from.
I also included source code for a very simple web service written in C# on which the Navision code is based.
http://www.mibuso.com/dlinfo.asp?FileID=539
Discuss this download here.
Comments
The supplied example web service is created in Visual Studio 2003.
If you need assistance, don't hesitate to use the forum.
Note: Setting the correct namespace from Navision can be difficult. Make sure you check the specifications of the WSDL thoroughly.
I traded my sanity for a railgun
](*,)
I've followed all the steps in the code, changed a little bit to my needs and yet he returns with an error i cannot identify.
<?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>
- <soap:Fault>
<faultcode>soap:VersionMismatch</faultcode>
<faultstring>Possible SOAP version mismatch: Envelope namespace was unexpected. Expecting http://schemas.xmlsoap.org/soap/envelope/.
<detail />
</soap:Fault>
</soap:Body>
</soap:Envelope>
This is the error, hope u guys can help me out.
Thanks
Thanks to the author for this beautiful program
i've been having difficulties using web services. I added to the given web service one more method, which takes string as a parameter and return string. The problem is that if I pass a value to the web service, only empty string is passed. With integers and decimals everything woks fine. Does anyone has any ideas how to solve this issue? :?:
I've downloaded the file and unzipped it. Then I've imported the .fob file into Navision, with success (I get 2 extra codeunits). From now, I'm not sure what to do? How can I see the webservice or is this something I have to create myself? Or is this download only a small piece of the solution?
Please give me some feedback on this issue. Thank you!
Best regards, Luk.
I've downloaded this example and tryed to get the request from an official webservice form this site: http://www.webservicex.net/
after chanching some details in the navision code although i get this error message:
but i dont´t know the reason of this error?
have someone an idea?
Silvia
been strugling with this for days now....
it works because sample application sends this to the service and gets info, but i cannot get it translated into soap or html request...
any ideas on how to proceed with this syntax?
POST /CCMApi/AXL/V1/soapisapi.dll
Host: x.x.x.x:80
Accept: text/*
Authorization: Basic xxxx
Content-type: text/xml
Content-length: 480
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<axl:getPhone xmlns:axl="http://www.cisco.com/AXL/1.0" xsi:schemaLocation="http://www.cisco.com/AXL/1.0 http://gkar.cisco.com/schema/axlsoap.xsd" sequence="392">
<phoneName>SEP0011924AADC0</phoneName>
</axl:getPhone>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
this should be the response...
Received Packet len 65 (5320 remaining)
HTTP/1.1 200 OK
Content-Type: text/xml
Content-Length: 5255
Received Packet len 5255 (5255 remaining)
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<axl:getPhoneResponse xmlns:axl="http://www.cisco.com/AXL/API/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.cisco.com/AXL/API/1.0 http://CMPUBSRV/CCMApi/AXL/V1/axlsoap.xsd" sequence="392">
etc...
Benny Giebens
Maybe you can attend?
but in the mean time i was able to get the connection going...with the help of some other examples....
CREATE(locautXmlDoc);
locautXmlDoc.async := FALSE;
locautXmlDoc.load('C:\Input.xml');
CREATE(locautXmlHttp);
locautXmlHttp.open('POST','HTTP://10.0.0.245/CCMApi/AXL/V1/soapisapi.dll',0,'user','pasword');
locautXmlHttp.setRequestHeader('Host','10.0.0.245:80');
locautXmlHttp.setRequestHeader('Accept','text/*');
locautXmlHttp.setRequestHeader('Content-type','text/xml');
locautXmlHttp.setRequestHeader('Content-length','480');
locautXmlHttp.send(locautXmlDoc);
locautXmlDoc.load(locautXmlHttp.responseXML);
locautXmlDoc.save('C:\temp.xml');
And it works...
Now the hard part...getting some functionality out of this...but the start is there..
Benny Giebens
Great sample. I wonder if I can use complex data type in the XmlHttp. For example, the webservice using binary or records as the parameter. Can it be called by XmlHttp?
Thanks
Any comments are welcome!
Follow my blog at http://x-dynamics.blogspot.com