Aache-CXF WS client with eclipse MOXY JAXBContextFactory doesn't send security header

21 views Asked by At

I use Apache-CXF WS for SOAP client. Side SOAP endpoint has security (username/password) requirement. Also I use org.eclipse.persistence.eclipselink for changing an JAXBContextFactory, because default factory generates redundant namespaces in request.

With default JAXB client sends username token in header:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  
  <soap:Header>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soap:mustUnderstand="1">
      <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-5ec36563-1289-4272-a820-2df93385246a">
        <wsse:Username>username</wsse:Username>
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password>
      </wsse:UsernameToken>
    </wsse:Security>
  </soap:Header>

  <soap:Body>
   ...
  </soap:Body>
</soap:Envelope>

But with MOXY JAXBContextFactory client doesn't send security header:

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

  >> NO HEADER <<

  <soap:Body>
    ...
  </soap:Body>
</soap:Envelope>

I tried to find some info in documentation, but no success.

My CXF SOAP client configuration:

<jaxws:client id="side_service_client"
        wsdlLocation="side_service.wsdl"
        serviceClass="com.example.SideService"
        address="${side_service_url}"
        xmlns:bfns="http://www.example.com/side_service/"
        serviceName="bfns:side_service">

        <jaxws:properties>
            <entry key="security.username" value="${sideServiceUsername}"/>
            <entry key="security.password" value="${sideServicePassword}"/>
            <entry key="schema-validation-enabled" value="false"/>
        </jaxws:properties>
</jaxws:client>

Apache CXF version - 3.4.10 org.eclipse.persistence.eclipselink version - 2.6.9

Maybe someone has already encountered such a problem and knows the direction of the solution?

Thankls for any answers =)

0

There are 0 answers