Time for action – incorporating a SOAPProcessor client

We will now modify the sample to use SOAPProcessor:

  1. In JBoss Developer Studio, open the esbcontent/META-INF/jboss-esb.xml file in Source mode.
  2. Replace the following code:
    <action name="requestAction"class="org.jboss.soa.esb.samples.chapter8.MyRequestAction"
     />
    <action class="org.jboss.soa.esb.actions.soap.wise.SOAPClient"
    name="soap-wise-client-action">
      <property name="wsdl"
             value="http://localhost:8080/BookService?wsdl"/>
      <property name="SOAPAction" value="getBooks"/>
      <property name="EndPointName" value="BookServicePort"/>
    </action>

    With the following code:

    <action class="org.jboss.soa.esb.actions.soap.SOAPProcessor"
            name="JBossWSAdapter">
      <property name="jbossws-endpoint" value="BookService"/>
      <property name="jbossws-context" value="BookService"/>
    </action>
    <action name="print-after"
            class="org.jboss.soa.esb.actions.SystemPrintln">
      <property name="message"
                value="AFTER invoking jbossws endpoint"/>
    </action>
  3. Add another listener to this service:
    <service category="Chapter8Sample" description=""
             name="Chapter8WSClient">
      <listeners>
        <jms-listener busidref="Chapter8EsbChannel2"
                      name="Chapter8EsbListener"/>
        <jms-listener busidref="Chapter8GwChannel"
                      name="Chapter8GwListener"
                      is-gateway="true"/>
      </listeners>
  4. Click the Save button and the modified application should now be deployed in the server.
  5. Select the src folder, expand it till the SendJMSMessage.java file is displayed in the tree. Now click Run | Run As | Java Application:
    Time for action – incorporating a SOAPProcessor client
  6. The server Console will display the output as shown:
    INFO  [STDOUT] AFTER invoking jbossws endpoint:
    INFO  [STDOUT] [<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header></env:Header><env:Body><ns2:getBooksResponse xmlns:ns2="http://chapter8.samples.esb.soa.jboss.org/"><return>Great Expectations</return><return>Hound Of The Baskervilles</return><return>The Da Vinci Code</return><return>The Immortals Of Meluha</return></ns2:getBooksResponse></env:Body></env:Envelope>].
    

What just happened?

We used SOAPProcessor to invoke the web service. We used a JMS queue to send a SOAP message. Notice that SendJMSMessage.java uses the gateway queue to send the SOAP message.

QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
conn = qcf.createQueueConnection();
que = (Queue) iniCtx.lookup("queue/chapter8_Request_gw");
replyQueue =(Queue) iniCtx.lookup("queue/chapter8_Request_esb2_reply");

Notice we also removed the MyRequestAction from the pipeline.

Have a go hero – co-located services

Use other gateways like HTTP or File to send the SOAP requests. Route the response to another ESB service and write the contents to a file. Look at the webservice_wssecurity and webservice_wsaddressing quickstarts for usage of these advanced features.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.216.186.164