Koen Serneels created CXF-7538:
----------------------------------

             Summary: SOAP header silently removed in case of missing 
configuration parameters
                 Key: CXF-7538
                 URL: https://issues.apache.org/jira/browse/CXF-7538
             Project: CXF
          Issue Type: Bug
          Components: Core
    Affects Versions: 3.1.9
            Reporter: Koen Serneels


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

{code:xml}
        <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>
{code}

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):

{code:xml}
 <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>
{code}

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;

{code:xml}
  serviceName="wsdltns:someService"
  endpointName="wsdltns:someEndpoint"
{code}

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.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to