How to create a generic SOAP consumer?

classic Classic list List threaded Threaded
22 messages Options
12
Reply | Threaded
Open this post in threaded view
|

How to create a generic SOAP consumer?

Smith-John
Hi,

I need a generic SOAP consumer but don't know how to build it.
The consumer should be able to consume any kind of SOAP message and should be able to pick out the body of it.

I tried to realize it with cxf-component and MESSAGE format, but this way I can't handle headers.

With PAYLOAD dataformat I don't know how I can make the consumer to be generic. Always getting  "Message part XXX was not recognized.  (Does it exist in service WSDL?)". Is there a way to define the wsdl to be able to handle any kind of requests?


Regards.
Reply | Threaded
Open this post in threaded view
|

Re: How to create a generic SOAP consumer?

Christian Mueller
Administrator
Did you checked the camel-soap component?

Sent from a mobile device
Am 29.04.2013 16:36 schrieb "Smith-John" <[hidden email]>:

> Hi,
>
> I need a generic SOAP consumer but don't know how to build it.
> The consumer should be able to consume any kind of SOAP message and should
> be able to pick out the body of it.
>
> I tried to realize it with cxf-component and MESSAGE format, but this way I
> can't handle headers.
>
> With PAYLOAD dataformat I don't know how I can make the consumer to be
> generic. Always getting  "Message part XXX was not recognized.  (Does it
> exist in service WSDL?)". Is there a way to define the wsdl to be able to
> handle any kind of requests?
>
>
> Regards.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-to-create-a-generic-SOAP-consumer-tp5731741.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: How to create a generic SOAP consumer?

Smith-John
Do you mean http://code.google.com/p/camel-soap/wiki/Introduction ?
I'm not sure about the license since this isn't an official camel component.
Reply | Threaded
Open this post in threaded view
|

Re: How to create a generic SOAP consumer?

Claus Ibsen-2
Hi

No there is a camel-soap as part of Apache Camel
http://camel.apache.org/soap

This is a transport agnostic soap data format, that can read/write
soap messages.



On Tue, Apr 30, 2013 at 8:22 PM, Smith-John <[hidden email]> wrote:
> Do you mean http://code.google.com/p/camel-soap/wiki/Introduction ?
> I'm not sure about the license since this isn't an official camel component.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-create-a-generic-SOAP-consumer-tp5731741p5731818.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: How to create a generic SOAP consumer?

Smith-John
But I need to expose a Web Service first to receive the soap messages at all.
Reply | Threaded
Open this post in threaded view
|

Re: How to create a generic SOAP consumer?

Claus Ibsen-2
Hi

For web services you can use
http://camel.apache.org/cxf
http://camel.apache.org/spring-web-services.html

Or use a plain HTTP service such as jetty with the soap data format
http://camel.apache.org/jetty

And for WS/SOAP examples you can find some here
http://camel.apache.org/examples

For example the little proxy example may be a good start
http://camel.apache.org/cxf-proxy-example.html

Or if you want to use spring WS then there is also an example
http://camel.apache.org/spring-ws-example.html


If you have a copy of Camel in Action book, then check chapter 7, as
there is web service examples with the camel-cxf component.

On Wed, May 1, 2013 at 11:00 AM, Smith-John <[hidden email]> wrote:
> But I need to expose a Web Service first to receive the soap messages at all.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-create-a-generic-SOAP-consumer-tp5731741p5731844.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: How to create a generic SOAP consumer?

Sachin
In reply to this post by Smith-John
Have you tried using xs:anytype as your payload type?
Reply | Threaded
Open this post in threaded view
|

Re: How to create a generic SOAP consumer?

Smith-John
In reply to this post by Claus Ibsen-2
Hi,

thanks for the survey.

But is it possible with cxf to get a generic SOAP consumer? With generic I mean that it can handle all possible kinds of different SOAP messages. Using MESSAGE dataformat it can't handle headers and with POJO dataformat I have to provide e.g. serviceClass that I haven't, cause it should be generic.

Using jetty component and parsing the message with soap.MessageFactory should work I think but since I already need cxf-compnent for an other route I would also like to use it for this problem.

