Web Service Example - Creating a Web Service Request Workflow(3.0)
In this example, the Web Service Request workflow consists of the following agents:
Collects the input data.
Creates the UDR type WSCycle_charge and routes it to the Web Service Requester.
Sends a request to a Web Service server. Once the web server replies, the Web Service Requester forwards the reply to Analysis_2.
Receives the Web Service reply. In this example we use this agent for output demonstration.
The Web Service Request workflow
Configuring the Agents
In the Workflow Editor, open the configuration views of both agents.
Â
In the TCP_IP agent configuration view, set Port to 3210.
Note!
This port number should not be the same as the Web Service Provider port number.
In the Analysis_1 agent configuration view, enter the following APL code into the text pane:
import ultra.ws.example.charge.cycles; import ultra.ws.example.charge.x1; consume { // Create a WSCycle_charge UDR WSCycle_charge udr = udrCreate(WSCycle_charge); // Creaete a Charger UDR as parameter udr.param = udrCreate(Charge); // Populate the parameter with data udr.param.chargingEvent = udrCreate(ChargingEvent); udr.param.chargingEvent.amount = 0.50; udr.param.chargingEvent.id = "0123456789"; udr.param.serviceType = "SMS"; // Route the UDR udrRoute(udr); }
To enter the UDR type, click theÂ
button in the Analysis agent.The type bytearray appears in the UDR types list.
ÂIn the Web Service Request agent Configuration tab, click the ... button and enter the WS profile.
ÂTo automatically set the HTTP address, click theÂ
button.Note!
In this example the HTTP address is http://localhost:8080/charge. This is the same address that the Web Service Provider is assigned with. To use the same address for the Provider agent as the Requester agent, enables the Web Service Request workflow to act as a client of the Web Service Provider workflow.
In the Analysis_2 Configuration view, enter the following APL code into the text pane:
consume { debug(input); }
Click on theÂ
button in the Analysis agent.The type bytearray appears in the UDR types list.