• Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling webservice: works from standalone app but not from weblogic  RSS feed

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm calling a SOAP 1.1 webservice which use basic HTTP authentication. All works well in a standalone class, but if I put the same code into a web application, for example in an Action class, it doesn't work. I receive a 500 response code, and an empty body. Can you help me?
My code looks like this, using the Apache Commons libraries:

HttpClient client = new HttpClient();
new AuthScope("<webservice_server>", 80),
new UsernamePasswordCredentials("<username>", "<password>")
PostMethod post = new PostMethod("<webservice_url>");
post.setRequestHeader("SOAPAction", "<webservice_url>#<method>");
post.setRequestBody(new StringBufferInputStream(input)); //input previously defined
try {
int status = client.executeMethod( post );
String body = post.getResponseBodyAsString();
if(status == 200){
return body;
throw new Exception("status: " + status + " body: " + body);
} finally {

Thank you

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!