aspose file tools*
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes Getting the Raw Request and Response XML from axis. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "Getting the Raw Request and Response XML from axis." Watch "Getting the Raw Request and Response XML from axis." New topic
Author

Getting the Raw Request and Response XML from axis.

Sri Ram
Greenhorn

Joined: Feb 13, 2006
Posts: 20
Can anyone tell me how to get the raw request and response using axis??? any reference links???


Thanks and Regards,
Sriram


Sriram<br />SCJP<br />SCWCD
michael warren
Ranch Hand

Joined: Oct 20, 2006
Posts: 50
don't know if this is the best way to do it - but think it does what you're asking for.
Add a handler (see my other post today about this) and make it print out the SOAP messages as they come in and go out

does this help ?

Example code which I've just tried and seems to work

Sri Ram
Greenhorn

Joined: Feb 13, 2006
Posts: 20
Can you tell me how to use this class??
michael warren
Ranch Hand

Joined: Oct 20, 2006
Posts: 50
you need to read up on how to use handlers, my post here gives some details
http://www.coderanch.com/t/148792/java-Web-Services-SCDJWS/certification/configuring-handlers-programmatically

perhaps have a look here for more stuff about handlers
http://java.boot.by/wsd-guide/ch04s07.html
Karthik Rajendiran
Ranch Hand

Joined: Aug 13, 2004
Posts: 211
One more easier way is to use netmon or tcpmon tool to intercept the messages

1. TCP/IP Monitor in eclipse plugin too can help
Let us assume Webservice is runninig in Port A
Now in the client code, change the endpoint port address to B ( Local Port at which the tcp ip tool listens and redirects to Port A
Local Port is B
Server Port is A
Once you give hit to the service using client code, you can able to see the messages in the tool


SCJP 1.4 SCWCD 1.4 SCDJWS 1.4
Sri Ram
Greenhorn

Joined: Feb 13, 2006
Posts: 20
Actually,I want to store the XML in a database.I dont want to use TCPMon.Can anyone tell me how to do this using Axis ??

Thanks and Regards,
Sriram
Karthik Rajendiran
Ranch Hand

Joined: Aug 13, 2004
Posts: 211
How are you going to store xml in DB.
1. You want parse and store the information
2. or You want to dumb the Xml file itself in DB
Vi Manch
Greenhorn

Joined: Sep 07, 2003
Posts: 3
try this ...
http://wiki.apache.org/ws/FrontPage/Axis/AxisClientConfiguration/ViewSOAPMessages


SCJP, SCWCD
Joe White
Greenhorn

Joined: Dec 10, 2008
Posts: 5


Thank you, Thank you, Thank you.
I looked at their Wiki and I must have over-looked this.
Bhupendra Shivade
Greenhorn

Joined: Apr 27, 2010
Posts: 1
If you have class which implements org.apache.axis2.databinding.ADBBean this interface then its pretty simple to get Soap Request and Soap response(i.e raw xml which is posted from client)
call this method on the object
getOMElement(null, OMAbstractFactory.getOMFactory()).toStringWithConsume())
This will give you Soap request or response based on object which you call method on.


Cheers
Bhupendra
Emrah Kivanc
Greenhorn

Joined: Oct 05, 2011
Posts: 1
Hi,
Here the problem is, Request and Response methods are different,
Is there a way to handle "Request XML Messages or HttpServletRequest" in response scope..
I mean Is there a way to get "request Soap Message" while inbound direction ( meaning while getting response... )

My AxisHandler implements "SOAPHandler"..

(Otherwise I need to save "RequestXML_Message" in a Class variable up to getting response or fault message,
After getting ResponseXML or Fault then I will able to log all the Messages together..
But keeping the requestMessage in a class variable is not a safe state i think..)

I have tried the following code but it always returns "nullPointerException.."

Daniel Val
Ranch Hand

Joined: Jan 09, 2012
Posts: 44
Emrah Kivanc wrote:Hi,
Here the problem is, Request and Response methods are different,
...


It worked for me as follows:

http://proghowto.com/axis-client-request-and-response-logging

Just ensure that when you log the stuff, it is really on one line.

Regards,
Daniel
deepika deepi
Ranch Hand

Joined: Jan 23, 2012
Posts: 199
hi dear experts,

i have some doubt in java coding.. for search engine process.. can you kindly tell me how to do??? for Inverted Index??? kindly help me sir....
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Getting the Raw Request and Response XML from axis.