Sachin Singh
Sachin Singh

Reputation: 3

How can I call a soap web service using apache-camel

I have a soap web service running of some server .

<wsdl:operation name="lookup">
<wsdl:input message="tns:LookupRequest" name="LookupRequest"> </wsdl:input>
<wsdl:output message="tns:LookupResponse" name="LookupResponse"> 
</wsdl:output>
</wsdl:operation>

It has lookup as a web service and this web service takes LookupRequest object as an input.

So my question is how can I call this lookup web service using apache camel and how can i give input to this web service i.e: lookup object.

And also how can i figure our wheather its a jax-ws because i only have the wsdl file and I want to create client for that web service using apache- camel.

LookupRequest Class looks like this:-

public class LookupRequest {

        @XmlElement(name = "EntityReference")
        protected List<EntityReference> references;
        @XmlElement(name = "AttachmentReference")
        protected List<AttachmentLookupReference> attachmentReferences;
        @XmlAttribute(name = "countryCode")
        protected String countryCode;
        @XmlAttribute(name = "languageCode")
        protected String languageCode;
}

Do i need to create lookupRequest object and send it to the server or I can send String as well?

Upvotes: 0

Views: 8061

Answers (2)

anpt
anpt

Reputation: 90

You can try to send xml request:

First set the two headers .setheader("operationNamespace",the namespace that tns is alias for) .setheader("operationName","lookup")

and then use the cfx component "cxf:{{url}}?wsdlURL=someWsdlInclasspath.wsdl&dataFormat=payload"

then you can send the request as xml (in body)

Upvotes: 0

Willem Jiang
Willem Jiang

Reputation: 3291

First you need to generate the client from WSDL with the help of CXF wsdl2java. Then you can leverage the camel-cxf component to send the request to service that you want to invoke server, here is an example that you may take a look.

Upvotes: 1

Related Questions