We will now modify the sample to use SOAPProcessor
:
esbcontent/META-INF/jboss-esb.xml
file in Source mode.<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>
<service category="Chapter8Sample" description="" name="Chapter8WSClient"> <listeners> <jms-listener busidref="Chapter8EsbChannel2" name="Chapter8EsbListener"/> <jms-listener busidref="Chapter8GwChannel" name="Chapter8GwListener" is-gateway="true"/> </listeners>
src
folder, expand it till the SendJMSMessage.java
file is displayed in the tree. Now click Run | Run As | Java Application: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>].
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.