aspose file tools
The moose likes Sockets and Internet Protocols and the fly likes Error while genrating a simple response Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Error while genrating a simple response" Watch "Error while genrating a simple response" New topic

Error while genrating a simple response

Jigeshs Shahs

Joined: May 28, 2009
Posts: 26
Hi All,
I am a Software Tester and want to verify that the response for my WSDL is correct or not
So I got a piece of code which generates the response for WSDL

Given below is the WSDL , the Request and the Code



<soap:Envelope xmlns:soap="" xmlns:v3="">



package RumbaCom;


public class PostXml {

public static void main(String[] args) {

try {

String xmldata="<soap:Envelope xmlns:soap=\"\" xmlns:v3=\"\">"+


//Create socket
String hostname = "";
int port = 80;
InetAddress addr = InetAddress.getByName(hostname);
Socket sock = new Socket(addr, port);

//Send header
String path = "/UserLifeCycle/services/read/V3";
BufferedWriter wr = new BufferedWriter(new OutputStreamWriter(sock.getOutputStream()));
// You can use "UTF8" for compatibility with the Microsoft virtual machine.
wr.write("POST " + path + " HTTP/1.0\r\n");
wr.write("Content-Length: " + xmldata.length() + "\r\n");
wr.write("Content-Type: text/xml; charset=\"utf-8\"\r\n");

//Send data

// Response
BufferedReader rd = new BufferedReader(new InputStreamReader(sock.getInputStream()));
String line;
while((line = rd.readLine()) != null)
} catch (Exception e) {

When I try to run the code with my WSDL it is giving me the following Error but when I use the same code to Test the WebService which contains WWW it works fine and generates correct Reponse For e.g.

HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Content-Length: 4758
Date: Mon, 30 Apr 2012 09:29:47 GMT
Connection: close

<html><head><title>Apache Tomcat/6.0.35 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;} {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>org.springframework.web.util.NestedServletException: Request processing failed; nested exception is Could not create message: Transport level information does not match with SOAP Message namespace URI; nested exception is org.apache.axiom.soap.SOAPProcessingException: Transport level information does not match with SOAP Message namespace URI

I am unable to understand what is going and I dont know much about the WebServices
I want to use this code for My Automation Task and I don't want to use SOAP UI to Test the WebServices
Can anybody please help me on this to resolve the code

Jigesh Shah
It is sorta covered in the JavaRanch Style Guide.
subject: Error while genrating a simple response