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