Training: SOAP APIs
SOAP web services in EASYProcess are essentially just processes that are directly exposed to the internet rather than having to be run from a user interface. We will now create a simple SOAP API that allows the user to create sales order in JDE and the then return order number back to the user.
Step 1: Creating the Process
All EASYProcess API calls are directed to a process when they are called. Therefore, creating a process must be the first step in API creation. Creating a process that will be used as an API is no different than creating a process that is being created to run internally. In EASYProcess, navigate to the “Work with Processes” page either by clicking the Work with Processes button on the application home page or navigating to Process >> Process Home on the top menu. Click the Design New Process button on the top right to begin a new process creation.
Give the process a useful, informative name and description. Here we are making an web service that will look up an order in JDE, so we will name it OrderInfoLookup. Clicking continue on the Add New Process window will create the process and open the new process canvas.
Step 2: Creating Service Contract
The first step you should take after opening the process canvas is to define the SOAP contract. You do this by adding the ‘SOAPWorkshop/SOAPContract’ service. Inside that service you define the Request and Response as described below.
See two examples below.
- Example 1 shows a complex contract vs Example 2 which shows a simpler contract.
- Objects defined in a contract can go to any depth
- You cannot use any duplicate names in any node.
- Use Array attribute as below if you want to mark any data structure to be sent as an Array.
- The topmost node must be Arguments
- You can have multiple nodes inside Arguments.
- You should not have have nodes that will contain values directly inside Arguments. Example 3 is not a valid example.
Example 3 (Not Valid):
For this exercise we can use the XML provided in Example 2 to define our request inputs.
See two examples below.
- You can only have one top level node.
- The data structure defined can go to any depth
- Every node must be have a unique name
- If you want any nodes to have multiples, use Array=True attribute.
For this exercise we can use the XML provided in Example 2 to define our response.
Step 3: Complete your process
Go ahead and complete process. The values defined in the Request node of the SOAPContract service will appear in the Recommended Values. This will help in building the rest of the process. At run time, the user-provided input will appear in the exact same format.
Step 4: Specify output using SOAPResponse service.
The SOAPResponse service has a parameter Response that only takes XML as input. Make sure you specify the output exactly you defined it in the Response parameter in the SOAPContract service.
Step 5: Mapping the API to the Process
Once the process is defined it must be mapped to an API name before it can be used as an API. First navigate to the Work with SOAP Web Services page in the top menu by going to API >> SOAP Web Services. In the Add New section at the top of the page provide a name and description for your new web service. Then choose your process from the dropdown and select a security level. Finally, click Add.
This creates the web service, but it is not yet available. To make the web service available on your site, click the Publish button in the middle section of the page.
Step 5: Calling & Testing the API
Calling an API is done by sending an appropriately formatted request to the URL at which the web service is located. EASYProcess SOAP web services are all hosted at the normal website URL followed by SOAP. The WSDL can be retrieved by going to the website url followed by SOAP?WSDL. This can then be used by a variety of testing tools to test your service.