camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Schneider Christian <Christian.Schnei...@enbw.com>
Subject AW: Calling external webservice using cxf camel endpoint
Date Wed, 27 Oct 2010 09:15:49 GMT
Hi,

it looks like you simply want to convert the xml you receive in the first service to xml that
is suitable for the other service. I think in this case you should not use the cxf component.
Instead you should route from a jetty endpoint that receives the request to a http endpoint
that sends the converted request. If the service is request reply then you will also have
to convert the response. 


Best regards 

Christian


Christian Schneider
Informationsverarbeitung 
Business Solutions
Handel und Dispatching

Tel : +49-(0)721-63-15482

EnBW Systeme Infrastruktur Support GmbH
Sitz der Gesellschaft: Karlsruhe
Handelsregister: Amtsgericht Mannheim ­ HRB 108550
Vorsitzender des Aufsichtsrats: Dr. Bernhard Beck
Geschäftsführer: Jochen Adenau, Hans-Günther Meier


-----Ursprüngliche Nachricht-----
Von: Madhav Bhargava [mailto:unmarshall@gmail.com] 
Gesendet: Mittwoch, 27. Oktober 2010 11:03
An: users@camel.apache.org
Betreff: Calling external webservice using cxf camel endpoint

Hi All,

I am using Camel 2.4 and cxf 2.2.11 for a prototype that i am developing at
present.
I have created a bunch of JAX-WS webservices and they are hosted on my local
tomcat installation.

I am trying to configure a CXF endpoint in Camel which will bind to the
external webservice and post the soap request message to it. Following is
the Spring CXF configuration:

*<!-- CXF consumer endpoint - This will be the entry point.  -->*
<!--
---------------------------------------------------------------------------------------------------
-->
    <cxf:cxfEndpoint
        id="endpoint1"
        address="/sales"
        wsdlURL="sales.wsdl"
        endpointName="ns0:HTTP_Port"
        serviceName="ns0:SalesService">
        <cxf:properties>
            <entry key="dataFormat" value="PAYLOAD"/>
            <entry key="setDefaultBus" value="true"/>
        </cxf:properties>
    </cxf:cxfEndpoint>

*<!-- This is the externally hosted webservice -->*
<!--
---------------------------------------------------------------------------------------------------
-->
    <cxf:cxfEndpoint
        id="endpoint2"
        address="http://localhost:8080/jaxws-demows/SalesOrder"
        wsdlURL="http://localhost:8080/jaxws-demows/SalesOrder?wsdl"
        serviceName="ns2:SalesOrderService"
        endpointName="ns2:SalesOrderPort">
        <cxf:properties>
            <entry key="dataFormat" value="PAYLOAD"/>
        </cxf:properties>
    </cxf:cxfEndpoint>


*<!-- camel route -->*
<!--
---------------------------------------------------------------------------------------------------
-->
<camel:camelContext trace="true"
id="pipeline.example.camel-examples-cxf-composite-enrich">
<camel:route>
            <camel:from uri="cxf:bean:endpoint1"/>
            <camel:convertBodyTo type="java.lang.String" />
            <camel:to uri="xslt:convertForEndpoint2.xslt"/>
            <camel:to uri="cxf:bean:endpoint2"/>
            <camel:to uri="file:/c:/tmp?fileName=result.xml" />
 </camel:route>
</camel:camelContext>

For the external webservice represented by endpoint2 i only have one
operation defined so ideally i do not have to specify the operationName and
operationNamespace explicitly. When i submit a soap request using SOAP UI
then the first 3 endpoints in the above route run just fine, the response
from the first endpoint (consumer) is then converted to request for endpoint
2 using xslt endpoint successfully. However when the 4th endpoint in the
route (external webservice) is invoked then the following exception is
thrown:

org.apache.cxf.interceptor.Fault: BindingOperationInfo must be specified
        at
org.apache.camel.component.cxf.CxfConsumer$1.checkFailure(CxfConsumer.java:123)
~[na:na]
        at
org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:102)
~[na:na]
        at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
~[org.apache.cxf.cxf-bundle-2.2.11.jar:2.2.11]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown
Source) ~[na:1.6.0_21]
        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
~[na:1.6.0_21]
        at java.util.concurrent.FutureTask.run(Unknown Source)
~[na:1.6.0_21]
        at
org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
~[org.apache.cxf.cxf-bundle-2.2.11.jar:2.2.11]
        at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
~[org.apache.cxf.cxf-bundle-2.2.11.jar:2.2.11]
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
~[org.apache.cxf.cxf-bundle-2.2.11.jar:2.2.11]
        at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:111)
