Putting SOAP on a rope (part 1)
First, forgive the title of this post. I couldn't help myself.
Now that we're past that, every now and then I get called on to make SOAP work for customers. It used to be pretty popular back in the day (2009-ish) but now REST (specifically OData in the NAV/BC world) is all the rage. I like OData, it's easier to work with for most purposes but even now there are still a few things that SOAP is better at. One thing that makes SOAP difficult is that it's got a more complex structure and is not easily understood. With OData, you just set your verb and give it a little JSON and you're up and running. I recently had to help someone get SOAP working and in the process I debugged the calls with Wireshark and Fiddler and I wanted to document what I got out of that. It might just help me a few years from now and help someone else sooner.
First the basics. In the interest of being complete, I'll jot down the first steps just in case anyone else is looking. To get a list of SOAP endpoints, NAV/BC (henceforth referred to as BC) always publishes a WSDL page at WS/Services. For example:
From here, you can enter the URL in the ref attribute to get more information about the endpoint.
This is a pretty basic call. Possibly the simplest one you can do. Almost everything comes from the page metadata we got earlier.
- In order to retrieve data, you need to specify a company. Any special characters should be URL encoded although many utilities will do that for you automatically.
- The soapAction goes in the header, as discussed earlier.
- An abbreviated version of the soapAction serves as the encapsulating XML element.
- The namespace associated with the action can be found at the top of the endpoint metadata. You can see it in the XML we got earlier.
- Finally, the endpoint name serves as the inner XML element. Within this, we can put additional elements for filters and fields.
Comments
Post a Comment