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 Mark <ma...@yahoo.com> on 2003/12/05 17:10:52 UTC

Reconstructing a SOAP reply -- Pls help

Hi
I have a SOAP client which uses my own provider. In the provider I call another method - not through the method.invoke but through other means. But I want to send the reply through a SOAP msg. So is there a way for me to add the return value into the SOAP msg and reconstruct the SOAP reply msg? Can I use messageContext for that? Can someon pls point me to code samples?
 
 
 
thanks
Mark


---------------------------------
Do you Yahoo!?
Free Pop-Up Blocker - Get it now

Passing info on SOAP header

Posted by Mark <ma...@yahoo.com>.
Hi
How do I pass info on soap header ? I need to pass some info and want to be able to retrieve it from a provider...Pls guide me to some sample code...

Dimuthu Leelarathne <mu...@opensource.lk> wrote:
Hi Mark,

You can do the same thing as we did, when we implemented AxisMora.

Let's call what you return from your web service as "ReturnValue".

Step 1:: Register your result in the "DefaultTypeMappingImpl"

In "org.apache.axis.encoding.DefaultTypeMappingImpl" you have to register
the your "ResultValue" object.

For example, in our AxisMora, all the web services return values that
implement the "org.apache.axismora.encoding.Serializable.java". We have
written the following code in the DefaultTypeMappingImpl.

myRegister(org.apache.axismora.Constants.SOAP_RESULT,
org.apache.axismora.encoding.Serializable.class,
new org.apache.axismora.encoding.SerializableSerializerFactory(),
null);

You can look at the code at;
http://cvs.apache.org/viewcvs.cgi/ws-axis/contrib/axismora/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java

Step 2:: Set the "ResultValue" to the SOAPBody as below,

SOAPBodyElement bo = new SOAPBodyElement();
bo.setObjectValue(this.resultValue);

Then you have to set this SOAPBody to SOAPEnvelope and call the
"output(SerializationContext )" method of the SOAP envelope and flush the
writer you have set in the SerializationContext.

You can look at;
http://cvs.apache.org/viewcvs.cgi/ws-axis/contrib/axismora/src/org/apache/axismora/soap/BasicMessageContext.java

There should be slight variations from this mehtod, because we keep
soapHeaders and bodies seprately, but basically Axis keeps them together.
But this method shows you basically that you have to do.

Best Regards,
Dimuthu.
-- 
Lanka Software Foundation http://www.opensource.lk

> Hi
> I have a SOAP client which uses my own provider. In the provider I call
> another method - not through the method.invoke but through other means.
> But I want to send the reply through a SOAP msg. So is there a way for
> me to add the return value into the SOAP msg and reconstruct the SOAP
> reply msg? Can I use messageContext for that? Can someon pls point me to
> code samples?
>
>
>
> thanks
> Mark
>
>
> ---------------------------------
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now




---------------------------------
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

Re: Reconstructing a SOAP reply -- Pls help

Posted by Dimuthu Leelarathne <mu...@opensource.lk>.
Hi Mark,

You can do the same thing as we did, when we implemented AxisMora.

Let's call what you return from your web service as "ReturnValue".

Step 1:: Register your result in the "DefaultTypeMappingImpl"

In  "org.apache.axis.encoding.DefaultTypeMappingImpl" you have to register
the your "ResultValue" object.

For example, in our AxisMora, all the web services return values that
implement the  "org.apache.axismora.encoding.Serializable.java". We have
written the following code in the DefaultTypeMappingImpl.

myRegister(org.apache.axismora.Constants.SOAP_RESULT,
	org.apache.axismora.encoding.Serializable.class,
    new org.apache.axismora.encoding.SerializableSerializerFactory(),
					null);

You can look at the code at;
http://cvs.apache.org/viewcvs.cgi/ws-axis/contrib/axismora/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java

Step 2:: Set the "ResultValue" to the SOAPBody as below,

         SOAPBodyElement bo = new SOAPBodyElement();
         bo.setObjectValue(this.resultValue);

