You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Sekhar Nadella <sh...@mastercard.com> on 2001/11/15 00:31:46 UTC

Prnting SOAP envelope

Hi,

Is there any way to print my soap request/responses to a file? I've used
TcpTunnelGui, but I have deployed my soap service in application server,
where I want to save the  soap request/responses to a file.
 Your help/advises greatly appreciated.

Thanks & Regards,
Sekhar Nadella



Re: Prnting SOAP envelope

Posted by Ian Snead <is...@ezgov.com>.
This is a programming response. Go go super OpenSource!

You can catch and print the bytes as the go to / come
off the transport API's.

If you are using HTTP as a transport, add the following
lines of code to the org.apache.soap.util.net.HTTPUtils
class :

Around line 239, after the

      bOutStream.flush();
      outStream.flush();

add in 

      System.out.println("");
      System.out.println(" [ RAW HTTP REQUEST " + (new
java.util.Date()).toString() + " ] ");
      System.out.println(headerbuf.toString());
      request.writeTo( System.out );

Then, near line 357, after the

      } catch (MessagingException me) {
          throw new IllegalArgumentException("Error parsing
response: " + me);
      }

add in

      // Write out the http response to System.out
      System.out.println("");
      System.out.println(" [ RAW HTTP RESPONSE " + (new
java.util.Date()).toString() + " ] ");
      System.out.println( new String( bytes ) );


Compile the class.

Copy the soap.jar file that comes with Apache SOAP v2.2
to a convienant directory, call it Bob.

Open a command prompt, change to that directory.

Type "jar xvf". This will blow out the jar file into a
tree of classes. Replace the HTTPUtils class with your
new one. Delete the copy of soap.jar

Go back to Bob. Delete the copy of soap.jar

Type "jar cvf soap.jar *"

You now have a new soap.jar that will print the raw
request / responses in their entirety to System.out

I hope this helps. I found it quite useful in debugging.

Ian

dovle wrote:
> 
> I have never used TcpTunnelGui , but instead the UtilSnoop ( a simple java
> app that does almost the same thing as TcpTunnelGui ) . This GUI app can
> catch requests and responses and has an option to save them in files .
> You should try it ... If you have time ,
> dovle
> 
> > Hi,
> >
> > Is there any way to print my soap request/responses to a file? I've used
> > TcpTunnelGui, but I have deployed my soap service in application server,
> > where I want to save the  soap request/responses to a file.
> >  Your help/advises greatly appreciated.
> >
> > Thanks & Regards,
> > Sekhar Nadella

--
Software Engineer
EzGov
work : (404) 836-7957

To err is human.
To System.err is machine.

Re: Prnting SOAP envelope

Posted by Ian Snead <is...@ezgov.com>.
This is a programming response. Go go super OpenSource!

You can catch and print the bytes as the go to / come
off the transport API's.

If you are using HTTP as a transport, add the following
lines of code to the org.apache.soap.util.net.HTTPUtils
class :

Around line 239, after the

      bOutStream.flush();
      outStream.flush();

add in 

      System.out.println("");
      System.out.println(" [ RAW HTTP REQUEST " + (new
java.util.Date()).toString() + " ] ");
      System.out.println(headerbuf.toString());
      request.writeTo( System.out );

Then, near line 357, after the

      } catch (MessagingException me) {
          throw new IllegalArgumentException("Error parsing
response: " + me);
      }

add in

      // Write out the http response to System.out
      System.out.println("");
      System.out.println(" [ RAW HTTP RESPONSE " + (new
java.util.Date()).toString() + " ] ");
      System.out.println( new String( bytes ) );


Compile the class.

Copy the soap.jar file that comes with Apache SOAP v2.2
to a convienant directory, call it Bob.

Open a command prompt, change to that directory.

Type "jar xvf". This will blow out the jar file into a
tree of classes. Replace the HTTPUtils class with your
new one. Delete the copy of soap.jar

Go back to Bob. Delete the copy of soap.jar

Type "jar cvf soap.jar *"

You now have a new soap.jar that will print the raw
request / responses in their entirety to System.out

I hope this helps. I found it quite useful in debugging.

Ian

dovle wrote:
> 
> I have never used TcpTunnelGui , but instead the UtilSnoop ( a simple java
> app that does almost the same thing as TcpTunnelGui ) . This GUI app can
> catch requests and responses and has an option to save them in files .
> You should try it ... If you have time ,
> dovle
> 
> > Hi,
> >
> > Is there any way to print my soap request/responses to a file? I've used
> > TcpTunnelGui, but I have deployed my soap service in application server,
> > where I want to save the  soap request/responses to a file.
> >  Your help/advises greatly appreciated.
> >
> > Thanks & Regards,
> > Sekhar Nadella

--
Software Engineer
EzGov
work : (404) 836-7957

To err is human.
To System.err is machine.

Re: Prnting SOAP envelope

Posted by dovle <do...@delsyne.ro>.
I have never used TcpTunnelGui , but instead the UtilSnoop ( a simple java 
app that does almost the same thing as TcpTunnelGui ) . This GUI app can 
catch requests and responses and has an option to save them in files . 
You should try it ... If you have time ,
dovle 

> Hi,
>
> Is there any way to print my soap request/responses to a file? I've used
> TcpTunnelGui, but I have deployed my soap service in application server,
> where I want to save the  soap request/responses to a file.
>  Your help/advises greatly appreciated.
>
> Thanks & Regards,
> Sekhar Nadella

Re: Prnting SOAP envelope

Posted by dovle <do...@delsyne.ro>.
I have never used TcpTunnelGui , but instead the UtilSnoop ( a simple java 
app that does almost the same thing as TcpTunnelGui ) . This GUI app can 
catch requests and responses and has an option to save them in files . 
You should try it ... If you have time ,
dovle 

> Hi,
>
> Is there any way to print my soap request/responses to a file? I've used
> TcpTunnelGui, but I have deployed my soap service in application server,
> where I want to save the  soap request/responses to a file.
>  Your help/advises greatly appreciated.
>
> Thanks & Regards,
> Sekhar Nadella

Re: Prnting SOAP envelope

Posted by William Brogden <wb...@bga.com>.

Sekhar Nadella wrote:
> 
> Hi,
> 
> Is there any way to print my soap request/responses to a file? I've used
> TcpTunnelGui, but I have deployed my soap service in application server,
> where I want to save the  soap request/responses to a file.
>  Your help/advises greatly appreciated.
> 
> Thanks & Regards,
> Sekhar Nadella

I wrote a utility that allows you to do exactly that, plus some other
goodies. Download UtilSnoop - source and binary - from

http://www.lanw.com/books/javasoap/default.htm

-- 
WBB - wbrogden@lanw.com
Java Cert mock exams http://www.lanw.com/java/javacert/
Author of Java Developer's Guide to Servlets and JSP 
ISBN 0-7821-2809-2

Re: Prnting SOAP envelope

Posted by William Brogden <wb...@bga.com>.

Sekhar Nadella wrote:
> 
> Hi,
> 
> Is there any way to print my soap request/responses to a file? I've used
> TcpTunnelGui, but I have deployed my soap service in application server,
> where I want to save the  soap request/responses to a file.
>  Your help/advises greatly appreciated.
> 
> Thanks & Regards,
> Sekhar Nadella

I wrote a utility that allows you to do exactly that, plus some other
goodies. Download UtilSnoop - source and binary - from

http://www.lanw.com/books/javasoap/default.htm

-- 
WBB - wbrogden@lanw.com
Java Cert mock exams http://www.lanw.com/java/javacert/
Author of Java Developer's Guide to Servlets and JSP 
ISBN 0-7821-2809-2

Re: Prnting SOAP envelope

Posted by Mark Hansen <kh...@yahoo.com>.
Yes, you simply need to marshall the Envelope to a
file writer.  Below is the code for a simple method,
that given an Envelope env, and a SOAPContext ctx -
writes the envelope to a text file.  Deploy the class
XYZ as message service or put the method WriteEnvelope
in your existing service.

Hope this helps,

Mark

import java.io.*;
import java.util.*;
import org.apache.soap.*;
import org.apache.soap.encoding.*;
import org.apache.soap.util.xml.*;
import org.apache.soap.rpc.*;

public class XYZ {

	public void WriteEnvelop(Envelope env, SOAPContext
ctx)
		throws IOException {

		File envfile = new File("envfile.txt");
		FileWriter fw = new FileWriter(envfile);
		XMLJavaMappingRegistry xmr = new
XMLJavaMappingRegistry();
		env.marshall(fw,xmr,reqCtx);
		fw.flush();
		fw.close();
	}

}
--- Sekhar Nadella <sh...@mastercard.com>
wrote:
> Hi,
> 
> Is there any way to print my soap request/responses
> to a file? I've used
> TcpTunnelGui, but I have deployed my soap service in
> application server,
> where I want to save the  soap request/responses to
> a file.
>  Your help/advises greatly appreciated.
> 
> Thanks & Regards,
> Sekhar Nadella
> 
> 


__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

Re: Prnting SOAP envelope

Posted by Mark Hansen <kh...@yahoo.com>.
Yes, you simply need to marshall the Envelope to a
file writer.  Below is the code for a simple method,
that given an Envelope env, and a SOAPContext ctx -
writes the envelope to a text file.  Deploy the class
XYZ as message service or put the method WriteEnvelope
in your existing service.

Hope this helps,

Mark

import java.io.*;
import java.util.*;
import org.apache.soap.*;
import org.apache.soap.encoding.*;
import org.apache.soap.util.xml.*;
import org.apache.soap.rpc.*;

public class XYZ {

	public void WriteEnvelop(Envelope env, SOAPContext
ctx)
		throws IOException {

		File envfile = new File("envfile.txt");
		FileWriter fw = new FileWriter(envfile);
		XMLJavaMappingRegistry xmr = new
XMLJavaMappingRegistry();
		env.marshall(fw,xmr,reqCtx);
		fw.flush();
		fw.close();
	}

}
--- Sekhar Nadella <sh...@mastercard.com>
wrote:
> Hi,
> 
> Is there any way to print my soap request/responses
> to a file? I've used
> TcpTunnelGui, but I have deployed my soap service in
> application server,
> where I want to save the  soap request/responses to
> a file.
>  Your help/advises greatly appreciated.
> 
> Thanks & Regards,
> Sekhar Nadella
> 
> 


__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com