I have 3 party webservice which I want to call and put xml into it. I have using apache camel.
<parameter>
<name>LastModified</name>
<value>2015-11-24 11:15:38.0</value>
</parameter>
<parameter>
<name>UpdatedAttribute</name>
<value>PORT2PROVISIONSTATUS</value>
</parameter>
<parameter>
<name>NewValue</name>
<value>Configured</value>
</parameter>
<parameter>
<name>EntityType</name>
<value>Pluggable</value>
</parameter> </parameterSet>
Endpoint is http://localhost:8080/RestfulWebService/crunchify/dspservice
Client implementation which I cannot change:
@Path("{event}") @GET @Produces("application/json") public String getICLEvent(@PathParam("event") String event) { System.out.println("ICL Event :: "+ event); String result = "@Produces(\\"application/xml\\") Output: \\n\\nICL Event: \\n\\n" + event; return result; }
What I have tried so far:
I have used Camel http component in my route like:
.convertBodyTo(String.class, "UTF-8")
.setHeader(Exchange.HTTP_URI, simple("http://localhost:8080/RestfulWebService/crunchify/dspservice/${in.body}"))
.setHeader(Exchange.HTTP_METHOD, constant("GET"))
//.setHeader(Exchange.HTTP_QUERY, constant("event=${in.body}"))
//.setHeader(Exchange.CONTENT_TYPE, constant("application/form-urlencoded"))
.to("http://localhost:8080/RestfulWebService/crunchify/dspservice")
In which I am trying to pass the complete string in the header key 'CamelHttpUri', but I am getting the java.net.URISyntaxException:
exception.
I am not sure this is the best way to call/produce the restful webservice, please suggest the better way I have found hard way to find anything over the internet.
Why don't you use Camel Restlet instead? http://camel.apache.org/restlet.html An example here:
.convertBodyTo(String.class, "UTF-8")
.to("restlet:http://localhost:" + portNum + "/?restletMethod=GET");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.