2

I'm trying to write a SOAP Web Service that:

  1. accepts one request type A
  2. maps request A to another outbound request type B
  3. sends request B to an external SOAP service
  4. maps the response B back to a response A object (and returns it)

I have this working when the endpoint (B) is statically configured.

But I want to be able to hit a variety of services with varying request/response types. These would probably be configured via a properties file.

Is it possible to do this in some generic/dynamic way?

Here's my spring camel XML:

<!— SOAP inbound service —>
<cxf:cxfEndpoint
        id="paymentService_A"
        serviceClass="#paymentServiceBean"
        address="/PaymentService"/>

<!— SOAP outbound service —>
<cxf:cxfEndpoint
        id=“paymentService_B"
        wsdlURL="http://localhost:9080/externalpayment/ExternalPaymentService?wsdl"
        serviceClass="com.yngwietiger.ExternalPayment"
        address="http://localhost:9080/externalpayment/ExternalPaymentService"/>

<!— MAP from inbound SOAP request object to external SOAP request object —>
<bean id="mapAToB_RequestProcessor" class="com.yngwietiger.MyProcessor"/>

<!— MAP external SOAP response to a response for the initial/inbound SOAP request —>
<bean id="mapBToA_ResponseProcessor" class="com.yngwietiger.MyPostProcessor"/>

<camel:camelContext id="camelContext">

    <camel:route>

        <camel:from uri="cxf:bean:paymentService_A"/>
        <camel:process ref="mapAToB_RequestProcessor"/>
        <camel:to uri="cxf:bean:paymentService_B"/>
        <camel:process ref="mapBToA_ResponseProcessor"/>

    </camel:route>

</camel:camelContext>

Obviously, I'm using Camel's cxfEndpoint bean. But I don't see any way to set the address, wsdlURL, etc for each request. Is that possible?

Or am I going to have to build a route for each type? If so, how do I build one of these cxfEndpoints dynamically?

Would using Spring's WS Template be more flexible?

Is there a better way that I should be doing this?

Thanks in advance.

2 Answers 2

1

Camel Recipient List would better fit into your requirement. This is the link, http://camel.apache.org/recipient-list.html. You have to generate the dynamic endpoint and set into the header somewhere in the route and call the recipient list.

0

I think you can use HTTP endpoint for your outbound message. As it is done in the example here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.