Hi Xinjun, We can not fix any bugs in releases (unfortunately). But I fixed that in the latest svn head. So you need to build against the current svn. Do not worry, checking out Axis2 sources and building it is very simple, as we have maven as our build tool.
(But in case, if you get any problems, please ask it here ;) )
-- Chinthaka
Xinjun Chen wrote:
> Hi Eran,
>
> Thank you!
> Did you fix the bug in Axis2 0.94 or 0.95? I am using Axis2 0.94. Must
> I upgrade to 0.95?
>
> Regards,
> Xinjun
>
> On 4/6/06, Eran Chinthaka <[EMAIL PROTECTED]> wrote:
>> 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.
>>>
>>> envelope.getBody().insertSiblingBefore(headerElm);
>>>
>>> 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.
>>>
>>> Regards,
>>> Xinjun
>>>
>>> On 4/5/06, Xinjun Chen <[EMAIL PROTECTED]> 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 <SOAP-ENV:Envelope>.
>>>>
>>>> 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 = Axis2Util.getDocumentFromSOAPEnvelope(envelope);
>>>> WSSAddUsernameToken builder = 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 = (Element)
>>>> (domDoc.getElementsByTagName("wsse:Security").item(0));
>>>> OMElement headerElm = (OMElement) (Axis2Util.toOM(header));
>>>> SOAPFactory factory = Axis2Util.getSOAPFactory(envelope);
>>>> factory.createSOAPHeader(envelope);
>>>> envelope.getHeader().addChild(headerElm);
>>>> }
>>>>
>>>> 2): The original soap envelope:
>>>>
>>>> <?xml version='1.0' encoding='utf-8'?><SOAP-ENV:Envelope
>>>> xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>>> <SOAP-ENV:Body>
>>>> <sayHello xmlns="http://services/helloworld">
>>>> <value>Hello world!</value>
>>>> </sayHello>
>>>> </SOAP-ENV:Body>
>>>> </SOAP-ENV:Envelope>
>>>>
>>>> 3): The processed soap envelope:
>>>>
>>>> <?xml version='1.0' encoding='utf-8'?><SOAP-ENV:Envelope
>>>> xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>>> <SOAP-ENV:Body>
>>>> <sayHello xmlns="http://services/helloworld">
>>>> <value>Hello world!</value>
>>>> </sayHello>
>>>> </SOAP-ENV:Body>
>>>> <SOAP-ENV:Header><wsse:Security
>>>> xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
>>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>>> <wsse:UsernameToken><wsse:Username>xinjun</wsse:Username><wsse:Password
>>>> Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</wsse:Password></wsse:UsernameToken></wsse:Security></SOAP-ENV:Header></SOAP-ENV:Envelope>
>>>>
>>
>>
>>
>>
>
signature.asc
Description: OpenPGP digital signature
