You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Kerstin Bauer <Si...@gmx.de> on 2007/08/23 12:04:18 UTC

reading SOAP Message at the webserver?

Hi all!

I'm new to Axis and I'm sorry if my question sounds silly...

I developed a webservice with Axis 1.4 and Java. Furthermore I wrote a Client to access this webserver. 
What I'm supposed to do now is to examine the SOAP Body, if it really contains the message that is contained and to validate the message for my purposes. So I would like to read the XML of the SOAP Body. Is that possible? How can I do this?

Some more information:
I created the webservice by writing the wsdl-document and then using the wsdl2java command for creating the java classes.

An excerpt of my client code:

RetManService service = new RetManServiceLocator();
RetMan stub;
try {
    stub = service.getretMan();
    result = stub.search(query);
...
}

An excerpt of my webserver code:

public class RetManSOAPBindingImpl implements retrievalJava.RetMan{
    public MQueryType search(MQueryType queryType) throws RemoteException {
    ...
    }
}

Thanks in advance for your help!

Kerstin

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kanns mit allen: http://www.gmx.net/de/go/multimessenger

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: reading SOAP Message at the webserver?

Posted by Kerstin Bauer <Si...@gmx.de>.
Hi Mike!

Thanks a lot for your answer!
This looks like the solution I'm searching for.

Until now I haven't implemented a custom handler but now is time to learn it.

Thanks for your help!

Kerstin


-------- Original-Nachricht --------
> Datum: Thu, 23 Aug 2007 09:14:25 -0600
> Von: "Mike Krell" <mk...@gmail.com>
> An: axis-user@ws.apache.org
> Betreff: Re: reading SOAP Message at the webserver?

> I do something similar.  I grab the SOAPMessage and parse a couple of
> attributes of the message.  The whole thing then gets stored into a
> database.  I had to create a custom handler to do this work and then
> insert
> the handler into the handler chain.
> 
> Once the handler gets the message you will have access to the xml.
> 
> The handler code looks something like this....
> 
> public void invoke(MessageContext msgContext)throws AxisFault
> {
>             SOAPMessageContext soapCntxt = (SOAPMessageContext)msgContext;
>             SOAPMessage message = soapCntxt.getMessage();
>             SOAPBody body = message.getSOAPBody();
> 
> }
> 
> You'll need to modify you server deploy descripter (wsdd) to insert the
> handler in the chain.
> 
> I hope this helps.
> 
> Mike
> 
> On 8/23/07, Kerstin Bauer <Si...@gmx.de> wrote:
> >
> > Hi all!
> >
> > I'm new to Axis and I'm sorry if my question sounds silly...
> >
> > I developed a webservice with Axis 1.4 and Java. Furthermore I wrote a
> > Client to access this webserver.
> > What I'm supposed to do now is to examine the SOAP Body, if it really
> > contains the message that is contained and to validate the message for
> my
> > purposes. So I would like to read the XML of the SOAP Body. Is that
> > possible? How can I do this?
> >
> > Some more information:
> > I created the webservice by writing the wsdl-document and then using the
> > wsdl2java command for creating the java classes.
> >
> > An excerpt of my client code:
> >
> > RetManService service = new RetManServiceLocator();
> > RetMan stub;
> > try {
> >     stub = service.getretMan();
> >     result = stub.search(query);
> > ...
> > }
> >
> > An excerpt of my webserver code:
> >
> > public class RetManSOAPBindingImpl implements retrievalJava.RetMan{
> >     public MQueryType search(MQueryType queryType) throws
> RemoteException
> > {
> >     ...
> >     }
> > }
> >
> > Thanks in advance for your help!
> >
> > Kerstin
> >
> > --
> > Psssst! Schon vom neuen GMX MultiMessenger gehört?
> > Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: axis-user-help@ws.apache.org
> >
> >

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: reading SOAP Message at the webserver?

Posted by Mike Krell <mk...@gmail.com>.
I do something similar.  I grab the SOAPMessage and parse a couple of
attributes of the message.  The whole thing then gets stored into a
database.  I had to create a custom handler to do this work and then insert
the handler into the handler chain.

Once the handler gets the message you will have access to the xml.

The handler code looks something like this....

public void invoke(MessageContext msgContext)throws AxisFault
{
            SOAPMessageContext soapCntxt = (SOAPMessageContext)msgContext;
            SOAPMessage message = soapCntxt.getMessage();
            SOAPBody body = message.getSOAPBody();

}

