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

SOAP header silently removed in case of missing configuration parameters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.1.9
    • None
    • Core
    • None
    • Unknown

    Description

      Hi. We are using CXF as our JAXWS impl i.c.w. Spring. The configuration of a ws client looks like this:

      	<jaxws:client id="webservices.xyz"
      				  serviceClass="someclass"
      				  address="#{@'someurl'}"
      				  wsdlLocation="classpath:/somewsdl.wsdl">
      
      		<jaxws:dataBinding>
      			<bean class="org.apache.cxf.jaxb.JAXBDataBinding"/>
      		</jaxws:dataBinding>
      
      		<jaxws:properties>
      			<entry key="schema-validation-enabled" value="true"/>
      			<entry key="thread.local.request.context" value="true"/>
      		</jaxws:properties>
      
      		<jaxws:inInterceptors>
      			<ref bean="requestResponseInterceptorIn"/>
      		</jaxws:inInterceptors>
      
      		<jaxws:outInterceptors>
      			<ref bean="requestResponseInterceptorOut"/>
      		</jaxws:outInterceptors>
      	</jaxws:client>
      

      We've learned that the wsdlLocation attribute is rather vital for full schema validation. Makes sense, as it needs access to the actual schema's for this. However, we also saw that when setting the wsdlLocation attribute, the stack suddenly drops soap headers. The header in question is defined in the WSDL like this (all pretty standard):

       <operation name="someOperation">
            <SOAP11:operation/>
            <input>
              <SOAP11:body use="literal"/>
              <SOAP11:header message="wsdltns:requestHeader" part="somePart" use="literal"/>
            </input>
            <output>
              <SOAP11:body use="literal"/>
            </output>
            <fault name="someException">
              <SOAP11:fault name="someException" use="literal"/>
            </fault>
          </operation>
      

      Even though the header is passed along in the method call on the client stub, the header is no longer present in the SOAP message when the wsdlLocation attribute is set. There is no error, no nothing. Then we learned that if we add following attributes to the the jaxws:client element, the header is sent along just fine;

        serviceName="wsdltns:someService"
        endpointName="wsdltns:someEndpoint"
      

      So to summarize: the serviceName and endpointName seem optional as the client stub just works without them, even when the wsdlLocation is specified. However, in the latter case, the SOAP headers seem to be silently dropped. Because of this we now have all kinds of unit tests to verify that the client stubs are still 'configured correctly', to avoid the silent loss of SOAP headers if someone would accidentally remove any of these seemingly optional attributes. Dropping headers silently without any error seems a bug to me.

      Attachments

        Activity

          People

            Unassigned Unassigned
            Koen Serneels Koen Serneels
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: