Return-Path: Delivered-To: apmail-ws-axis-user-archive@www.apache.org Received: (qmail 60895 invoked from network); 5 Apr 2006 16:07:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Apr 2006 16:07:22 -0000 Received: (qmail 15050 invoked by uid 500); 5 Apr 2006 16:07:08 -0000 Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 15001 invoked by uid 500); 5 Apr 2006 16:07: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: List-Id: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 14971 invoked by uid 99); 5 Apr 2006 16:07:08 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Apr 2006 09:07:08 -0700 X-ASF-Spam-Status: No, hits=0.3 required=10.0 tests=MAILTO_TO_SPAM_ADDR X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [209.68.5.15] (HELO relay01.pair.com) (209.68.5.15) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 05 Apr 2006 09:07:05 -0700 Received: (qmail 73978 invoked from network); 5 Apr 2006 16:06:11 -0000 Received: from unknown (HELO ?222.165.181.149?) (unknown) by unknown with SMTP; 5 Apr 2006 16:06:11 -0000 X-pair-Authenticated: 222.165.181.149 Message-ID: <4433EAE7.6040503@opensource.lk> Date: Wed, 05 Apr 2006 22:05:59 +0600 From: Eran Chinthaka Reply-To: chinthaka@opensource.lk User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: axis-user@ws.apache.org Subject: Re: Order of SOAPHeader and SOAPBody References: <84f31d220604042042s1613678ey10fc6eb709b56246@mail.gmail.com> <84f31d220604050311o4b80fa04l13adc63e6c7ce746@mail.gmail.com> In-Reply-To: <84f31d220604050311o4b80fa04l13adc63e6c7ce746@mail.gmail.com> X-Enigmail-Version: 0.94.0.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig5FE5E6EE49F3856EECD19495" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig5FE5E6EE49F3856EECD19495 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Xinjun, There was a known bug in SOAPEnvelope, which is the same pointed out also. I fixed it and now you can add SOAPHeader now to SOAPEnvelope and that will be added properly now. -- Chinthaka Xinjun Chen wrote: > I found a walk-around. >=20 > envelope.getBody().insertSiblingBefore(headerElm); >=20 > This will add the header OMElement into the envelope. However, the > Header added is only considered as a child element of envelope, not a > SOAPHeader. Thus if I call envelope.getHeader(), I will get exception. >=20 > Regards, > Xinjun >=20 > On 4/5/06, Xinjun Chen wrote: >> I am using the following function to add UsernameToken to my security >> header. But the processed envelope get some problems. >> 1. The Header is placed after the body. How can I insert SOAPHeader >> before SOAPBody? >> 2. The security header defines the xmlns:xsd and xmlns:xsi again, >> which have already been defined in . >> >> Could you give me some advice on how to solve the above two problems? >> >> Attached: >> >> 1) The function used for adding username token to the envelope: >> >> public void addUsernameTokens(UsernameToken token, final SOAPEnvelope >> envelope) throws Exception { >> Document domDoc =3D Axis2Util.getDocumentFromSOAPEnvelope(envelope)= ; >> WSSAddUsernameToken builder =3D new WSSAddUsernameToken("", false);= >> if (token.isDigested()) { >> builder.setPasswordType(WSConstants.PASSWORD_DIGEST); >> } else { >> builder.setPasswordTyp(WSConstants.PASSWORD_TEXT); >> } >> >> builder.build(domDoc, token.getUsername(), token.getPassword()); >> Element header =3D (Element) >> (domDoc.getElementsByTagName("wsse:Security").item(0)); >> OMElement headerElm =3D (OMElement) (Axis2Util.toOM(header)); >> SOAPFactory factory =3D Axis2Util.getSOAPFactory(envelope); >> factory.createSOAPHeader(envelope); >> envelope.getHeader().addChild(headerElm); >> } >> >> 2): The original soap envelope: >> >> > xmlns:SOAP-ENV=3D"http://www.w3.org/2003/05/soap-envelope" >> xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" >> xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"> >> >> >> Hello world! >> >> >> >> >> 3): The processed soap envelope: >> >> > xmlns:SOAP-ENV=3D"http://www.w3.org/2003/05/soap-envelope" >> xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" >> xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"> >> >> >> Hello world! >> >> >> > xmlns:wsse=3D"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-= wssecurity-secext-1.0.xsd" >> xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" >> xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"> >> xinjun> Type=3D"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-userna= me-token-profile-1.0#PasswordText">password >> >=20 --------------enig5FE5E6EE49F3856EECD19495 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFEM+rpjON2uBzUhh8RAhkAAKCShrmMjklH/aTzI+vjMcQ/PSOsEQCgqBCM rLOdhUowlTR9+cgwK+joNC8= =vOYc -----END PGP SIGNATURE----- --------------enig5FE5E6EE49F3856EECD19495--