Web Service Example - Creating a Web Service Request Workflow(3.0)


In this example, the Web Service Request workflow consists of the following agents:

  • TCP_IP: Collects the input data.

  • Analysis_1: Creates the UDR type WSCycle_charge and routes it to the Web Service Requester.

  • Web Service Requester (Processing): Sends a request to a Web Service server. Once the web server replies, the Web Service Requester forwards the reply to Analysis_2.

  • 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.
 

  1. 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.

  2. 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);
    }
  3. To enter the UDR type, click the Set To Input button in the Analysis agent.

    The type bytearray appears in the UDR types list.
     

  4. In the Web Service Request agent Configuration tab, click the Browse... button and enter the WS profile.
     

  5. To automatically set the HTTP address, click the Extract Profile Settings 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.

  6. In the Analysis_2 Configuration view, enter the following APL code into the text pane:

    consume {
       debug(input);
    }
  7. Click on the Set To Input button in the Analysis agent.

    The type bytearray appears in the UDR types list.