So, is it possible with cxf?

Regards.
Reply | Threaded
Open this post in threaded view
|

Re: How to create a generic SOAP consumer?

Smith-John
In reply to this post by Sachin
Hi, i tried it with:

        <wsdl:message name="Message">
                <xsd:part name="body" element="xsd:any" />
        </wsdl:message>
        <wsdl:portType name="PortType">
                <wsdl:operation name="operation">
                        <wsdl:input message="tns:Message">
                        </wsdl:input>
                </wsdl:operation>
        </wsdl:portType>

Isn't this right?
Reply | Threaded
Open this post in threaded view
|

Re: How to create a generic SOAP consumer?

Claus Ibsen-2
In reply to this post by Smith-John
Hi

There is a CXF_MESSAGE format that may allow you to do a generic SOAP
consumer with camel-cxf.
http://camel.apache.org/cxf

On Sat, May 4, 2013 at 2:05 PM, Smith-John <[hidden email]> wrote:

> Hi,
>
> thanks for the survey.
>
> But is it possible with cxf to get a generic SOAP consumer? With generic I
> mean that it can handle all possible kinds of different SOAP messages. Using
> MESSAGE dataformat it can't handle headers and with POJO dataformat I have
> to provide e.g. serviceClass that I haven't, cause it should be generic.
>
> Using jetty component and parsing the message with soap.MessageFactory
> should work I think but since I already need cxf-compnent for an other route
> I would also like to use it for this problem.
>
> So, is it possible with cxf?
>
> Regards.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-create-a-generic-SOAP-consumer-tp5731741p5732014.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: How to create a generic SOAP consumer?

Smith-John
Hi,

can you please give me a example how to use CXF_MESSAGE format?
http://camel.apache.org/cxf doesn't say much about it.

Trying it like from("cxf:http://localhost:8080/service?dataFormat=CXF_MESSAGE") I'm getting a NP exception.

And with providing a wsdl like from("cxf:http://localhost:8050/SoapPluginCallback?wsdlURL=someurltoawsdl&dataFormat=CXF_MESSAGE") I have the problem again that incoming soap messages doesn't match the ecpected ones from the wsdl. ("Message part XXX was not recognized.  (Does it exist in service WSDL?)")

Regards.
Reply | Threaded
Open this post in threaded view
|

RE: How to create a generic SOAP consumer?

siano
Hi,

