SOAP 1.2 for CXF Consumer on Glassfish 3

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

SOAP 1.2 for CXF Consumer on Glassfish 3

peter.berkman
PDQSupplier.wsdl

I have the following "endpoint":

        <cxf:cxfEndpoint id="pdSupplierEndpoint"
                                                address="http://0.0.0.0:9002/services/PDQSupplier"
      serviceClass="ihe.iti.pdqv3._2007.PDQSupplierPortType">
        </cxf:cxfEndpoint>

with the attached WSDL that I use CXF's wsdl2java on.

All of this is contained and deployed in a war file.  I can't get it to accept SOAP 1.2 messages even though the WSDL defines them as such.   HELP?  What am I doing wrong or missing here?

Here is the exception:

[#|2012-10-18T15:30:46.860-0700|WARNING|glassfish3.1.2|org.apache.cxf.phase.PhaseInterceptorChain|_ThreadID=40;_ThreadName=qtp4388066-328;|Interceptor for {urn:ihe:iti:pdqv3:_2007}PDQSupplierPortTypeService has thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: A SOAP 1.2 message is not valid when sent to a SOAP 1.1 only endpoint.
        at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:145)
        at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:61)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
        at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:354)
        at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:318)
        at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1074)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1010)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
        at org.eclipse.jetty.server.Server.handle(Server.java:365)
        at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
        at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:937)
        at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:998)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
        at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:627)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:51)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
        at java.lang.Thread.run(Thread.java:662)
|#]
Reply | Threaded
Open this post in threaded view
|

Re: SOAP 1.2 for CXF Consumer on Glassfish 3

Willem.Jiang
Administrator
It looks like you need to specify the wsdlURL to let CXF pick up the WSDL for you

 or
 you can specify the bindingType in the class of ihe.iti.pdqv3._2007.PDQSupplierPortType
@BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)



or  you can configure the cxfEndpoint like this
(The namespace of soap is xmlns:soap="http://cxf.apache.org/bindings/soap")
> <cxf:cxfEndpoint id="pdSupplierEndpoint"
> address="http://0.0.0.0:9002/services/PDQSupplier"
> serviceClass="ihe.iti.pdqv3._2007.PDQSupplierPortType">

<cxf:binding>
    <soap:soapBinding mtomEnabled="true" version="1.2"/>
 </cxf:binding>
> </cxf:cxfEndpoint>




--
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.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: willemjiang





On Friday, October 19, 2012 at 6:44 AM, pberkman wrote:

> PDQSupplier.wsdl
> <http://camel.465427.n5.nabble.com/file/n5721268/PDQSupplier.wsdl>
>
> I have the following "endpoint":
>
> <cxf:cxfEndpoint id="pdSupplierEndpoint"
> address="http://0.0.0.0:9002/services/PDQSupplier"
> serviceClass="ihe.iti.pdqv3._2007.PDQSupplierPortType">
> </cxf:cxfEndpoint>
>
> with the attached WSDL that I use CXF's wsdl2java on.
>
> All of this is contained and deployed in a war file. I can't get it to
> accept SOAP 1.2 messages even though the WSDL defines them as such. HELP?
> What am I doing wrong or missing here?
>
> Here is the exception:
>
> [#|2012-10-18T15:30:46.860-0700|WARNING|glassfish3.1.2|org.apache.cxf.phase.PhaseInterceptorChain|_ThreadID=40;_ThreadName=qtp4388066-328;|Interceptor
> for {urn:ihe:iti:pdqv3:_2007}PDQSupplierPortTypeService has thrown
> exception, unwinding now
> org.apache.cxf.binding.soap.SoapFault: A SOAP 1.2 message is not valid when
> sent to a SOAP 1.1 only endpoint.
> at
> org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:145)
> at
> org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:61)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
> at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
> at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:354)
> at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:318)
> at
> org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:72)
> at
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1074)
> at
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1010)
> at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
> at
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
> at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
> at org.eclipse.jetty.server.Server.handle(Server.java:365)
> at
> org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
> at
> org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:937)
> at
> org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:998)
> at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)
> at
> org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
> at
> org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
> at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:627)
> at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:51)
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
> at
> org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
> at java.lang.Thread.run(Thread.java:662)
> |#]
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/SOAP-1-2-for-CXF-Consumer-on-Glassfish-3-tp5721268.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).



Reply | Threaded
Open this post in threaded view
|

Re: SOAP 1.2 for CXF Consumer on Glassfish 3

peter.berkman
Willem,
thank you, thank you, thank you!!!  I've been struggling with this for days!

the last option did the trick.  

The first one, declaring the WSDL in the cxf endpoint always threw an exception that it could not find the PDQSupplierPortTypeService.  I didn't try the second one because the desire is to use wsdl2java to generate the service and port.  So, went on to your third suggestion and it seems to have resolved the problem.  

again, thank you VERY MUCH!!!

I added the xmlns:soap="http://cxf.apache.org/bindings/soap" to the beans declaration and changed the cxf endpoint to look like this:

<cxf:cxfEndpoint id="pdSupplierEndpoint"
                address="http://0.0.0.0:9002/services/PDQSupplier"
      serviceClass="ihe.iti.pdqv3._2007.PDQSupplierPortType">
     <cxf:binding> 
          <soap:soapBinding mtomEnabled="true" version="1.2"/> 
     </cxf:binding> 
</cxf:cxfEndpoint>
         
Reply | Threaded
Open this post in threaded view
|

Re: SOAP 1.2 for CXF Consumer on Glassfish 3

Willem.Jiang
Administrator
Please see my comments in the line.

--
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.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: willemjiang





On Friday, October 19, 2012 at 10:29 PM, pberkman wrote:

> Willem,
> thank you, thank you, thank you!!! I've been struggling with this for days!

Not at all :)
>
> the last option did the trick.
>
> The first one, declaring the WSDL in the cxf endpoint always threw an
> exception that it could not find the PDQSupplierPortTypeService. I didn't
> try the second one because the desire is to use wsdl2java to generate the
> service and port. So, went on to your third suggestion and it seems to have
> resolved the problem.

There are some gap between the Java class and WSDL , JAXWS introduces some annotation to fill it.
If you don't use them, CXF will do some assumption which could be wrong in this case.
You can change your WSDL or just specify the serviceName and portName on the cxfEndpont to let it pick up right service name for you.
>
>
> again, thank you VERY MUCH!!!

It's good to see it works for you.

>
> I added the xmlns:soap="http://cxf.apache.org/bindings/soap" to the beans
> declaration and changed the cxf endpoint to look like this:
>
> <cxf:cxfEndpoint id="pdSupplierEndpoint"
> address="http://0.0.0.0:9002/services/PDQSupplier"
> serviceClass="ihe.iti.pdqv3._2007.PDQSupplierPortType">
> <cxf:binding>
> <soap:soapBinding mtomEnabled="true" version="1.2"/>
> </cxf:binding>
> </cxf:cxfEndpoint>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/SOAP-1-2-for-CXF-Consumer-on-Glassfish-3-tp5721268p5721310.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).