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
WSDL
http://user.rumba.int.pearsoncmg.com/UserLifeCycle/UserLifeCycleReadV3.wsdl
Request
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:v3="http://user.rws.pearson.com/doc/V3/">
<soap:Header/>
<soap:Body>
<v3:GetUserByUserNameRequest>
<v3:UserName>rumba_test_1_ynj</v3:UserName>
<!--Optional:-->
</v3:GetUserByUserNameRequest>
</soap:Body>
</soap:Envelope>
Code
package RumbaCom;
import java.net.*;
import java.io.*;
public class PostXml {
public static void main(String[] args) {
try {
String xmldata="<soap:Envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:v3=\"http://user.rws.pearson.com/doc/V3/\">"+
"<soap:Header/>"+
"<soap:Body>"+
"<v3:GetUserByUserNameRequest>"+
"<v3:UserName>rumba_test_1_ynj</v3:UserName>"+
"</v3:GetUserByUserNameRequest>"+
"</soap:Body>"+
"</soap:Envelope>";
//Create socket
String hostname = "user.rumba.int.pearsoncmg.com";
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("Host: user.rumba.int.pearsoncmg.com\r\n");
wr.write("Content-Length: " + xmldata.length() + "\r\n");
wr.write("Content-Type: text/xml; charset=\"utf-8\"\r\n");
wr.write("\r\n");
//Send data
wr.write(xmldata);
wr.flush();
// Response
BufferedReader rd = new BufferedReader(new InputStreamReader(sock.getInputStream()));
String line;
while((line = rd.readLine()) != null)
System.out.println(line);
} catch (Exception e) {
e.printStackTrace();
}
}
}
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://www.webservicex.net/CurrencyConvertor.asmx?wsdl
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;}A.name {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 org.springframework.ws.soap.axiom.AxiomSoapMessageCreationException: 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
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
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
Thanks,
Jigesh Shah