What do you mean by "the incoming soap message doesn't match the expected one from the wsdl"? The incoming message is of course supposed to match the format defined in the wsdl (that's the contract for the communication), so if you provide a wsdl the messages sent to that provider have to match the description in there.

I think the example http://camel.apache.org/cxf-example.html may give you some guidance for communications without a WSDL.

Best regards
Stephan

-----Original Message-----
From: Smith-John [mailto:[hidden email]]
Sent: Dienstag, 7. Mai 2013 13:57
To: [hidden email]
Subject: Re: How to create a generic SOAP consumer?

Hi,

can you please give me a example how to use CXF_MESSAGE format?
http://camel.apache.org/cxf doesn't say much about it.

Trying it like
from("cxf:http://localhost:8080/service?dataFormat=CXF_MESSAGE") I'm getting
a NP exception.

And with providing a wsdl like
from("cxf:http://localhost:8050/SoapPluginCallback?wsdlURL=someurltoawsdl&dataFormat=CXF_MESSAGE")
I have the problem again that incoming soap messages doesn't match the
ecpected ones from the wsdl. ("Message part XXX was not recognized.  (Does
it exist in service WSDL?)")

Regards.



--
View this message in context: http://camel.465427.n5.nabble.com/How-to-create-a-generic-SOAP-consumer-tp5731741p5732117.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

RE: How to create a generic SOAP consumer?

Smith-John
Hi,

I have no problem with cxf and SOAP in general.

But the consumer I need has to be generic. It should be able to consume all incoming SOAP messages however they look like. Therefore I either need a "generic" wsdl (if this is possible) or I need a way to realise this without a wsdl.

I would appreciate if anyone could provide me a Java DSL snippet how to create a generic SOAP consumer (with cxf and headers support).

Regards.
Reply | Threaded
Open this post in threaded view
|

Re: How to create a generic SOAP consumer?

Aki Yoshida-3
If you want to have the soap header part processed by CXF and let the
payload (i.e,, the soap body content) generically to be propagated to the
camel route, you should configure the cxf endpoint using the jaxws generic
provider mode (i.e, use PAYLOAD mode with no wsdl nor serviceClass given).
I think this is what you are looking for.
regards, aki




2013/5/9 Smith-John <[hidden email]>

> Hi,
>
> I have no problem with cxf and SOAP in general.
>
> But the consumer I need has to be generic. It should be able to consume all
> incoming SOAP messages however they look like. Therefore I either need a
> "generic" wsdl (if this is possible) or I need a way to realise this
> without
> a wsdl.
>
> I would appreciate if anyone could provide me a Java DSL snippet how to
> create a generic SOAP consumer (with cxf and headers support).
>
> Regards.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/How-to-create-a-generic-SOAP-consumer-tp5731741p5732223.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: How to create a generic SOAP consumer?

Smith-John
Hi,

my route now looks like this:
from("cxf:http://localhost:8050/service?dataFormat=PAYLOAD")...
(PAYLOAD mode without wsdl and serviceClass).

But with this I get a NullPointer exception where I add the route to the CamelContext (camelContext.addRoutes(new GenericSOAPRoute());).

Don't know if it helps, but LOG says:

12:08:27.575  DEBUG  o.a.c.core.osgi.OsgiDefaultCamelContext:1985   Warming up route id: route3 having autoStartup=true
12:08:27.575  TRACE  org.apache.camel.support.ServiceSupport:54     Service already started
12:08:27.575  DEBUG  org.apache.camel.impl.RouteService:129         Starting services on route: route3
12:08:27.591  DEBUG  o.apache.camel.component.cxf.CxfEndpoint:279   Ignore DataFormat mode PAYLOAD since SEI class is annotated with WebServiceProvider
12:08:27.591  DEBUG  o.apache.camel.component.cxf.CxfEndpoint:307   ServerFactoryBean: org.apache.cxf.jaxws.JaxWsServerFactoryBean@1a0283e added properties: {}
12:08:27.607  DEBUG  o.apache.camel.component.cxf.CxfEndpoint:740   Using DefaultBus org.apache.cxf.bus.extension.ExtensionManagerBus@eeabe8
11.05.2013 12:08:27 org.apache.cxf.jaxws.support.JaxWsImplementorInfo getWebServiceProviderAnnotation
WARNUNG: The javax.xml.ws.WebServiceProvider annotation was already loaded by another classloader. Please check if there are multiple versions of the web service annotation jar in your classpath.
12:08:27.622  INFO   o.a.c.core.osgi.OsgiDefaultCamelContext:1590   Apache Camel 2.10.4 (CamelContext: 101-camel-6) is shutting down
12:08:27.622  TRACE  org.apache.camel.util.ServiceHelper:111        Stopping service org.apache.camel.impl.RouteService@16c14c0
12:08:27.622  TRACE  o.a.c.m.DefaultManagementLifecycleStrategy:541 The route is not managed: EventDrivenConsumerRoute[Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD] -> Instrumentation:route[DelegateAsync[UnitOfWork(Channel[sendTo(Endpoint[stream://out])])]]]
12:08:27.622  DEBUG  org.apache.camel.impl.RouteService:197         Stopping services on route: route3
12:08:27.622  TRACE  org.apache.camel.util.ServiceHelper:111        Stopping service EventDrivenConsumerRoute[Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD] -> Instrumentation:route[DelegateAsync[UnitOfWork(Channel[sendTo(Endpoint[stream://out])])]]]
12:08:27.622  TRACE  org.apache.camel.util.ServiceHelper:186        Shutting down service: EventDrivenConsumerRoute[Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD] -> Instrumentation:route[DelegateAsync[UnitOfWork(Channel[sendTo(Endpoint[stream://out])])]]]
12:08:27.622  TRACE  org.apache.camel.support.ServiceSupport:82     Service already stopped
12:08:27.622  TRACE  org.apache.camel.util.ServiceHelper:163        Shutting down service org.apache.camel.impl.RouteService@16c14c0
12:08:27.622  DEBUG  org.apache.camel.impl.RouteService:240         Shutting down services on route: route3
12:08:27.622  TRACE  org.apache.camel.util.ServiceHelper:106        Service already stopped: EventDrivenConsumerRoute[Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD] -> Instrumentation:route[DelegateAsync[UnitOfWork(Channel[sendTo(Endpoint[stream://out])])]]]
12:08:27.622  TRACE  org.apache.camel.util.ServiceHelper:186        Shutting down service: EventDrivenConsumerRoute[Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD] -> Instrumentation:route[DelegateAsync[UnitOfWork(Channel[sendTo(Endpoint[stream://out])])]]]
12:08:27.622  TRACE  org.apache.camel.support.ServiceSupport:149    Service already shut down
12:08:27.622  TRACE  org.apache.camel.util.ServiceHelper:111        Stopping service Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD]
12:08:27.622  TRACE  org.apache.camel.util.ServiceHelper:186        Shutting down service: Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD]
12:08:27.622  TRACE  org.apache.camel.support.ServiceSupport:82     Service already stopped
12:08:27.622  TRACE  o.a.c.m.DefaultManagementLifecycleStrategy:541 The route is not managed: EventDrivenConsumerRoute[Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD] -> Instrumentation:route[DelegateAsync[UnitOfWork(Channel[sendTo(Endpoint[stream://out])])]]]
Reply | Threaded
Open this post in threaded view
|

Re: How to create a generic SOAP consumer?

Smith-John
Will someone please help me?
Reply | Threaded
Open this post in threaded view
|

Re: How to create a generic SOAP consumer?

Willem.Jiang
Administrator
In reply to this post by Smith-John
Hi,

It looks like you are deploying the camel route into OSGi container?
The warning means there are more than on javax.xml.ws.WebServiceProvider classes are loaded by deferent Classloader.
Are you using Karaf or ServiceMix?


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Saturday, May 11, 2013 at 6:21 PM, Smith-John wrote:

> Hi,
>  
> my route now looks like this:
> from("cxf:http://localhost:8050/service?dataFormat=PAYLOAD")...
> (PAYLOAD mode without wsdl and serviceClass).
>  
> But with this I get a NullPointer exception where I add the route to the
> CamelContext (camelContext.addRoutes(new GenericSOAPRoute());).
>  
> Don't know if it helps, but LOG says:
>  
> 12:08:27.575 DEBUG o.a.c.core.osgi.OsgiDefaultCamelContext:1985 Warming
> up route id: route3 having autoStartup=true
> 12:08:27.575 TRACE org.apache.camel.support.ServiceSupport:54 Service
> already started
> 12:08:27.575 DEBUG org.apache.camel.impl.RouteService:129 Starting
> services on route: route3
> 12:08:27.591 DEBUG o.apache.camel.component.cxf.CxfEndpoint:279 Ignore
> DataFormat mode PAYLOAD since SEI class is annotated with WebServiceProvider
> 12:08:27.591 DEBUG o.apache.camel.component.cxf.CxfEndpoint:307  
> ServerFactoryBean: org.apache.cxf.jaxws.JaxWsServerFactoryBean@1a0283e added
> properties: {}
> 12:08:27.607 DEBUG o.apache.camel.component.cxf.CxfEndpoint:740 Using
> DefaultBus org.apache.cxf.bus.extension.ExtensionManagerBus@eeabe8
> 11.05.2013 12:08:27 org.apache.cxf.jaxws.support.JaxWsImplementorInfo
> getWebServiceProviderAnnotation
> WARNUNG: The javax.xml.ws.WebServiceProvider annotation was already loaded
> by another classloader. Please check if there are multiple versions of the
> web service annotation jar in your classpath.
> 12:08:27.622 INFO o.a.c.core.osgi.OsgiDefaultCamelContext:1590 Apache
> Camel 2.10.4 (CamelContext: 101-camel-6) is shutting down
> 12:08:27.622 TRACE org.apache.camel.util.ServiceHelper:111 Stopping
> service org.apache.camel.impl.RouteService@16c14c0
> 12:08:27.622 TRACE o.a.c.m.DefaultManagementLifecycleStrategy:541 The
> route is not managed:
> EventDrivenConsumerRoute[Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD]
> ->
> Instrumentation:route[DelegateAsync[UnitOfWork(Channel[sendTo(Endpoint[stream://out])])]]]
> 12:08:27.622 DEBUG org.apache.camel.impl.RouteService:197 Stopping
> services on route: route3
> 12:08:27.622 TRACE org.apache.camel.util.ServiceHelper:111 Stopping
> service
> EventDrivenConsumerRoute[Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD]
> ->
> Instrumentation:route[DelegateAsync[UnitOfWork(Channel[sendTo(Endpoint[stream://out])])]]]
> 12:08:27.622 TRACE org.apache.camel.util.ServiceHelper:186 Shutting
> down service:
> EventDrivenConsumerRoute[Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD]
> ->
> Instrumentation:route[DelegateAsync[UnitOfWork(Channel[sendTo(Endpoint[stream://out])])]]]
> 12:08:27.622 TRACE org.apache.camel.support.ServiceSupport:82 Service
> already stopped
> 12:08:27.622 TRACE org.apache.camel.util.ServiceHelper:163 Shutting
> down service org.apache.camel.impl.RouteService@16c14c0
> 12:08:27.622 DEBUG org.apache.camel.impl.RouteService:240 Shutting
> down services on route: route3
> 12:08:27.622 TRACE org.apache.camel.util.ServiceHelper:106 Service
> already stopped:
> EventDrivenConsumerRoute[Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD]
> ->
> Instrumentation:route[DelegateAsync[UnitOfWork(Channel[sendTo(Endpoint[stream://out])])]]]
> 12:08:27.622 TRACE org.apache.camel.util.ServiceHelper:186 Shutting
> down service:
> EventDrivenConsumerRoute[Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD]
> ->
> Instrumentation:route[DelegateAsync[UnitOfWork(Channel[sendTo(Endpoint[stream://out])])]]]
> 12:08:27.622 TRACE org.apache.camel.support.ServiceSupport:149 Service
> already shut down
> 12:08:27.622 TRACE org.apache.camel.util.ServiceHelper:111 Stopping
> service Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD]
> 12:08:27.622 TRACE org.apache.camel.util.ServiceHelper:186 Shutting
> down service:
> Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD]
> 12:08:27.622 TRACE org.apache.camel.support.ServiceSupport:82 Service
> already stopped
> 12:08:27.622 TRACE o.a.c.m.DefaultManagementLifecycleStrategy:541 The
> route is not managed:
> EventDrivenConsumerRoute[Endpoint[cxf://http://localhost:8050/service?dataFormat=PAYLOAD]
> ->
> Instrumentation:route[DelegateAsync[UnitOfWork(Channel[sendTo(Endpoint[stream://out])])]]]
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-create-a-generic-SOAP-consumer-tp5731741p5732332.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).



Reply | Threaded
Open this post in threaded view
|

Re: How to create a generic SOAP consumer?

Claus Ibsen-2
In reply to this post by Smith-John
On Tue, May 14, 2013 at 11:35 PM, Smith-John <[hidden email]> wrote:
> Will someone please help me?
>

If you want to get help faster then check the bottom sections of this page
http://camel.apache.org/support


>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-create-a-generic-SOAP-consumer-tp5731741p5732538.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: How to create a generic SOAP consumer?

Smith-John
In reply to this post by Willem.Jiang
Hi,

I'm using Equinox.

Regards.
Reply | Threaded
Open this post in threaded view
|

Re: How to create a generic SOAP consumer?

Smith-John
In reply to this post by Willem.Jiang
Hi,

I'm using Equinox.

I checked all my bundles for exporting javax.xml.ws.
But I only found one: jaxws-api-osgi2.2.8.jar. This was added because cxf-rt-frontend-jaxws-2.7.3.jar needed the javax.xml.ws things.

But I found out that javax.xml.ws is already part of the system library (I'm using jdk 1.6).
Can this trigger the problem? If yes, how can I fix this?
12