[ 
https://issues.apache.org/jira/browse/CXF-7302?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alex Pintilie updated CXF-7302:
-------------------------------
    Description: 
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);
        SOAPBinding soapBinding = SOAPBindingUtil.createSoapBinding(extReg, 
false);
        soapBinding.setStyle(style);
        binding.addExtensibilityElement(soapBinding);
}
{code}

{code:title=org.apache.cxf.wsdl11.SOAPBindingUtil|borderStyle=solid}
// Please call this method in such a way that soap 1.2 detection from wsdl is 
possible
public static SOAPAddress createSoapAddress(ExtensionRegistry extReg, boolean 
isSOAP12) throws WSDLException {
        ExtensibilityElement extElement = null;
        if (isSOAP12) {
                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/"}}.

The wsdl has no services declared such that 
{{definition.getService(serviceName)}} returns {{null}}.

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

  was:
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}
public static SOAPAddress setAddrElement(Definition wsdlDefinition, Port port, 
ExtensionRegistry extReg) throws Exception {
    SOAPAddress address  = SOAPBindingUtil.createSoapAddress(extReg, false); // 
isSOAP12 = false !
    address.setLocationURI("dummy");
    return address;
}
{code}

{code:title=org.apache.cxf.wsdl11.SOAPBindingUtil|borderStyle=solid}
// Please call this method in such a way that soap 1.2 detection from wsdl is 
possible
public static SOAPAddress createSoapAddress(ExtensionRegistry extReg, boolean 
isSOAP12) throws WSDLException {
        ExtensibilityElement extElement = null;
        if (isSOAP12) {
                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/"}}.

The wsdl has no services declared such that 
{{definition.getService(serviceName)}} returns {{null}}.

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


> 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);
>       SOAPBinding soapBinding = SOAPBindingUtil.createSoapBinding(extReg, 
> false);
>       soapBinding.setStyle(style);
>       binding.addExtensibilityElement(soapBinding);
> }
> {code}
> {code:title=org.apache.cxf.wsdl11.SOAPBindingUtil|borderStyle=solid}
> // Please call this method in such a way that soap 1.2 detection from wsdl is 
> possible
> public static SOAPAddress createSoapAddress(ExtensionRegistry extReg, boolean 
> isSOAP12) throws WSDLException {
>       ExtensibilityElement extElement = null;
>       if (isSOAP12) {
>               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/"}}.
> The wsdl has no services declared such that 
> {{definition.getService(serviceName)}} returns {{null}}.
> 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)

Reply via email to