Community

SoapProxy issue while calling Client Program

reply from lackki rao in JBoss ESB Development - View the full discussion
Here is my Client code but nothing great.
public class ClientTest
{
private static final String SOAP_SAMPLE =
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"http://www.webservicex.net/\">"+
"<soapenv:Header/>"+
  "<soapenv:Body>"+
  "<web:GetQuote>"+
   "<web:symbol>RHT</web:symbol>"+
   "</web:GetQuote>"+
    "</soapenv:Body>"+
  "</soapenv:Envelope>";
public static void main(String args[]) throws Exception
{
System.out.println("****  REQUEST  URL: " + url);
PostMethod method = new PostMethod(url);
method.setRequestHeader("Content-Type", "text/xml;charset=UTF-8");
//method.addParameter("proxyHost", "10.48.133.184");
//method.addParameter("proxyPort", "6588");
//method.addParameter("proxySet", "true");
//System.setProperty("proxyHost", "10.48.133.184");
//System.setProperty("proxyPort", "6588");
//method.
method.setRequestHeader("SOAPAction", "\"\"");
//String request = SOAP_SAMPLE;
System.out.println("****  REQUEST BODY: " + SOAP_SAMPLE);
method.setRequestEntity( new StringRequestEntity(SOAP_SAMPLE) );
HttpClient client = new HttpClient();
InputStream response = null;
try
{
int code = client.executeMethod(method);
System.out.println("**** RESPONSE CODE: " + code);
response = method.getResponseBodyAsStream();
byte[] bytes = StreamUtils.readStream(response);
System.out.println("**** RESPONSE BODY: " + new String(bytes, method.getResponseCharSet()));
}
finally
{
method.releaseConnection();
if (response != null)
{
response.close();
}
}
}
}

Reply to this message by going to Community

Start a new discussion in JBoss ESB Development at Community