Then you have to set this SOAPBody to SOAPEnvelope and call the
"output(SerializationContext )" method of the SOAP envelope and flush the
writer you have set in the SerializationContext.

You can look at;
http://cvs.apache.org/viewcvs.cgi/ws-axis/contrib/axismora/src/org/apache/axismora/soap/BasicMessageContext.java

There should be slight variations from this mehtod, because we keep
soapHeaders and bodies seprately, but basically Axis keeps them together.
But this method shows you basically that you have to do.

Best Regards,
Dimuthu.
-- 
Lanka Software Foundation  http://www.opensource.lk

> Hi
> I have a SOAP client which uses my own provider. In the provider I call
> another method - not through the method.invoke but through other means.
> But I want to send the reply through a SOAP msg. So is there a way for
> me to add the return value into the SOAP msg and reconstruct the SOAP
> reply msg? Can I use messageContext for that? Can someon pls point me to
> code samples?
>
>
>
> thanks
> Mark
>
>
> ---------------------------------
> Do you Yahoo!?
> Free Pop-Up Blocker - Get it now




RE: Reconstructing a SOAP reply -- Plsss help

Posted by chris <ch...@cobia.net>.
Obj3 represents the return value from the actual 'service agent'
performing the work.. If you have a return value after executing the
code or component performing the real work, you simply need to stuff the
return value into the envelope as XML.  There are two approaches:

 

The MsgProvider just attaches SOAPBody elements to a SOAPEnvelope....   

 

 

In the RPCProvider use case, note that RPCElement is added to the
SOAPEnvelope.  The embedded RPCParam objects hold the return values.
RPCParam contains a serialize() method detailing how to take an object
and generate XML.  **Of course, the correct type mappings have to be
defined in WSDD if you are not using built-in types *** 

 

/Chris

 

 

 

-----Original Message-----
From: Mark [mailto:mark_ai@yahoo.com] 
Sent: Friday, December 05, 2003 2:31 PM
To: axis-user@ws.apache.org
Subject: RE: Reconstructing a SOAP reply -- Plsss help

 

Chris, Thanks a lot for your reply, I had a look at the RPCprovider. a
call is made to invokemethod which returns obj3. This obj3 is used to
construct the soap msg. But in my case I dont call invokemethod and I
have the return value. So how do I construct the object (obj3) ?

 

obj3 = invokeMethod(messagecontext, operationdesc.getMethod(), obj,
aobj);

chris <ch...@cobia.net> wrote:

Mark -  Look at the existing providers in org.apache.axis.providers to
see how they craft the response message.  processMessage() in
MsgProvider.java and the code after the /* Now put the result in the
result SOAPEnvelope */ comment in RPCProvider.java

        

 

/Chris

http://cvs.apache.org/~haddadc

 

 

 

-----Original Message-----
From: Mark [mailto:mark_ai@yahoo.com] 
Sent: Friday, December 05, 2003 12:40 PM
To: axis-user@ws.apache.org
Subject: Reconstructing a SOAP reply -- Plsss help

 

Can some one pls help me with this...any help would greatly be
appreciated..

Hi

I have a SOAP client which uses my own provider. In the provider I call
another method - not through the method.invoke but through other means.
But I want to send the reply through a SOAP msg. So is there a way for
me to add the return value into the SOAP msg and reconstruct the SOAP
reply msg? Can I use messageContext for that? Can someon pls point me to
code samples?

 

 

 

thanks

Mark


  _____  


Do you Yahoo!?
Free <http://us.rd.yahoo.com/slv/mailtag/*http:/companion.yahoo.com/>
Pop-Up Blocker - Get it now


  _____  


Do you Yahoo!?
Free <http://us.rd.yahoo.com/slv/mailtag/*http:/companion.yahoo.com/>
Pop-Up Blocker - Get it now

  _____  

