cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Pintilie (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-7302) Soap binding detection from wsdl hardcoded to soap 1.1
Date Thu, 30 Mar 2017 07:31:41 GMT

    [ https://issues.apache.org/jira/browse/CXF-7302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15948567#comment-15948567
] 

Alex Pintilie commented on CXF-7302:
------------------------------------

Hi Daniel,

this is what I send to the server. As you can see, the jax-ws proxy factory creates a soap
1.1 endpoint for me:

{code:xml|title=out.xml}
ID: 1
Address: https://ex.server-host:8441/SomeBusinessService
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml
Headers: {Accept=[*/*], Connection=[Keep-Alive], SOAPAction=[""]}

Payload: 
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

    <soap:Header>

        <Action xmlns="http://www.w3.org/2005/08/addressing">http://ex.some.business/SomeBusinessService/ServicePort/SomeBusinessRequest</Action>

        <MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:uuid:d37384a8-5513-4769-aef6-a4e5a644f44c</MessageID>

        <To xmlns="http://www.w3.org/2005/08/addressing">Some-To-Adress</To>

        <ReplyTo xmlns="http://www.w3.org/2005/08/addressing">

            <Address>http://www.w3.org/2005/08/addressing/anonymous</Address>

        </ReplyTo>

    </soap:Header>

    <soap:Body>

        <ns2:SomeBusinessRequest
            xmlns="http://ex.some.business/SomeBusinessSchema"
            xmlns:ns2="http://ex.some.business/AnotherBusinessSchema"
            xmlns:ns3="http://ex.some.business/YetAnotherSchema" />

    </soap:Body>

</soap:Envelope>
{code}

And this is what the server responds. This response is from a soap 1.2 endpoint. Please ignore
the xsd schema validation error, this is because I sent an empty request tag in.

{code:xml|title=in.xml}
ID: 1
Response-Code: 500
Encoding: UTF-8
Content-Type: text/xml; charset="UTF-8"
Headers: {Accept=[*/*], Cache-Control=[no-cache], connection=[close], content-type=[text/xml;
charset="UTF-8"], Date=[Thu, 30 Mar 2017 06:29:48 GMT], Host=[ex.server-host:8441], Pragma=[no-cache],
Server=[], SOAPAction=[""], User-Agent=[Apache-CXF/3.1.10], X-CorrelationID=[Id-58dca5dc00047e100000474016d432f0
0]}

Payload: 
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">

    <soap:Header xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://www.w3.org/2005/08/addressing">

        <wsa:Action>http://www.w3.org/2005/08/addressing/fault</wsa:Action>

        <wsa:MessageID>116ef24f-529c-41f3-ab88-1226830b1413</wsa:MessageID>

        <wsa:To>http://www.w3.org/2005/08/addressing/anonymous</wsa:To>

        <wsa:RelatesTo>http://www.w3.org/2005/08/addressing/unspecified</wsa:RelatesTo>

    </soap:Header>

    <soap:Body>

        <soap:Fault>

            <soap:Code>

                <soap:Value>soap:Receiver</soap:Value>

            </soap:Code>

            <soap:Reason>

                <soap:Text xml:lang="en">Error</soap:Text>

            </soap:Reason>

            <soap:Node>Validation</soap:Node>

            <soap:Detail xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">

                <sch:Fault xmlns:sch="http://ex.some.business/SomeBusinessSchema">

                    <sch:StatusCode>SOME_VALIDATION_CODE</sch:StatusCode>

                    <sch:FaultMessage>The message could not be validated against the
XSD schema.</sch:FaultMessage>

                </sch:Fault>

            </soap:Detail>

        </soap:Fault>

    </soap:Body>

</soap:Envelope>
{code}

After the response, CXF tells me that I received a soap 1.2 message in a soap 1.1 endpoint.

{code}
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:179)
~[cxf-rt-bindings-soap-3.1.10.jar:3.1.10]
	at org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:69)
~[cxf-rt-bindings-soap-3.1.10.jar:3.1.10]
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
[cxf-core-3.1.10.jar:3.1.10]
	at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:801) [cxf-core-3.1.10.jar:3.1.10]
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1680)
[cxf-rt-transports-http-3.1.10.jar:3.1.10]
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1559)
[cxf-rt-transports-http-3.1.10.jar:3.1.10]
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1356)
[cxf-rt-transports-http-3.1.10.jar:3.1.10]
	at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:56)
