Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

  1. Start the Apache Axis2 server and add the AdderService.aar file in the GREG_HOME/samples/ws-executor intowhich can be downloaded here, into AXIS2_HOME/repository/services.
  2. Go to http://localhost:8080/axis2/services/ and get AdderService from this. You can copy the WSDL location which should look like the following: http://localhost:8080/axis2/services/AdderService?wsdl.
  3. Start SoapUI and create a new project and give the WSDL path that was obtained in step 2.
     
  4. Send an request to the Web Service using the SoapUI. Add some random values to args0 and args1.
     
    The response can be seen through SoapUI after successful service invocation.
     
  5. Start WSO2 Governance Registry and go to Extensions > Configure > Lifecycles and click on Add New Lifecycle.

     
  6. Add the following segment under the datamodel tag in Development state and save the Lifecycle.

    Code Block
    languagehtml/xml
    <data name="transitionExecution">
            <execution forEvent="Promote" class="org.wso2.carbon.governance.registry.extensions.executors.WSExecutor">
                        <parameter name="async" value="false"/>
                        <parameter name="save.type" value="property"/>
                        <parameter name="save.name" value="response"/>
                        <parameter name="response.xpath" value="//ns:return"/>
                        <parameter name="response.namespace" value="http://ws.apache.org/axis2"/>
                        <parameter name="response.namespace.prefix" value="ns"/>
                        <parameter name="epr" value="http://localhost:8080/axis2/services/AdderService.AdderServiceHttpSoap11Endpoint/"/>
                        <parameter name="payload">
    						<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:axis="http://ws.apache.org/axis2">
       							<soapenv:Header/>
       				    		<soapenv:Body>
          							<axis:add>
             							<axis:args0>5</axis:args0>
            							<axis:args1>6</axis:args1>
          							</axis:add>
       							</soapenv:Body>
    						</soapenv:Envelope>
    					</parameter>
              </execution>
    </data>
    Panel

    async - This is set to false since this is meant to be a synchronous call.
    save.type - This is given as a property to save the response in a property.
    save.name - This is given as response. You can change this to any value you prefer.
    response.xpath - XPath to evaluate the response. This example only takes the return segment into consideration.
    response.namespace - This can be found in the response in SoapUI.
    response.namespace.prefix - This can be found in the response in SoapUI
    epr - The endpoint of the service this can be found from soapUI. For this example it is: http://localhost:8080/axis2/services/AdderService.AdderServiceHttpSoap11Endpoint/.
    payload - The payload can be directly copied from the request in soapUI.

    Code Block
    languagehtml/xml
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:axis="http://ws.apache.org/axis2">
       <soapenv:Header/>
       <soapenv:Body>
          <axis:add>
             <axis:args0>5</axis:args0>
             <axis:args1>6</axis:args1>
          </axis:add>
       </soapenv:Body>
    </soapenv:Envelope>
  7. Create a new API and add the “SampleLifeCycle” as the lifecycle. 
    Image Modified
    Image Modified

     

    Info

    Alternatively, it is possible to specify the lifecycle in the default lifecycle tag of the artifact configuration: <lifecycle>SampleLifeCycle</lifecycle>.

  8. Do an Promote operation. The response value is saved in the property when the promote operation is successful.
     

...

Excerpt
hiddentrue

This sample explains how the Web Service Executor can be used in lifecycle configurations to invoke a Web Service.