Do you Yahoo!?
Free <http://us.rd.yahoo.com/slv/mailtag/*http:/companion.yahoo.com/>
Pop-Up Blocker - Get it now


RE: Reconstructing a SOAP reply -- Plsss help

Posted by Mark <ma...@yahoo.com>.
Chris, Thanks a lot for your reply, I had a look at the RPCprovider. a call is made to invokemethod which returns obj3. This obj3 is used to construct the soap msg. But in my case I dont call invokemethod and I have the return value. So how do I construct the object (obj3) ?
 
obj3 = invokeMethod(messagecontext, operationdesc.getMethod(), obj, aobj);

chris <ch...@cobia.net> wrote:

Mark -  Look at the existing providers in org.apache.axis.providers to see how they craft the response message.  processMessage() in MsgProvider.java and the code after the /* Now put the result in the result SOAPEnvelope */ comment in RPCProvider.java

        

 

/Chris

http://cvs.apache.org/~haddadc

 

 

 

-----Original Message-----
From: Mark [mailto:mark_ai@yahoo.com] 
Sent: Friday, December 05, 2003 12:40 PM
To: axis-user@ws.apache.org
Subject: Reconstructing a SOAP reply -- Plsss help

 

Can some one pls help me with this...any help would greatly be appreciated..

Hi


I have a SOAP client which uses my own provider. In the provider I call another method - not through the method.invoke but through other means. But I want to send the reply through a SOAP msg. So is there a way for me to add the return value into the SOAP msg and reconstruct the SOAP reply msg? Can I use messageContext for that? Can someon pls point me to code samples?


 


 


 


thanks


Mark


---------------------------------


Do you Yahoo!?
Free Pop-Up Blocker - Get it now


---------------------------------


Do you Yahoo!?
Free Pop-Up Blocker - Get it now



---------------------------------
Do you Yahoo!?
Free Pop-Up Blocker - Get it now

RE: Reconstructing a SOAP reply -- Plsss help

Posted by chris <ch...@cobia.net>.
Mark -  Look at the existing providers in org.apache.axis.providers to
see how they craft the response message.  processMessage() in
MsgProvider.java and the code after the /* Now put the result in the
result SOAPEnvelope */ comment in RPCProvider.java

        

 

/Chris

http://cvs.apache.org/~haddadc

 

 

 

-----Original Message-----
From: Mark [mailto:mark_ai@yahoo.com] 
Sent: Friday, December 05, 2003 12:40 PM
To: axis-user@ws.apache.org
Subject: Reconstructing a SOAP reply -- Plsss help

 

Can some one pls help me with this...any help would greatly be
appreciated..

Hi

I have a SOAP client which uses my own provider. In the provider I call
another method - not through the method.invoke but through other means.
But I want to send the reply through a SOAP msg. So is there a way for
me to add the return value into the SOAP msg and reconstruct the SOAP
reply msg? Can I use messageContext for that? Can someon pls point me to
code samples?

 

 

 

thanks

Mark

  _____  

Do you Yahoo!?
Free <http://us.rd.yahoo.com/slv/mailtag/*http:/companion.yahoo.com/>
Pop-Up Blocker - Get it now

  _____  

Do you Yahoo!?
Free <http://us.rd.yahoo.com/slv/mailtag/*http:/companion.yahoo.com/>
Pop-Up Blocker - Get it now


Reconstructing a SOAP reply -- Plsss help

Posted by Mark <ma...@yahoo.com>.
Can some one pls help me with this...any help would greatly be appreciated..

Hi
I have a SOAP client which uses my own provider. In the provider I call another method - not through the method.invoke but through other means. But I want to send the reply through a SOAP msg. So is there a way for me to add the return value into the SOAP msg and reconstruct the SOAP reply msg? Can I use messageContext for that? Can someon pls point me to code samples?
 
 
 
thanks
Mark


---------------------------------
Do you Yahoo!?
Free Pop-Up Blocker - Get it now


---------------------------------
Do you Yahoo!?
Free Pop-Up Blocker - Get it now