[cxf-core-3.1.10.jar:3.1.10]
	at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:216) [cxf-core-3.1.10.jar:3.1.10]
	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) [cxf-core-3.1.10.jar:3.1.10]
	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:653) [cxf-rt-transports-http-3.1.10.jar:3.1.10]
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
[cxf-core-3.1.10.jar:3.1.10]
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
[cxf-core-3.1.10.jar:3.1.10]
	at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514) [cxf-core-3.1.10.jar:3.1.10]
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423) [cxf-core-3.1.10.jar:3.1.10]
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324) [cxf-core-3.1.10.jar:3.1.10]
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277) [cxf-core-3.1.10.jar:3.1.10]
	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96) [cxf-rt-frontend-simple-3.1.10.jar:3.1.10]
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139) [cxf-rt-frontend-jaxws-3.1.10.jar:3.1.10]
	at com.sun.proxy.$Proxy63.submitCustomsDecisionApplication(Unknown Source) [na:na]
	at my.package.MyJaxWsClientTest.testMyTestMethod(MyJaxWsClientTest.java:99) [test-classes/:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:na]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:na]
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) [junit-4.12.jar:4.12]
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12]
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) [junit-4.12.jar:4.12]
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) [junit-4.12.jar:4.12]
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) [junit-4.12.jar:4.12]
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) [junit-4.12.jar:4.12]
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) [junit-4.12.jar:4.12]
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
[.cp/:na]
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:na]
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
[.cp/:na]
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
[.cp/:na]
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
[.cp/:na]
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
[.cp/:na]
{code}

At the moment I'm not ready to post the wsdls, but there are three files: 
 # for the {{wsdl:portType}} declaration
 # for the security policy
 # imports _1_ and _2_ and declares a {{wsdl:binding}} with {{<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />}} and {{wsdl:service}} declaration
containing the port in _wsdl1_. The soap prefix is {{xmlns:soap = "http://schemas.xmlsoap.org/wsdl/soap12/"}}.

 
I'm aware this is very complex. I thought it could be some obvious mistake which I'm not seeing.


Thanks and regards,
Alex

> Soap binding detection from wsdl hardcoded to soap 1.1
> ------------------------------------------------------
>
>                 Key: CXF-7302
>                 URL: https://issues.apache.org/jira/browse/CXF-7302
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 3.1.10
>         Environment: Windows 7 Pro SP1, JDK 1.8.1_u111
>            Reporter: Alex Pintilie
>            Priority: Blocker
>
> Hello,
> I debugged how CXF detects the soap version from the wsdl file and found a *hardcoded*
call (there no other calls) :(
> {code:title=org.apache.cxf.wsdl11.PartialWSDLProcessor|borderStyle=solid}
> private static void setSoapBindingExtElement(Definition wsdlDefinition, Binding binding,
ExtensionRegistry extReg) throws Exception {
>     SOAPBindingUtil.addSOAPNamespace(wsdlDefinition, false); // isSOAP12 = false
>     SOAPBinding soapBinding = SOAPBindingUtil.createSoapBinding(extReg, false); // isSOAP12
= false
>     soapBinding.setStyle(style);
>     binding.addExtensibilityElement(soapBinding);
> }
> {code}
> {code:title=org.apache.cxf.wsdl11.SOAPBindingUtil|borderStyle=solid}
> // Please call these methods in such a way that soap 1.2 detection from wsdl is possible
> public static SOAPBinding createSoapBinding(ExtensionRegistry extReg, boolean isSOAP12)
throws WSDLException {
>     ExtensibilityElement extElement = null;
>     if (isSOAP12) { // always false here
>         extElement = extReg.createExtension(Binding.class, 
> 		        new QName(WSDLConstants.NS_SOAP12, "binding"));
>         ((SOAP12Binding)extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
>     } else {
>         extElement = extReg.createExtension(Binding.class, 
> 		        new QName(WSDLConstants.NS_SOAP11, "binding"));
>         ((SOAPBinding)extElement).setTransportURI(WSDLConstants.NS_SOAP_HTTP_TRANSPORT);
>     }
>     return getSoapBinding(extElement);
> }
> public static SOAPAddress createSoapAddress(ExtensionRegistry extReg, boolean isSOAP12)
throws WSDLException {
>  ExtensibilityElement extElement = null;
>  if (isSOAP12) { // always false here
>   extElement = extReg.createExtension(Port.class, 
>     WSDLConstants.QNAME_SOAP12_BINDING_ADDRESS);
>  } else {
>   extElement = extReg.createExtension(Port.class,
>     WSDLConstants.QNAME_SOAP_BINDING_ADDRESS);
>  }
>  return getSoapAddress(extElement);
> }
> {code}
> The wsdl file has Soap 1.2 declared:
> {{xmlns:soap = "http://schemas.xmlsoap.org/wsdl/soap12/"}}.
> I call the server and get a response back followed by this exception:
> {{org.apache.cxf.binding.soap.SoapFault: A SOAP 1.2 message is not valid when sent to
a SOAP 1.1 only endpoint.}}
> {code:title=MyProxyFactory.java|borderStyle=solid}        
> // setting the soap12 binding has no effect
> jaxWsProxyFactoryBean.setBindingId(SOAPBinding.SOAP12HTTP_BINDING);
> jaxWsProxyFactoryBean.setServiceClass(serviceInterface);
> jaxWsProxyFactoryBean.setAddress(serviceUrl);
> jaxWsProxyFactoryBean.setWsdlLocation(wsdlUrl);
> return jaxWsProxyFactoryBean.create();
> {code}
> Please correct me if I'm wrong.
> Regards,
> Alex



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message