httpclient for accessing webservice
Karthik Rajendiran
Ranch Hand
Joined: Aug 13, 2004
Posts: 204
posted Sunday, August 31, 2008 22:03
Hello Friends,
can we use httpclient by apache commons to access webservice.
How do we send the soap request to the webservice, should ihave to frame the request and post
or is it enough if i give xml of the document based webserviec alone to server.
1. How to construct the xml with parameters and how to read from the response.
Can anyone help with this?
SCJP 1.4 SCWCD 1.4 SCDJWS 1.4
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 11457
posted Monday, September 01, 2008 08:36
1. IF the service you need to access is based on the SOAP protocol, THEN there are numerous toolkits which will help you create a client that can create a SOAP formated request and interpret the response. The Apache Axis2 toolkit is one example.
2. HttpClient makes it easy to use sevices based on RESTful designs for creating a request. The standard Java library (java.net package) can also be used. You will have to code the response interpretation.
3. For simple SOAP queries where you have an example SOAP message provided by the service, you can use HttpClient or the standard Java library to generate a request using the example as a template. Again - interpreting the response will require custom code.
Bill
Karthik Rajendiran
Ranch Hand
Joined: Aug 13, 2004
Posts: 204
posted Sunday, August 31, 2008 22:03
Hello Friends,
can we use httpclient by apache commons to access webservice.
How do we send the soap request to the webservice, should ihave to frame the request and post
or is it enough if i give xml of the document based webserviec alone to server.
1. How to construct the xml with parameters and how to read from the response.
Can anyone help with this?
SCJP 1.4 SCWCD 1.4 SCDJWS 1.4
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 11457
posted Monday, September 01, 2008 08:36
1. IF the service you need to access is based on the SOAP protocol, THEN there are numerous toolkits which will help you create a client that can create a SOAP formated request and interpret the response. The Apache Axis2 toolkit is one example.
2. HttpClient makes it easy to use sevices based on RESTful designs for creating a request. The standard Java library (java.net package) can also be used. You will have to code the response interpretation.
3. For simple SOAP queries where you have an example SOAP message provided by the service, you can use HttpClient or the standard Java library to generate a request using the example as a template. Again - interpreting the response will require custom code.
Bill