Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-7302

Soap binding detection from wsdl hardcoded to soap 1.1

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Not A Problem
    • 3.1.10
    • Invalid
    • None
    • None
    • Windows 7 Pro SP1, JDK 1.8.1_u111

    • Unknown

    Description

      Hello,

      I debugged how CXF detects the soap version from the wsdl file and found a hardcoded call (there no other calls)

      org.apache.cxf.wsdl11.PartialWSDLProcessor
      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);
      }
      
      org.apache.cxf.wsdl11.SOAPBindingUtil
      // 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);
      }
      

      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.

      MyProxyFactory.java
              
      // setting the soap12 binding has no effect
      jaxWsProxyFactoryBean.setBindingId(SOAPBinding.SOAP12HTTP_BINDING);
      
      jaxWsProxyFactoryBean.setServiceClass(serviceInterface);
      jaxWsProxyFactoryBean.setAddress(serviceUrl);
      jaxWsProxyFactoryBean.setWsdlLocation(wsdlUrl);
      return jaxWsProxyFactoryBean.create();
      

      Please correct me if I'm wrong.

      Regards,
      Alex

      Attachments

        Activity

          People

            dkulp Daniel Kulp
            pintiliea Alex Pintilie
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: