This is Part 5 of a 5 part series on creating and consuming web services for Sage X3 Version 12. This part will focus on consuming subprogram based web services from .Net. In Part 1 we discussed setup of a Sage X3 Web Services Pool, and in Part 2 we discussed creating and publishing web services based on X3 objects and subprograms, and in Part 3 we discussed using the X3 web services tester to test and evaluate web services, and in Part 4 we discussed calling X3 object-based web services from a .Net program.
X3 Web Services can be consumed from .net by using the web services WSDL from X3. Below are the steps to creating a new .Net project to consume X3 web services. To get started with the solution, instructions on adding the WSDL and creating the authorization class are covered in the blog post for Day 4, which covers creating the initial .net application for web service consumption.
Below is a sample .net context initialization.
Calling a web service that was published from an X3 subprogram requires use of the “run” method from the web services. Below is an example of the calling the YWSCUSTLIS subprogram that we created in the Day 2 series.
1. The first step is the initialize the call context and the basic authentication properties.
2. If the status is 1, the web service was successful. The web service result can be deserialized from an XML or JSON string into a pre-defined class.
3. The pre-defined class that the results are deserialized into is shown below.
You have now learned how to create a .net program to consume a subprogram-based web service.
Day 1 - Creating a Classic SOAP Pool
Day 2 - Creating and Publishing Web Services
Day 4- Consuming Web Services in .NET
Day 5 - Consuming X3 Subprogram Web Services from .Net
Contact us if you want to learn more about Sage ERP X3 Web Services features or to request help with your system.