0

I developed a simple web service project using JAX-WS with My Eclipse. Application works fine. But If I see the TCP/IP monitor in the My eclipse IDE.

Request & Response showing like the following :

Request Part :

GET /webservices/demo?wsdl HTTP/1.1
User-Agent: Java/1.7.0_80-ea
Host: localhost:7211
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive

POST /webservices/demo HTTP/1.1
Accept: text/xml, multipart/related
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://webservice.java.ram.com/DemoService/getNameLenghtRequest"
User-Agent: JAX-WS RI 2.2.8-promoted-b146 svn-revision#13443
Host: localhost:7211
Connection: keep-alive
Content-Length: 262

<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:getNameLenght xmlns:ns2="http://webservice.java.ram.com/"><user><name>RAMK</name><pass>pass</pass></user></ns2:getNameLenght></S:Body></S:Envelope>

Response Part :

HTTP/1.1 200 OK
Transfer-encoding: chunked
Content-type: text/xml;charset=utf-8
Date: Thu, 14 Jan 2016 04:31:44 GMT

696
<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.8-promoted-b146 svn-revision#13443. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.8-promoted-b146 svn-revision#13443. --><definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ws.webservice.java.ram.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://ws.webservice.java.ram.com/" name="DemoServiceWSService">
<import namespace="http://webservice.java.ram.com/" location="http://localhost:7211/webservices/demo?wsdl=1"/>
<binding xmlns:ns1="http://webservice.java.ram.com/" name="DemoServiceWSPortBinding" type="ns1:DemoService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="getNameLenght">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="deleteSpaces">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="DemoServiceWSService">
<port name="DemoServiceWSPort" binding="tns:DemoServiceWSPortBinding">
<soap:address location="http://localhost:7211/webservices/demo"/>
</port>
</service>
</definitions>
0

HTTP/1.1 200 OK
Transfer-encoding: chunked
Content-type: text/xml; charset=utf-8
Date: Thu, 14 Jan 2016 04:31:46 GMT

6e
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body>
9a
<ns2:getNameLenghtResponse xmlns:ns2="http://webservice.java.ram.com/"><return><count>4</count></return></ns2:getNameLenghtResponse></S:Body></S:Envelope>
0

Here, What I am expecting is, I want to see the request message in the XML format. But as you see, either the request/response is not in the XML format. By that TCP/IP monitor will displays request/response message as unstructured if I chose XML as a View in TCP/IP monitor.

So, Here my question is, How to get the request message exactly in XML format.

For Example:

<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:getNameLenght xmlns:ns2="http://webservice.java.ram.com/"><user><name>RAMK</name><pass>pass</pass></user></ns2:getNameLenght></S:Body></S:Envelope>
Ram Kowsu
  • 711
  • 2
  • 10
  • 30
  • the response you have shared is the wsdl of your web service , it is not a web method's response – AntJavaDev Jan 14 '16 at 07:20
  • Ooo...My bad. But as you can see the request right?? I had mentioned XML format for both request and response. Can you please help me with that...thanks. – Ram Kowsu Jan 14 '16 at 07:44
  • try use SoapUi , its very helpful to test your web service , and you will have the messages in the format you want. get it here : http://sourceforge.net/projects/soapui/files/ and check some tutorials here : http://www.soapui.org/getting-started/your-first-soapui-project.html – AntJavaDev Jan 14 '16 at 07:53
  • Is there any ideas how to see the format SOAP header message as xml format only in tcp/ip monitor. – Ram Kowsu Jan 20 '16 at 08:14
  • well you cant because it will display the XML request along with the Request Information(content-type , host ,action etc.) , you can export it as a log file , and then parse it with another program in order to get the clean xml request and print it in the format you want – AntJavaDev Jan 20 '16 at 09:14
  • Good Idea.I'll do it. – Ram Kowsu Jan 20 '16 at 15:57

0 Answers0