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 "Prasad C. Ranasinghe" <pr...@lk.opro.net> on 2003/10/06 13:19:16 UTC

Massage Style problem - Help

      I tried to use the following sinature for massage style, I found that
it is not working.
public void method(SOAPEnvelope req, SOAPEnvelope resp);

I just tried to return what I sent But I always get an empty body at the
client.

deployed code
----------------
public void method(SOAPEnvelope req, SOAPEnvelope resp){
resp = req;
}

request Sent
--------------
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Body>
<in:Report
xmlns:in="urn:OXS_Report"><Operation>dl</Operation><Format>o</Format><CharSe
t>Shift_JIS</CharSet><Templates><Template
name="sample"><Path>c:\templates\</Path><RequestParams><RequestParam><Name>{
prasad}</Name><Value>abcd</Value></RequestParam></RequestParams><DatasetPara
ms><DatasetParam></DatasetParam></DatasetParams><LayoutHideParams><LayoutHid
eParam></LayoutHideParam></LayoutHideParams></Template></Templates></in:Repo
rt></SOAP-ENV:Body></SOAP-ENV:Envelope>

the empty response
----------------------
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body/>
</soapenv:Envelope>

It works fine with the signature :
public Element[] method(Element[] request){
....
}

What could be the reason? I hope any woring exaple will help me with
signature,
  public void method(SOAPEnvelope req, SOAPEnvelope resp){}


Re: Massage Style problem - Help

Posted by Marcin Okraszewski <ok...@o2.pl>.
> public void method(SOAPEnvelope req, SOAPEnvelope resp){
> resp = req;
> }

And this is correct, that it doesn't work. You are changing reference of 
  resp, and so, you don't change the the output envelope. You can only 
change the object referenced by resp, not reference itself. So you can 
do something like that:

resp.addBody(req.getFirstBody());

(I'm not sure about methods - I don't have documentation here). The 
othre solution is use other method signature. This is correct:

public Document method(Document body) {
     return body;
}

But in this way you don't have access to SOAP Headers.

Regards,
Marcin

-- 
-------------------------------------------------------------
                       Marcin Okraszewski
okrasz@o2.pl                                       GG: 341942
okrasz@vlo.ids.gda.pl          PGP: www.okrasz.prv.pl/pgp.asc
-------------------------------------------------------------