You'll need to modify you server deploy descripter (wsdd) to insert the
handler in the chain.

I hope this helps.

Mike

On 8/23/07, Kerstin Bauer <Si...@gmx.de> wrote:
>
> Hi all!
>
> I'm new to Axis and I'm sorry if my question sounds silly...
>
> I developed a webservice with Axis 1.4 and Java. Furthermore I wrote a
> Client to access this webserver.
> What I'm supposed to do now is to examine the SOAP Body, if it really
> contains the message that is contained and to validate the message for my
> purposes. So I would like to read the XML of the SOAP Body. Is that
> possible? How can I do this?
>
> Some more information:
> I created the webservice by writing the wsdl-document and then using the
> wsdl2java command for creating the java classes.
>
> An excerpt of my client code:
>
> RetManService service = new RetManServiceLocator();
> RetMan stub;
> try {
>     stub = service.getretMan();
>     result = stub.search(query);
> ...
> }
>
> An excerpt of my webserver code:
>
> public class RetManSOAPBindingImpl implements retrievalJava.RetMan{
>     public MQueryType search(MQueryType queryType) throws RemoteException
> {
>     ...
>     }
> }
>
> Thanks in advance for your help!
>
> Kerstin
>
> --
> Psssst! Schon vom neuen GMX MultiMessenger gehört?
> Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: reading SOAP Message at the webserver?

Posted by Kerstin Bauer <Si...@gmx.de>.
Hi Pushkar,

thanks for your answer!

I already know TCPMon and SOAPMonitor, but they are not what I'm searching for. I don't want to monitor the SOAP messages.

What I would like to do is, to access the SOAP messages from within the java code of my webservice. Is this possible?
I found some java classes in the axis API like SOAPMessage, SOAPHeader, MessageContext, etc. And I wondered if I could use these in my webserver class? But how?

The only parameter my method search receives is the object MQueryType. But in the SOAP message, this object is sent in XML-Format, is this correct? I would like to access the XML-representation of this MQueryType Object. 

Why I'm trying to do this is: I'm supposed to use another Java library which exspects a String (that should be in XML format). And so I need to parse my MQueryType object to XML. But to avoid this.... the obejct already is in XML format in the SOAP message and if I could access the SOAP message from within the java code of my webservice, I won't have to do the parsing myself :)

Regards,
Kerstin


-------- Original-Nachricht --------
> Datum: Thu, 23 Aug 2007 05:56:32 -0700 (PDT)
> Von: Pushkar Bodas <pu...@gs.com>
> An: axis-user@ws.apache.org
> Betreff: Re: reading SOAP Message at the webserver?

