Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Figure 1: Service Activator  EIP

Example

...

scenario

This example scenario demonstrates how WSO2 ESB can be used to activate only a specific amount of services, which is exposed to a back-end Axis2 server. Using the publishWSDL, the service WSDL file was modified to filter out only a specific amount of services. The ability of the ESB to create proxy services allows the client to invoke the ESB proxy instead of invoking the service in Axis2 server.      

Implementing the Example Scenario in WSO2 ESB

...

The diagram below depicts how to simulate the example scenario using the WSO2 ESB.

...

Figure 1: Service Activator EIPFigure 2: Service Activator Example Scenario
RequestorSimple Stock Quote Client 
Service ActivatorProxy Service
ReplierSimple Stock Quote Service

Environment

...

setup

...

  1. Download an install the WSO2 ESB from http://wso2.com/products/enterprise-service-bus. For a list of prerequisites and step-by-step installation instructions, refer to Getting Started in the WSO2 ESB documentation.

...

  1. Start two Sample Axis2 server instances in ports 9001 and 9002. For instructions, refer to section ESB Samples Setup - Starting Sample Back-End Services in the WSO2 ESB documentation.

ESB

...

configuration

3. Start the ESB server and log into its management console UI (https://localhost:9443/carbon). In the management console, navigate to Main Menu, click Service Bus and then Source View. Next, copy and paste the following configuration, which helps you explore the example scenario, to the source view.

Anchor
step3
step3

Code Block
languagehtml/xml
<definitions xmlns="http://ws.apache.org/ns/synapse">
   <proxy name="ServiceActivatorProxy" startOnLoad="true">
      <target>
         <endpoint>
            <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
         </endpoint>
         <outSequence>
            <send/>
         </outSequence>
      </target>
      <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
   </proxy>
   <sequence name="fault">
      <log level="full">
         <property name="MESSAGE" value="Executing default &#34;fault&#34; sequence"/>
         <property name="ERROR_CODE" expression="get-property('ERROR_CODE')"/>
         <property name="ERROR_MESSAGE" expression="get-property('ERROR_MESSAGE')"/>
      </log>
      <drop/>
   </sequence>
   <sequence name="main">
      <in/>
      <out>
         <send/>
      </out>
   </sequence>
</definitions>

Simulating the

...

sample scenario

4. Back-end StockQuoteService offers the following services:

...

Only some of the back-end features will be published through the Service Activator Proxy. Browse http://localhost:8280/services to view the services offered through the ServiceActivatorProxy, and note that services getMarketActivity and getSimpleQuote are not available. Others are available and active.  

How the

...

implementation works

Let's investigate the elements of the ESB configuration in detail. The line numbers below refer to the ESB configuration in step 3 above.

  • Proxy [line 3 in ESB config] - The proxy service creates a virtual service between the real back-end service and a requestor.
  • publishWSDL [line 12 in ESB config] - By default, a proxy service defines a one-to-one mapping of the back-end service interface and provides this in the form of a WSDL file that requestors can use to connect to the proxy service. By using the publishWSDL mediator, the proxy service can publish a custom interface. In this example, the publishWSDL mediator is used to provide access only to a subset of all the service methods available to the back-end service. 

...

hiddentrue

...