Camel route endpoint format for external SOAP binding
phk Feb 6, 2013 4:26 AMHi,
I am trying to expose an existing thirdparty SOAP-based webservice via a REST-based interface ie. sort of REST->SOAP bridge.
With my current magic level in Switchyard terminology in mind - what I have already is this (deployed in a 0.7 final runtime):
- a ChangeResource service exposed via a REST binding and corresponding JAXB annotations
- a Camel route (xml-based) that routes between the two
- a Reference to the external SOAP service with the WSDL as the interface/contract
- A java-based transformer to map between the SOAP types and the java ones (not shown in the screenshot)
All of these bits and pieces seem to deploy without any errors:
(...)
10:06:03,722 INFO [org.switchyard.common.camel.SwitchYardCamelContext] (MSC service thread 1-1) Route: direct:{urn:dk.jndata.kls:phk-test-soap:1.0}ServiceManagerExternalWebservice started and consuming from: Endpoint[direct://%7Burn:dk.jndata.kls:phk-test-soap:1.0%7DServiceManagerExternalWebservice]
10:06:03,764 INFO [org.switchyard.common.camel.SwitchYardCamelContext] (MSC service thread 1-1) Route: route4 started and consuming from: Endpoint[switchyard://RouteService?namespace=urn%3Adk.jndata.kls%3Aphk-test-soap%3A1.0]
10:06:03,850 INFO [org.switchyard.common.camel.SwitchYardCamelContext] (MSC service thread 1-1) Route: direct:{urn:dk.jndata.kls:phk-test-soap:1.0}ChangeResource started and consuming from: Endpoint[direct://%7Burn:dk.jndata.kls:phk-test-soap:1.0%7DChangeResource]
(...)
However when I try to call the REST-service the call gets all the way to the Camel route (I placed a log message in the route.xml to verify this) but then Camel chokes with following:
10:19:55,527 INFO [route4] (http-localhost-127.0.0.1-8080-2) Route - message received: <chan:getChangeRequest xmlns:chan="http://change.teg.globicon.dk"><chan:getChange><chan:changeId>12345</chan:changeId><chan:userId>MASKED</chan:userId><chan:password>MASKED</chan:password></chan:getChange></chan:getChangeRequest> for operation getChange
10:19:55,535 ERROR [org.apache.camel.processor.DefaultErrorHandler] (http-localhost-127.0.0.1-8080-2) Failed delivery for (MessageId: ID-WJN00628-10366-1360140433452-4-3 on ExchangeId: ID-WJN00628-10366-1360140433452-4-4). Exhausted after delivery attempt: 1 caught: org.switchyard.HandlerException: org.switchyard.exception.SwitchYardException: No registered service found for {urn:dk.jndata.kls:phk-test-soap:1.0}ServiceManagerExternalWebservice: org.switchyard.HandlerException: org.switchyard.exception.SwitchYardException: No registered service found for {urn:dk.jndata.kls:phk-test-soap:1.0}ServiceManagerExternalWebservice
The route is defined like this:
<route xmlns="http://camel.apache.org/schema/spring">
<from uri="switchyard://RouteService"/>
<log message="Route - message received: ${body} for operation ${header.org.switchyard.operationName} "/>
<setHeader headerName="operationName">
<simple>${header.org.switchyard.operationName}</simple>
</setHeader>
<to uri="switchyard://ServiceManagerExternalWebservice"/>
</route>
Should I use some other type of camel protocol prefix than "switchyard" in the route in order to access the SOAP service ?
The external SOAP service should not be registered as a service but as a outbound reference, right?
Here's the switchyard.xml contents:
<switchyard xmlns="urn:switchyard-config:switchyard:1.0" xmlns:bean="urn:switchyard-component-bean:config:1.0" xmlns:camel="urn:switchyard-component-camel:config:1.0" xmlns:resteasy="urn:switchyard-component-resteasy:config:1.0" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" xmlns:soap="urn:switchyard-component-soap:config:1.0" xmlns:transform="urn:switchyard-config:transform:1.0" name="phktest-soap" targetNamespace="urn:dk.jndata.kls:phk-test-soap:1.0">
<sca:composite name="phktest-soap" targetNamespace="urn:dk.jndata.kls:phk-test-soap:1.0">
<sca:component name="Route">
<camel:implementation.camel>
<camel:xml path="route.xml"/>
</camel:implementation.camel>
<sca:service name="RouteService">
<sca:interface.wsdl interface="TegFacadeChange.wsdl#wsdl.porttype(TegFacadeChangePortType)"/>
</sca:service>
<sca:reference name="ServiceManagerExternalWebservice">
<sca:interface.wsdl interface="TegFacadeChange.wsdl#wsdl.porttype(TegFacadeChangePortType)"/>
</sca:reference>
</sca:component>
<sca:reference name="ServiceManagerExternalWebservice" multiplicity="0..1" promote="Route/ServiceManagerExternalWebservice">
<sca:interface.wsdl interface="TegFacadeChange.wsdl#wsdl.porttype(TegFacadeChangePortType)"/>
</sca:reference>
<sca:service name="ChangeResource" promote="Route/RouteService">
<sca:interface.java interface="dk.jndata.kls.phk_test_soap.ChangeResource"/>
<resteasy:binding.rest>
<resteasy:contextMapper/>
<resteasy:interfaces>dk.jndata.kls.phk_test_soap.ChangeResource</resteasy:interfaces>
<resteasy:contextPath>phktest-soap</resteasy:contextPath>
</resteasy:binding.rest>
</sca:service>
</sca:composite>
</switchyard>
Thanks,
Paul