> 
> Sorry, It was supposed to be TCPMon...not TCSMon... :P
> 
> Pushkar Bodas wrote:
> > 
> > Hi Kerstin,
> > 
> > Try to use TCSMon to monitor your soap message
> > [http://ws.apache.org/commons/tcpmon/]
> > This will help you monitor the soap message exchange.
> > 
> > The soap message sent can be seen in the stub as you debug through the
> > program...and also, if im not mistaken (as I use axis2, earlier I used
> > axis), axis 1.4 provides a Soap Monitor functionality, im not too sure
> > though how it works.
> > 
> > thanks and regards,
> > Pushkar
> > 
> > 
> > Sindara.K wrote:
> >> 
> >> Hi all!
> >> 
> >> I'm new to Axis and I'm sorry if my question sounds silly...
> >> 
> >> I developed a webservice with Axis 1.4 and Java. Furthermore I wrote a
> >> Client to access this webserver. 
> >> What I'm supposed to do now is to examine the SOAP Body, if it really
> >> contains the message that is contained and to validate the message for
> my
> >> purposes. So I would like to read the XML of the SOAP Body. Is that
> >> possible? How can I do this?
> >> 
> >> Some more information:
> >> I created the webservice by writing the wsdl-document and then using
> the
> >> wsdl2java command for creating the java classes.
> >> 
> >> An excerpt of my client code:
> >> 
> >> RetManService service = new RetManServiceLocator();
> >> RetMan stub;
> >> try {
> >>     stub = service.getretMan();
> >>     result = stub.search(query);
> >> ...
> >> }
> >> 
> >> An excerpt of my webserver code:
> >> 
> >> public class RetManSOAPBindingImpl implements retrievalJava.RetMan{
> >>     public MQueryType search(MQueryType queryType) throws
> RemoteException
> >> {
> >>     ...
> >>     }
> >> }
> >> 
> >> Thanks in advance for your help!
> >> 
> >> Kerstin
> >> 
> >> -- 
> >> Psssst! Schon vom neuen GMX MultiMessenger gehört?
> >> Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
> >> 
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >> For additional commands, e-mail: axis-user-help@ws.apache.org
> >> 
> >> 
> >> 
> > 
> > 
> 
> -- 
> View this message in context:
> http://www.nabble.com/reading-SOAP-Message-at-the-webserver--tf4316530.html#a12293153
> Sent from the Axis - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: reading SOAP Message at the webserver?

Posted by Pushkar Bodas <pu...@gs.com>.
Sorry, It was supposed to be TCPMon...not TCSMon... :P

Pushkar Bodas wrote:
> 
> Hi Kerstin,
> 
> Try to use TCSMon to monitor your soap message
> [http://ws.apache.org/commons/tcpmon/]
> This will help you monitor the soap message exchange.
> 
> The soap message sent can be seen in the stub as you debug through the
> program...and also, if im not mistaken (as I use axis2, earlier I used
> axis), axis 1.4 provides a Soap Monitor functionality, im not too sure
> though how it works.
> 
> thanks and regards,
> Pushkar
> 
> 
> Sindara.K wrote:
>> 
>> Hi all!
>> 
>> I'm new to Axis and I'm sorry if my question sounds silly...
>> 
>> I developed a webservice with Axis 1.4 and Java. Furthermore I wrote a
>> Client to access this webserver. 
>> What I'm supposed to do now is to examine the SOAP Body, if it really
>> contains the message that is contained and to validate the message for my
>> purposes. So I would like to read the XML of the SOAP Body. Is that
>> possible? How can I do this?
>> 
>> Some more information:
>> I created the webservice by writing the wsdl-document and then using the
>> wsdl2java command for creating the java classes.
>> 
>> An excerpt of my client code:
>> 
>> RetManService service = new RetManServiceLocator();
>> RetMan stub;
>> try {
>>     stub = service.getretMan();
>>     result = stub.search(query);
>> ...
>> }
>> 
>> An excerpt of my webserver code:
>> 
>> public class RetManSOAPBindingImpl implements retrievalJava.RetMan{
>>     public MQueryType search(MQueryType queryType) throws RemoteException
>> {
>>     ...
>>     }
>> }
>> 
>> Thanks in advance for your help!
>> 
>> Kerstin
>> 
>> -- 
>> Psssst! Schon vom neuen GMX MultiMessenger gehört?
>> Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/reading-SOAP-Message-at-the-webserver--tf4316530.html#a12293153
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: reading SOAP Message at the webserver?

Posted by Pushkar Bodas <pu...@gs.com>.
Hi Kerstin,

Try to use TCSMon to monitor your soap message
[http://ws.apache.org/commons/tcpmon/]
This will help you monitor the soap message exchange.

The soap message sent can be seen in the stub as you debug through the
program...and also, if im not mistaken (as I use axis2, earlier I used
axis), axis 1.4 provides a Soap Monitor functionality, im not too sure
though how it works.

thanks and regards,
Pushkar


Sindara.K wrote:
> 
> Hi all!
> 
> I'm new to Axis and I'm sorry if my question sounds silly...
> 
> I developed a webservice with Axis 1.4 and Java. Furthermore I wrote a
> Client to access this webserver. 
> What I'm supposed to do now is to examine the SOAP Body, if it really
> contains the message that is contained and to validate the message for my
> purposes. So I would like to read the XML of the SOAP Body. Is that
> possible? How can I do this?
> 
> Some more information:
> I created the webservice by writing the wsdl-document and then using the
> wsdl2java command for creating the java classes.
> 
> An excerpt of my client code:
> 
> RetManService service = new RetManServiceLocator();
> RetMan stub;
> try {
>     stub = service.getretMan();
>     result = stub.search(query);
> ...
> }
> 
> An excerpt of my webserver code:
> 
> public class RetManSOAPBindingImpl implements retrievalJava.RetMan{
>     public MQueryType search(MQueryType queryType) throws RemoteException
> {
>     ...
>     }
> }
> 
> Thanks in advance for your help!
> 
> Kerstin
> 
> -- 
> Psssst! Schon vom neuen GMX MultiMessenger gehört?
> Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/reading-SOAP-Message-at-the-webserver--tf4316530.html#a12292934
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org