Six Stars

cCXF component with payload mode

Is there an example that shows how to make a SOAP call in a Route with cCXF component with PAYLOAD mode selected?

2 ACCEPTED SOLUTIONS

Accepted Solutions
Six Stars

Re: cCXF component with payload mode

this is what I told you :be careful with your namespaces.
Try to remove them from your body stuff
Eight Stars

Re: cCXF component with payload mode

Hi,

 

I did a test with:

<?xml version="1.0" ?>
<tns:upload xmlns:tns="http://upload.service.ws.findxnet.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<arg0>
<aaLookupName>A</aaLookupName>
<aaLookupValue>A</aaLookupValue>
<document>
<content>A</content>
<name>A</name>
</document>
<documentType/>
<formatType/>
<userAccount xsi:type="tns:userAccountVO"/>
</arg0>
</tns:upload>

 

It looks fine. I get this reply:

<ns2:uploadResponse xmlns:ns2="http://upload.service.ws.findxnet.com/" xmlnsSmiley Frustrated="http://schemas.xmlsoap.org/soap/envelope/"><return><code>-2</code><details>User is not authorized to perform this operation. Check if documentType, formatType or probably lookup are incorrect. A:A</details></return></ns2:uploadResponse>

 

Eric

15 REPLIES
Six Stars

Re: cCXF component with payload mode

The only requirement is to have some text in your message body that fits the WSDL for your service/operation.

 

What is your issue ?

Six Stars

Re: cCXF component with payload mode

So I need to provide in the body to the cCXF component the body of the SOAP envelope?

 

Where do I put all the elements that are in my SOAP body element

<S:Body xmlns:ns2=...>

...

</S:Body>

Six Stars

Re: cCXF component with payload mode

Yes, only the body, as your component will auto create the soap enveloppe by itself.
Six Stars

Re: cCXF component with payload mode

When I select RAW in the component and send entire SOAP to the component I get back 0 from the service.

When I tried with only SOAP body and select PAYLOAD mode I get an error.

 

How do I add all the XML elements from the SOAP?

Six Stars

Re: cCXF component with payload mode

You will have to be more precise if you want some help : what error do you get ?

I confirm sending the soap body in exchange body and letting the cxf component do the rest works fine.

Six Stars

Re: cCXF component with payload mode

this is what I send to the exchange body:

  <S:Body xmlns:ns2="....">
    <ns2:upload>
      <arg0>
        <credentials>
          <password>...</password>
          <username>...</username>
        </credentials>
        <document>
          <content>j</content>
          <name>1.xml</name>
        </document>
        <documentType>12</documentType>
        <formatType>19</formatType>
      </arg0>
    </ns2:upload>
  </S:Body>

and the error I get

com.ctc.wstx.exc.WstxParsingException: Undeclared namespace prefix "S"
 at [row,col {unknown-source}]: [1,61]
	at com.ctc.wstx.sr.StreamScanner.constructWfcException(StreamScanner.java:614)
...

the route for testing

Untitled.png

Six Stars

Re: cCXF component with payload mode

remove de s:body tags

and be careful with namespaces, that have to suit exactly your WSDL
Six Stars

Re: cCXF component with payload mode

After I remove starting and closing Body tag I get

[WARN ]: org.apache.camel.component.cxf.CxfEndpoint - Error finding the start element.
com.ctc.wstx.exc.WstxParsingException: Undeclared namespace prefix "ns2"
at [row,col {unknown-source}]: [1,16]
at com.ctc.wstx.sr.StreamScanner.constructWfcException(StreamScanner.java:614)
at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:487)
Six Stars

Re: cCXF component with payload mode

this is what I told you :be careful with your namespaces.
Try to remove them from your body stuff
Six Stars

Re: cCXF component with payload mode

I accidently clikced accept as a solution.

 

My exchange body now looks like this

    <upload>
      <arg0>
        <credentials>
          <password>...</password>
          <username>...</username>
        </credentials>
        <document>
          <content>j</content>
          <name>1.xml</name>
        </document>
        <documentType>12</documentType>
        <formatType>19</formatType>
      </arg0>
    </upload>

And now I get this error:

org.apache.cxf.binding.soap.SoapFault: Cannot find dispatch method for {}upload
	at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:86)
	at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:52)
	at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.handleMessage(Soap11FaultInInterceptor.java:41)
Six Stars

Re: cCXF component with payload mode

again, if you want help, give people as many data as you can. We still haven't see your WSDL.

Just be sure your CXF is correctly parameterized with the url, the wdsl, the button to choose en operation and to automatically parameter the other cxf parameters.

 

There are many samples on internet for using Talend cxf

Six Stars

Re: cCXF component with payload mode

Why do you need to see the WSDL?

When I put SOAP bellow into the exchange body and switch the component to RAW, I get ok response from the service:

 <S:Body xmlns:ns2="....">
    <ns2:upload>
      <arg0>
        <credentials>
          <password>...</password>
          <username>...</username>
        </credentials>
        <document>
          <content>j</content>
          <name>1.xml</name>
        </document>
        <documentType>12</documentType>
        <formatType>19</formatType>
      </arg0>
    </ns2:upload>
  </S:Body>
Six Stars

Re: cCXF component with payload mode

Eight Stars

Re: cCXF component with payload mode

Hi,

 

I did a test with:

<?xml version="1.0" ?>
<tns:upload xmlns:tns="http://upload.service.ws.findxnet.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<arg0>
<aaLookupName>A</aaLookupName>
<aaLookupValue>A</aaLookupValue>
<document>
<content>A</content>
<name>A</name>
</document>
<documentType/>
<formatType/>
<userAccount xsi:type="tns:userAccountVO"/>
</arg0>
</tns:upload>

 

It looks fine. I get this reply:

<ns2:uploadResponse xmlns:ns2="http://upload.service.ws.findxnet.com/" xmlnsSmiley Frustrated="http://schemas.xmlsoap.org/soap/envelope/"><return><code>-2</code><details>User is not authorized to perform this operation. Check if documentType, formatType or probably lookup are incorrect. A:A</details></return></ns2:uploadResponse>

 

Eric

Six Stars

Re: cCXF component with payload mode

This setup worked for me:

 

    <ns2:upload xmlns:ns2="http://upload.service.ws.findxnet.com/">
      <arg0>
        <credentials>
          <password>...</password>
          <username>...</username>
        </credentials>
        <document>
          <content>j</content>
          <name>1.xml</name>
        </document>
        <documentType>12</documentType>
        <formatType>19</formatType>
      </arg0>
    </ns2:upload>