Return-Path: Delivered-To: apmail-ws-axis-user-archive@www.apache.org Received: (qmail 1872 invoked from network); 17 Nov 2004 14:44:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 17 Nov 2004 14:44:32 -0000 Received: (qmail 91346 invoked by uid 500); 17 Nov 2004 14:44:09 -0000 Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 91225 invoked by uid 500); 17 Nov 2004 14:44:08 -0000 Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-user@ws.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 91180 invoked by uid 99); 17 Nov 2004 14:44:07 -0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=HTML_30_40,HTML_MESSAGE,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [193.128.25.229] (HELO stvsfimr001.ggr.co.uk) (193.128.25.229) by apache.org (qpsmtpd/0.28) with ESMTP; Wed, 17 Nov 2004 06:44:02 -0800 Received: from stvsasmtp03.ggr.co.uk ([147.184.2.37]) by stvsfimr001.ggr.co.uk with ESMTP id iAHESgrO027518 for ; Wed, 17 Nov 2004 14:28:42 GMT Received: from ukz1098.ggr.co.uk (ukz1098.ggr.co.uk [147.184.4.17]) by stvsasmtp03.ggr.co.uk (Switch-3.1.7/Switch-3.1.7) with ESMTP id iAHEet9l008745 for ; Wed, 17 Nov 2004 14:43:51 GMT Received: from 147.184.2.6 by ukz1098.ggr.co.uk with ESMTP (Tumbleweed SMTP Relay); Wed, 17 Nov 2004 14:42:53 +0100 Received: from sbhsnsm1.sb.com (sbhsnsm1.sb.com [166.71.155.16]) by stvsasmtp01.ggr.co.uk (Switch-3.1.7/Switch-3.1.6) with ESMTP id iAHEhhJZ019665 for ; Wed, 17 Nov 2004 14:43:46 GMT In-Reply-To: <200411171417.iAHEHRc12412@sirio.tno.it> To: axis-user@ws.apache.org Subject: Re: R: Newbie info on messaging MIME-Version: 1.0 X-Mailer: Lotus Notes Release 6.0 September 26, 2002 Message-ID: From: tony.q.weddle@gsk.com Date: Wed, 17 Nov 2004 14:43:21 +0000 X-MIMETrack: Serialize by Router on SBHSNSM1/SERVERS/SB_PLC(Release 5.0.10 |March 22, 2002) at 17/11/2004 14:38:46, Serialize complete at 17/11/2004 14:38:46 X-WSS-ID: 6D85BCE72615978-01-01 Content-Type: multipart/alternative; boundary="=_alternative 0050E8B480256F4F_=" X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N This is a multipart message in MIME format. --=_alternative 0050E8B480256F4F_= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable The method, in your service, has two parameters. The second parameter is a = SOAPEnvelope, in which to put your response. You can get the body of the=20 element with: SOAPBody body =3D resp.getBody(); You can add a body element (this will be the root of your response message = XML) to the body using: SOAPBodyElement bodyElement =3D body.addBodyElement(new=20 PrefixedQName(yourNamespace, yourElementName, yourPrefix)); You'd also need to add namespace declarations to bodyElement, for the=20 namespace of the element itself and for any other namespaces you might use = in the response. Then you can add child element to the bodyElement, using=20 addChildElement(). You can add child elements to those child elements, and = so on. To add a header, use something like: header =3D new SOAPHeaderElement( yourHeaderNamespace,=20 yourHeaderElementName); resp.addHeader( header ); Obviously, you can add children to the header, in the same way as for the=20 body element. Hope this helps. Tony Hi I already saw the MessageService, but unfortunately it is quite far from=20 being useful. I want to put some application xml info into the header section of the=20 SOAPEnvelope and some other application xml info into the body section of=20 the SOAPEnvelope. I made a Message and I put some xml attachments into it, and it's ok. I cannot understand how to build a SOAPHeader and a SOAPBody to the=20 response envelope. =20 any clue? Cheers Marcello =20 Da: tony.q.weddle@gsk.com [mailto:tony.q.weddle@gsk.com]=20 Inviato: mercoled=EC 17 novembre 2004 12.20 A: axis-user@ws.apache.org Oggetto: Re: Newbie info on messaging Marcello,=20 I don't know about attachments, but you don't need to use the=20 MessageContext to add headers and body elements to the response. The=20 second parameter has the SOAP envelope that will be passed back to the=20 client and it already has a SOAP body. So you only need to add body=20 element to the SOAP body and add headers to the response SOAP envelope=20 (though headers are usually added in an Axis handler, not in the web=20 service itself).=20 Axis comes with sample services, so you may be able to find something in=20 there.=20 Tony Hi all I am quite new on axis. I have to implement a request/response service=20 (i.e. my service contains method(SOAPEnvelope req, SOAPEnvelope resp) ). I managed to build the client, send a SOAPEnvelope correctly, receive the envelope on the server. I wasn't able to create a response message using setHeader, setBody and addAttachment. I understand I have to use the MessageContext. Where can I find examples about this kind of issues? Cheers Marcello --=_alternative 0050E8B480256F4F_= Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable

The method, in your service, has two parameters. The seco= nd parameter is a SOAPEnvelope, in which to put your response. You can get the body of the element with:

SOAPBody body =3D resp.getBody();

You can add a body element (this will be the root of your response message XML) to the body using:

SOAPBodyElement bodyElement =3D body.addBodyElement(new P= refixedQName(yourNamespace, yourElementName, yourPrefix));

You'd also need to add namespace declarations to bodyElem= ent, for the namespace of the element itself and for any other namespaces you might use in the response. Then you can add child element to the bodyElemen= t, using addChildElement(). You can add child elements to those child elements, and so on.

To add a header, use something like:

header =3D new SOAPHeaderElement( yourHeaderNamespace, yo= urHeaderElementName);
resp.addHeader( header );

Obviously, you can add children to the header, in the same way as for the body element.

Hope this helps.

Tony


Hi
I already saw the MessageSer= vice, but unfortunately it is quite far from being useful.
I want to put some applicati= on xml info into the header section of the SOAPEnvelope and some other applica= tion xml info into the body section of the SOAPEnvelope.
I made a Message and I put s= ome xml attachments into it, and it's ok.
I cannot understand how to b= uild a SOAPHeader and a SOAPBody to the response envelope.
 
any clue?
Cheers
Marcello
 


Da: tony.q.weddle@gsk.com [mailto= :tony.q.weddle@gsk.com]
Inviato:
mercoled=EC 17 novembre 2004 12.20
A:
axis-user@ws.apache.org
Oggetto:
Re: Newbie info on messaging



Marcello,


I don't know about attachments, but you don't need to use the MessageContext to add headers and body elements to the response. The second parameter has the SOAP envelope that will be passed back to the client and it already has a SOAP body. So you only need to add body element to the SOAP body and add headers to the response SOAP envelope (though headers are usually added in an Axis handler, not in the web service itself).


Axis comes with sample services, so you may be able to find something in there.


Tony




Hi all
I am quite new on axis. I have to implement a request/response service (i.e.
my service contains method(SOAPEnvelope req, SOAPEnvelope resp) ).
I managed to build the client, send a SOAPEnvelope correctly, receive the envelope on the server.
I wasn't able to create a response message using setHeader, setBody and
addAttachment.
I understand I have to use the MessageContext.

Where can I find examples about this kind of issues?
Cheers
Marcello




--=_alternative 0050E8B480256F4F_=--