0

How can I add default WS-addressing to the xml?

    <cxf:cxfEndpoint id="endpoint" xmlns:s="http://tempuri.org/"
      address="https://uslugaterytws1test.stat.gov.pl/TerytWs1.svc" 
      endpointName="s:custom" 
      serviceName="s:TerytWs1" 
      wsdlURL="classpath:/wsdl/terytws1.wsdl">
    <cxf:properties>
      <entry key="schema-validation-enabled" value="false" />
    </cxf:properties>
    <cxf:inInterceptors>
    </cxf:inInterceptors>
    <cxf:inFaultInterceptors>
    </cxf:inFaultInterceptors>
    <cxf:outInterceptors>
    </cxf:outInterceptors>
    <cxf:outFaultInterceptors>
    </cxf:outFaultInterceptors>
  </cxf:cxfEndpoint>


  <cxf:cxfEndpoint id="poxyEndpoint" xmlns:s="http://tempuri.org/"
      address="http:localhost:5678/myproxy" 
      endpointName="s:customProxy" 
      serviceName="s:TerytWs1Proxy" 
      wsdlURL="classpath:/wsdl/terytws1Proxy.wsdl">
    <cxf:properties>
      <entry key="schema-validation-enabled" value="false" />
    </cxf:properties>
    <cxf:inInterceptors>
    </cxf:inInterceptors>
    <cxf:inFaultInterceptors>
    </cxf:inFaultInterceptors>
    <cxf:outInterceptors>
      <ref component-id="wssOutInterceptor" />
    </cxf:outInterceptors>
    <cxf:outFaultInterceptors>
      <ref component-id="wssOutInterceptor" />
    </cxf:outFaultInterceptors>
  </cxf:cxfEndpoint>



  <camelContext id="proxyTerytContext" xmlns="http://camel.apache.org/schema/blueprint">
  <route id="route-TerytWs1">
      <from id="inbound" uri="cxf:bean:proxyEndpoint?dataFormat=CXF_MESSAGE" />
      <to id="outbound" uri="cxf:bean:endpoint?dataFormat=CXF_MESSAGE" />
    </route>
  </camelContext>

When I send request to http:localhost:5678/myproxy then I get:

<faultcode xmlns:a="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">a:InvalidSecurity</faultcode>
<faultstring xml:lang="en-US">An error occurred when verifying security for the message.</faultstring>

I have read many similar questions and examples but haven't found the solution for pure cxf xml. I have been trying to solve this for 2 days. Now I'm crying.


EDIT: This is an original wsdl: https://uslugaterytws1test.stat.gov.pl/terytws1.svc?wsdl
and this is my proxy to it: https://github.com/woblak/training/blob/master/teryt_testProxy.wsdl
user: TestPubliczny
pass: 1234abcd

1 Answers1

0

There are some examples in the Camel unit tests which test CXF endpoints with WS-Addressing enabled; WSAddressingTest-context.xml seems like it might be relevant to your question?

Here, WS-Addressing has been enabled on a CXF endpoint by adding the wsa:addressing element in features:

<cxf:cxfEndpoint...>
    <cxf:features>
        <wsa:addressing xmlns:wsa="http://cxf.apache.org/ws/addressing" />
    </cxf:features>
</cxf:cxfEndpoint>

The error seems to be related to security. You have an interceptor configured (wssOutInterceptor) but there's no source code. Perhaps you should look there to see if you're setting the auth details.

I would also add message logging so you can see the content of the payload sent to the target and verify that it contains your credentials.

Or, if you're using the Camel CXF namespace ( xmlns:cxf="http://camel.apache.org/schema/cxf") you can use:

<cxf:cxfEndpoint ... loggingFeatureEnabled="true">
  ...
</cxf:cxfEndpoint>
Tom Donohue
  • 363
  • 2
  • 8