com.quadrique.jbuildingblocks.core.io.http.client
Class JbbXmlOverHttpClientHandler

java.lang.Object
  extended by com.quadrique.jbuildingblocks.core.io.http.client.JbbXmlOverHttpClientHandler

public class JbbXmlOverHttpClientHandler
extends Object

This class provides convenience routines to simplify and streamline the request/response handling of XML over HTTP communications. The actual HTTP layer is based on the HttpClient package.

Author:
Hervé Rivere

Constructor Summary
JbbXmlOverHttpClientHandler()
          constructor
 
Method Summary
 String sendRequestGetResponseAsString(String url, String serializedXmlDocument)
          This method sends to the given URL the given serialized XML document.
 String sendRequestGetResponseAsString(String url, String serializedXmlDocument, int timeout)
          This method sends to the given URL the given serialized XML document.
 String sendRequestGetResponseAsString(String url, String serializedXmlDocument, String xmlEncoding, int timeout)
          This method sends to the given URL the given serialized XML document.
 Document sendRequestGetResponseAsXml(String url, String serializedXmlDocument)
          This is the same method than the "String sendRequestStr(String url,String serializedXmlDocument)" method except that the response is returned as an XML document
 Document sendRequestGetResponseAsXml(String url, String serializedXmlDocument, String xmlEncoding)
          This is the same method than the "String sendRequestStr(String url,String serializedXmlDocument)" method except that the response is returned as an XML document
 Document sendRequestGetResponseAsXml(String url, String serializedXmlDocument, String xmlEncoding, int timeout)
          This is the same method than the "String sendRequestStr(String url,String serializedXmlDocument)" method except that the response is returned as an XML document
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JbbXmlOverHttpClientHandler

public JbbXmlOverHttpClientHandler()
constructor

Method Detail

sendRequestGetResponseAsString

public String sendRequestGetResponseAsString(String url,
                                             String serializedXmlDocument,
                                             int timeout)
                                      throws Exception
This method sends to the given URL the given serialized XML document.
Please note that this method covers both https and http URLs
For information purpose only (you don't have to do anything other than providing us with a plain JAVA string), the actual communication mechanism is an HTTP POST with a UTF-8 encoded body

Parameters:
url - the target URL e.g. "https://www.quadrique.com/test1"
serializedXmlDocument - a serialized XML document e.g.
"
AddUser...

"
timeout - e.g. 30000 for 30 seconds SO_TIMEOUT
Returns:
the response from the server as a String
Throws:
Exception

sendRequestGetResponseAsString

public String sendRequestGetResponseAsString(String url,
                                             String serializedXmlDocument,
                                             String xmlEncoding,
                                             int timeout)
                                      throws Exception
This method sends to the given URL the given serialized XML document.
Please note that this method covers both https and http URLs
For information purpose only (you don't have to do anything other than providing us with a plain JAVA string), the actual communication mechanism is an HTTP POST with a UTF-8 encoded body

Parameters:
url - the target URL e.g. "https://www.quadrique.com/test1"
serializedXmlDocument - a serialized XML document e.g.
"
AddUser...

"
xmlEncoding - the encoding to use when POSTing the data to the server (e.g. "UTF-8")
timeout - e.g. 30000 for 30 seconds SO_TIMEOUT
Returns:
the response from the server as a String
Throws:
Exception

sendRequestGetResponseAsString

public String sendRequestGetResponseAsString(String url,
                                             String serializedXmlDocument)
                                      throws Exception
This method sends to the given URL the given serialized XML document.
Please note that this method covers both https and http URLs
For information purpose only (you don't have to do anything other than providing us with a plain JAVA string), the actual communication mechanism is an HTTP POST with a UTF-8 encoded body using timeout values as 30000ms or 30sec.

Parameters:
url - the target URL e.g. "https://www.quadrique.com/test1"
serializedXmlDocument - a serialized XML document e.g.
"
AddUser...

"
Returns:
the response from the server as a String
Throws:
Exception

sendRequestGetResponseAsXml

public Document sendRequestGetResponseAsXml(String url,
                                            String serializedXmlDocument)
                                     throws Exception
This is the same method than the "String sendRequestStr(String url,String serializedXmlDocument)" method except that the response is returned as an XML document

Parameters:
url - the target URL e.g. "https://www.quadrique.com/test1"
serializedXmlDocument - a serialized XML document e.g.
"
AddUser...

"
Returns:
the response from the server as an XML document
Throws:
Exception

sendRequestGetResponseAsXml

public Document sendRequestGetResponseAsXml(String url,
                                            String serializedXmlDocument,
                                            String xmlEncoding)
                                     throws Exception
This is the same method than the "String sendRequestStr(String url,String serializedXmlDocument)" method except that the response is returned as an XML document

Parameters:
url - the target URL e.g. "https://www.quadrique.com/test1"
serializedXmlDocument - a serialized XML document e.g.
"
AddUser...

xmlEncoding - the encoding to use for the xml in the body (e.g. "UTF-8"...)
Returns:
the response from the server as an XML document
Throws:
Exception

sendRequestGetResponseAsXml

public Document sendRequestGetResponseAsXml(String url,
                                            String serializedXmlDocument,
                                            String xmlEncoding,
                                            int timeout)
                                     throws Exception
This is the same method than the "String sendRequestStr(String url,String serializedXmlDocument)" method except that the response is returned as an XML document

Parameters:
url - the target URL e.g. "https://www.quadrique.com/test1"
serializedXmlDocument - a serialized XML document e.g.
"
AddUser...

xmlEncoding - the encoding to use for the xml in the body (e.g. "UTF-8"...)
Returns:
the response from the server as an XML document
Throws:
Exception


Copyright © 2001-2008 Quadrique Corporation. All Rights Reserved.