axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dimuthu Leelarathne" <muthu...@opensource.lk>
Subject Re: Reconstructing a SOAP reply -- Pls help
Date Sat, 06 Dec 2003 04:05:49 GMT
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




Mime
View raw message