Hi,

You can try to use the soap dataformat[1] which is new to Camel 2.3.0.
And you need to download the Camel 2.3.0-SNAPSHOT for it.       

[1]http://camel.apache.org/soap.html

Willem

Harbeer Kadian wrote:
Hi,
thanks for the reply.
I did not changed the input soap message into Document and directly sent it.
I got the soap message reply in the form of String.
The reply is as follows
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";><soapenv:Body><sayHelloResponse
xmlns="http://tutorial.com";><sayHelloReturn>Hello Harbeer
Kadian</sayHelloReturn></sayHelloResponse></soapenv:Body></soapenv:Envelope>

Now i want to read this output and change it into java objects, just like
what a webservice client do.
Do there are any standard api to do this.
Or I have to use some sort of XQuery or XSLT Transformer to get the soap
body.

With Regards
Harbeer Kadian



willem.jiang wrote:
Yes, if you want to send a request from camel-http endpoint, you just need put the a Sting, InputStream or HttpEntity into to the message body, otherwise camel-http endponit may not send right request to the service.

Willem

ychawla wrote:
Hi Habeer,
Do you need to do the DOM conversions that you are doing:

Document input = xmlConverter.toDOMDocument(soapMessage);
exchange.getIn().setBody(input);

Can't you just set the body to be a string?

Same with the return message. That might be tripping something up. Also,
are you able to get to your webservice using a browser/basic auth:

http://localhost:8095/WebServiceTutorial/services/Hello?username=admin&password=admin

When I was first setting up a web service connection through HTTP, I set
up
a polling folder and result folder and got that working first.  I just
made
the entire soap message in a text editor which it looks like you already
have.  Then you can set up a simple route to test for web service
connectivity:

<from uri="file:/tmp/input"/>
<to
uri="http://localhost:8095/WebServiceTutorial/services/Hello?username=admin&password=admin";
/>
<to uri="file:/tmp/output"/>

Cheers,
Yogesh


Harbeer Kadian wrote:
Hi,

I deployed a simple webservice on TomCat Server.
I created following route to access the webservice using apache camel.

from("direct:ProducerUri")
.to("http://localhost:8095/WebServiceTutorial/services/Hello?username=admin&password=admin";);

I created the exchange in the following way
String soapMessage = "<soapenv:Envelope
xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\";
xmlns:tut=\"http://tutorial.com\";><soapenv:Header/><soapenv:Body><tut:sayHello><tut:name>"
                + "Harbeer Kadian" +
"</tut:name></tut:sayHello></soapenv:Body></soapenv:Envelope>";
            XmlConverter xmlConverter = new XmlConverter();
Document input = xmlConverter.toDOMDocument(soapMessage);
exchange.getIn().setBody(input);
exchange.setPattern(ExchangePattern.InOut);
//added this line after seeing no soapAction found error on Tom Cat
Server
log
exchange.getIn().setHeader("SOAPAction", "");
exchange = producerTemplate.send("direct:ProducerUri", exchange);
Document output = (Document)exchange.getOut().getBody();
System.out.println(output);

I am getting null as output.
Also on the tom cat server log, no exception is coming.

I have no idea how to invoke webservice using http component.
Please help me.

With Regards
Harbeer Kadian






Reply via email to