This week's giveaway is in the Spring forum.
We're giving away four copies of Microservices Testing (Live Project) and have Chris Love & Andres Sacco on-line!
See this thread for details.
Win a copy of Microservices Testing (Live Project) this week in the Spring forum!

Harsh Cap

Greenhorn
+ Follow
since Mar 04, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Harsh Cap


Please read this http://users.skynet.be/pascalbotte/rcx-ws-doc/saajpost.htm link.

Regards
Harsh Mudgal
12 years ago
Hi Ramesh

Please try Addison Wesley - J2EE Web Services (2003).

Regards
Harsh Mudgal
12 years ago
Hi

I am using Asp as my client application which send me the request in soapXml format. I process that request in servlet and send back the soapResponse XML. I am creating soap response manually and write it to the Output Stream.

My problem is when I send my response like this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?><soapenv xmlns="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ro="http://service.dispute.dms.fdi.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Body><processRequestResponse xmlns="http://firstdata.com.au/DMS/service"><processRequestReturn><CopyDisputeResponse><ro:caseType>121</ro:caseType><ro:entityId>222</ro:entityId><ro:deviceType>333</ro:deviceType><ro:disputeType>444</ro:disputeType><ro:isownTerminal>true</ro:isownTerminal><ro:textId>false</ro:textId><ro:issuer>issuer</ro:issuer><ro:accquirer>accquirer</ro:accquirer></CopyDisputeResponse></processRequestReturn></processRequestResponse></Body></soapenv>

My asp get the response and I parsed this XML in my ASP code. But in the above response if you see the Envelop element is not present. When i try to send response with the soap envelop like this :

<?xml version="1.0" encoding="UTF-8" standalone="no"?><soapenv:Envelop xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ro="http://service.dispute.dms.fdi.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><processRequestResponse xmlns="http://firstdata.com.au/DMS/service"><processRequestReturn><CopyDisputeResponse><ro:caseType>121</ro:caseType><ro:entityId>222</ro:entityId><ro:deviceType>333</ro:deviceType><ro:disputeType>444</ro:disputeType><ro:isownTerminal>true</ro:isownTerminal><ro:textId>false</ro:textId><ro:issuer>issuer</ro:issuer><ro:accquirer>accquirer</ro:accquirer></CopyDisputeResponse></processRequestReturn></processRequestResponse></soapenv:Body></soapenv:Envelop>

I am not getting anyting in ASP. Please help me out.

Regards
Harsh Mudgal
12 years ago

Hi Ivan

As you suggest i tried to make a soap request through soapUI and found that the request which i previously make was not correct because of that i am not able to invoke my web service.

I modify my request and now I am able to call my web service.

Thanks a ton for your suggestion.

Harsh


12 years ago
Hi

Thanks for your intrest ....

I am using Servlet to make a soap request and call my web service from the servlet. All the above code is a part of Servlet. I never tried SoapUI for creating soapRequest. Could you please tell me how can I call my web service from Servlet witout using any tool.

Thanks in advance.

Regards
Harsh
12 years ago
Hi

I am devloping a one webservice and hosted TestEmployee as a web service i am using addEmployee as a web service method which take Employee as a parameter. My problem is that i am getting employee as null in my method.

I am preparing the soap request in a servlet please find below code for my my soap request:

SOAPPart sp = msg.getSOAPPart();

SOAPEnvelope env = sp.getEnvelope();
env.addNamespaceDeclaration("xsd","http://www.w3.org/2001/XMLSchema");
env.addNamespaceDeclaration("xsi","http://www.w3.org/2001/XMLSchema-instance");
env.addNamespaceDeclaration("enc","http://schemas.xmlsoap.org/soap/encoding/");
env.addNamespaceDeclaration("env","http://schemas.xmlsoap.org/soap/envelop/");
env.setEncodingStyle("http://schemas.xmlsoap.org/soap/encoding/");

SOAPBody bd = env.getBody();
Document document=getDocument(emp);
bd.addChildElement(env.createName("getEmployee","emp","http://localhost:8008/DocStyleWS/BO/Employee"));
bd.addDocument(document);

msg.saveChanges();

// View input
System.out.println("\n Soap request:\n");
msg.writeTo(System.out);
System.out.println();
return msg;

Once that code execute my soap request came like this:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:env="http://schemas.xmlsoap.org/soap/envelop/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header/><SOAP-ENV:Body><emp:getEmployee xmlns:emp="http://localhost:8008/DocStyleWS/BO/Employee"/><employee><empId>26155</empId><empName>Harsh</empName></employee></SOAP-ENV:Body></SOAP-ENV:Envelope>

Below is the code how I call my webservice:

SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
SOAPConnection conn = scf.createConnection();

// Send
String urlval = "http://localhost:8008/DocStyleWS/services/TestEmployee";
// or /rcx-ws-rpc/rcx for my rpc/encoded web service

SOAPMessage rp = conn.call(msg, urlval);

// View the output
System.out.println("\nXML response\n");

// Create transformer
TransformerFactory tff = TransformerFactory.newInstance();
Transformer tf = tff.newTransformer();

// Get reply content
Source sc = rp.getSOAPPart().getContent();

// Set output transformation
StreamResult result = new StreamResult(System.out);
tf.transform(sc, result);

System.out.println();

StreamResult fileResult = new StreamResult(new File("C:\\Harsh\\output.xml"));
tf.transform(sc, fileResult);

// Close connection
conn.close();


MY web service code look like this:

public String addEmployee(Employee emp){
System.out.println("In Add employee method");
empList.add(emp.getEmpId().intValue() ,emp);
System.out.println("Employee Added Sucessfully");
return "Emp Added";
}


I am getting the fault code in my soap response please find it below:

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server.userException</faultcode><faultstring>java.lang.NullPointerException</faultstring><detail><ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">PUNDT8X2KQ1S</ns1:hostname></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>


Please help me as i already invest my 5 days to get this error resolve.

Thanks
Harsh


12 years ago