Warning

This component has been deprecated in favor to servicemix-http component.

Introduction

ServiceMix supports SOAP with Attachments for Java (SAAJ) and Apache Axis.

Invoking Web Services Using SAAJ

ServiceMix includes a component for invoking web services using SAAJ and Axis via JBI, as an InOut message exchange. The InOut message exchange pattern (MEP) is a request response pattern where the output message is replaced by a fault, if the message is not successful. For more details on the InOut MEP please see JSR 208. The following example invokes a web service to ask for a stock price:

<sm:activationSpec componentName="stockQuote" service="foo:stockQuote" endpoint="stockQuote">
  <sm:component><bean class="org.apache.servicemix.components.saaj.SaajBinding">
    <property name="soapEndpoint">
      <bean class="javax.xml.messaging.URLEndpoint">
        <constructor-arg value="http://64.124.140.30:9090/soap"/>
      </bean>
    </property>
  </bean></sm:component>
 </sm:activationSpec>

To invoke this function, pass the following request body:

<ns1:getQuote xmlns:ns1="urn:xmethods-delayed-quotes" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:se="http://schemas.xmlsoap.org/soap/envelope/" se:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

  <symbol xsi:type="xsd:string">SUNW</symbol>

</ns1:getQuote>

Below is the expected response:

<n:getQuoteResponse xmlns:n="urn:xmethods-delayed-quotes" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Result xsi:type="xsd:float">3.67</Result>
</n:getQuoteResponse>

Additional Resources

For a complete example, using SAAJ and incorporating the above code snippets, please see the HTTP Binding Example.
For details on JBI InOut message exchanges, please JSR 208.