Communicating with Web Service

Administrator
Member, Moderator, Administrator Posts: 2,506
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.
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.
0
Comments
-
From the auther:
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.0 -
A most excellent post. I've often wondered how to do this from Navision, although so far haven't had a pressing reason to sit down and try. This will save me many hours when I finally need to call some web services:)Thad Ryker
I traded my sanity for a railgun0 -
Thanks for this post it has been very helpful. I am having one issue though. I cannot get the SOAPwithParameter function to work. The web service is being called, but the parameter is coming over as 0. I cannot see what I'm doing wrong. Any suggestions on where to look?
](*,)0 -
Hey everyone, i'm having sort of a problem with this "Communicating with Web Service".
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 program0 -
Hi all,
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? :?:0 -
Hello everyone,
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.0 -
Hi all,
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?<?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:Client</faultcode> <faultstring>System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: http://www.webservicex.net/globalweather.asmx/GetWeather. at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest() at System.Web.Services.Protocols.SoapServerProtocol.Initialize() at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)</faultstring> <detail/> </soap:Fault> </soap:Body> </soap:Envelope>
Thanks in advance
Silvia0 -
Hi all,
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...Rgds
Benny Giebens0 -
This evening, there is a MSDN session about Web Services with NAV, at Microsoft's location in Diegem. See topic Belgian MSDN/TechNet Evenings on Dynamics NAV.
Maybe you can attend?No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0 -
I'll be there....with some collegues...
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..Rgds
Benny Giebens0 -
Hi,
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?
Thanks0 -
My experience in implementing webservice in NAV for server-side and client-side at http://x-dynamics.blogspot.com
Any comments are welcome!Sincerely yours, GRIZZLY
Follow my blog at http://x-dynamics.blogspot.com0
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