~[org.apache.cxf.cxf-bundle-2.2.11.jar:2.2.11]
        at
org.apache.cxf.transport.http_osgi.OsgiDestination.doMessage(OsgiDestination.java:80)
~[org.apache.cxf.cxf-bundle-2.2.11.jar:2.2.11]
        at
org.apache.cxf.transport.http_osgi.OsgiServletController.invokeDestination(OsgiServletController.java:321)
~[org.apache.cxf.cxf-bundle-2.2.11.jar:2.2.11]
        at
org.apache.cxf.transport.http_osgi.OsgiServletController.invoke(OsgiServletController.java:145)
~[org.apache.cxf.cxf-bundle-2.2.11.jar:2.2.11]
        at
org.apache.cxf.transport.http_osgi.OsgiServlet.invoke(OsgiServlet.java:53)
~[org.apache.cxf.cxf-bundle-2.2.11.jar:2.2.11]
        at
org.apache.cxf.transport.http_osgi.SpringOsgiServlet.invoke(SpringOsgiServlet.java:48)
~[org.apache.cxf.cxf-bundle-2.2.11.jar:2.2.11]
        at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:179)
~[org.apache.cxf.cxf-bundle-2.2.11.jar:2.2.11]
        at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:103)
~[org.apache.cxf.cxf-bundle-2.2.11.jar:2.2.11]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
~[org.apache.geronimo.specs.geronimo-servlet_2.5_spec-1.1.1.jar:1.1.1]
        at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:159)
~[org.apache.cxf.cxf-bundle-2.2.11.jar:2.2.11]
        at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
~[org.mortbay.jetty.jetty-6.1.23.jar:na]
        at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
~[org.mortbay.jetty.jetty-6.1.23.jar:na]
        at
org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.handle(HttpServiceServletHandler.java:64)
~[na:na]
        at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
~[org.mortbay.jetty.jetty-6.1.23.jar:na]
        at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
~[org.mortbay.jetty.jetty-6.1.23.jar:na]
        at
org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.handle(HttpServiceContext.java:111)
~[na:na]
        at
org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:64)
~[na:na]
        at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
~[org.mortbay.jetty.jetty-6.1.23.jar:na]
        at org.mortbay.jetty.Server.handle(Server.java:322)
~[org.mortbay.jetty.jetty-6.1.23.jar:na]
        at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
~[org.mortbay.jetty.jetty-6.1.23.jar:na]
        at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:939)
~[org.mortbay.jetty.jetty-6.1.23.jar:na]
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
~[org.mortbay.jetty.jetty-6.1.23.jar:na]
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
~[org.mortbay.jetty.jetty-6.1.23.jar:na]
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
~[org.mortbay.jetty.jetty-6.1.23.jar:na]
        at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
~[na:na]
        at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
~[org.mortbay.jetty.jetty-util-6.1.23.jar:na]
Caused by: java.lang.IllegalArgumentException: BindingOperationInfo must be
specified
        at org.apache.camel.util.ObjectHelper.notNull(ObjectHelper.java:262)
~[na:na]
        at
org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:113)
~[na:na]
        at
org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:50)
~[na:na]
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
~[na:na]
        at
org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:104)
~[na:na]
        at
org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:272)
~[na:na]
        at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:98)
~[na:na]
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
~[na:na]
        at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
~[na:na]
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
~[na:na]
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
~[na:na]
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
~[na:na]
        at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
~[na:na]
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
~[na:na]
        at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:174)
~[na:na]
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
~[na:na]
        at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
~[na:na]
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
~[na:na]
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
~[na:na]
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
~[na:na]
        at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:290)
~[na:na]
        at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:202)
~[na:na]
        at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:256)
~[na:na]
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
~[na:na]
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:143)
~[na:na]
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:78)
~[na:na]
        at
org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:99)
~[na:na]
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:70)
~[na:na]
        at
org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:98)
~[na:na]
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:89)
~[na:na]
        at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
~[na:na]
        at
org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:91)
~[na:na]
        at
org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:85)
~[na:na]
        at
org.apache.camel.component.cxf.CxfConsumer$1.invoke(CxfConsumer.java:97)
~[na:na]


I also tried explicitly setting the header properties - operationName and
namespace so that it picks up the binding operation info but it does not. I
also tried directly using HTTP POST on Camel HTTP endpoint but that also
does not work - it throws a Http 500 error code.

Any pointers would be helpful here.

Best Regards,
Madhav

-- 
When I tell the truth, it is not for the sake of convincing those who do not
know it, but for the sake of defending those that do

Mime
View raw message