简体   繁体   中英

Apache CXF JMS - SOAP

I need to use the same SOAP request to be able to call the same implementation of a method but which is exposed by 2 different service endpoints:

  1. Endpoint A - would be for synchronous access via SOAP
  2. Endpoint B - would be for asynchronous access via JMS

Now what am seeing is that the SOAP request Message which works on the JMS and the SOAP webservice endpoint are structurally different.

I wanted to know whether with ApacheCXF it is possible to call the SOAP or JMS endpoints using the same SOAP request ?

In my case I was able to call both endpoints but the requests used is not the same for each

Below is an example of the SOAP message which works on Asynch Endpoint B but which does not work on Synch Endpoint A .. note that I've obtained the Asynch message by executing a Junit test and intercepted the generate message on ActiveMQ queue:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

<soap:Body>
    <ns1:create xmlns:ns1="http://service.ws.example/">
        <CustomPartyModel>
            <ns2:customerModel
                xmlns:ns2="http://party.beans.commons.example">
                <ns2:person>
                    <ns2:budgetPlanNumber>131484</ns2:budgetPlanNumber>
                    <ns2:clientSituationCode
                        xmlns:ns3="http://www.w3.org/2001/XMLSchema-instance" ns3:nil="true" />
                    <ns2:employeeReduction>J</ns2:employeeReduction>
                    <ns2:employeeNumber></ns2:employeeNumber>
                    <ns2:packageNumber>5</ns2:packageNumber>
                    <ns2:planIndicator xmlns:ns3="http://www.w3.org/2001/XMLSchema-instance"
                        ns3:nil="true" />
                    <ns2:privateRelationNumber
                        xmlns:ns3="http://www.w3.org/2001/XMLSchema-instance" ns3:nil="true" />
                </ns2:person>
            </ns2:customerModel>

        </CustomPartyModel>
    </ns1:create>
</soap:Body>

Here is the SOAP Request which works on Synchronous endpoint but not on the Asynch one .. this request was obtained from creating a request from the WSDL :

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.ws.example/" xmlns:par="http://party.beans.commons.example">
 <soapenv:Body>
  <ser:CustomPartyModel>
    <par:customerModel>

        <par:person>

           <par:budgetPlanNumber>131484</par:budgetPlanNumber>

           <par:employeeReduction>J</par:employeeReduction>

           <par:employeeNumber></par:employeeNumber>

        <par:packageNumber>5</par:packageNumber>


           <par:professionCodePartner></par:professionCodePartner>

           <par:professionDescriptionPartner></par:professionDescriptionPartner>

        </par:person>
     </par:customerModel>

  </ser:CustomPartyModel>

In both cases am using Aegis for data binding , I did try JAXB as well but with no futher success.

Given that its the same method with same method signature you would expect that the same request could be used in both asynch and synch but this does not seem to be the case .

Anybody has had similar issues or could possibly shed some light in regards to this ?

Note that am using the following dependencies: cxf-api-2.2.2.jar , cxf-common-utilities-2.2.2.jar, cxf-rt-databinding-aegis-2.2.2.jar, XmlSchema-1.4.5.jar, cxf-rt-transports-jms-2.2.2.jar, spring-jms-2.5.5.jar, acegi-security-1.0.7.jar

Ok I found the solution basically to be able to send Request through JMS and Synchronous SOAP as Document Literal the following is required to be defined on the interface

@WebService
@SOAPBinding(style=Style.DOCUMENT, use=Use.LITERAL,parameterStyle=ParameterStyle.BARE)
public interface ExampleAsyncService {

Without the Document / Literal / Bare configuration JMS will have a tendancy of sending RPC wrapped style request .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM