axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Schalk Neethling <sch...@volume4.com>
Subject Re: XMLStreamException
Date Thu, 14 Dec 2006 21:45:29 GMT
Greetings Javier,

If you could send me the skeleton code that would be very helpful. Thanks!

Javier Kohen wrote:
> El jue, 14-12-2006 a las 23:09 +0200, Schalk Neethling escribió:
>   
>> Hi there everyone,
>>
>> My apologies beforehand for the large amount of code etc. I am new to 
>> Axis2 and I am currently implementing a web service. All is going well 
>> except when executing the code below I get the following error:
>>
>> INFO  - [org.apache.commons.httpclient.HttpMethodDirector] - I/O 
>> exception (org.apache.axis2.AxisFault) caught when processing request: 
>> Can not output XML declaration, after other output has already been 
>> done.; nested exception is:
>>     javax.xml.stream.XMLStreamException: Can not output XML declaration, 
>> after other output has already been done.
>>     
>
> I've seen this just yesterday myself.
>
>   
>>             SOAPBody body = factory.createSOAPBody(envelope);
>>             OMElement send = factory.createOMElement("Send", ns);
>>     
> [ Lots of code removed. ]
>   
>>             body.addChild(send);
>>             ServiceClient sender = new ServiceClient();
>>             sender.setOptions(options);
>>             OMElement result = sender.sendReceive(envelope);
>>     
>
> The solution is to pass sendReceive the send element directly; don't
> pass it the envelope and body elements. SendReceive ends up
> unconditionally wrapping the supplied OMElement within a body element.
> Note that you can still set headers this way, by means of the
> ServiceClient instance.
>
> In my case, I needed to add two elements to the body, so I had to create
> the whole envelope and use the OperationClient interface instead to run
> the operation. I can give you skeleton code to do that, in case you need
> it, it's only slightly more complex than the above.
>
> Greetings,
>   

-- 
Kind Regards
Schalk Neethling
Developer.President
AlliedBridge
Landlines
Tel: +27125468436
Fax: +21(0)865122050

Web
email:info@alliedbridge.com
Global: www.alliedbridge.com

Messenger
Yahoo!: v_olume4
AOL: v0lume4
MSN: volume4_@hotmail.com

We support OpenSource and Standards
OSI - http://www.opensource.org/
Get Firefox!- The browser reloaded - http://www.mozilla.org/products/firefox/ 

The information transmitted is intended solely for the individual or entity to which it is
addressed and may contain confidential and/or privileged material. Any review, retransmission,
dissemination or other use of or taking action in reliance upon this information by persons
or entities other than the intended recipient is prohibited. If you have received this email
in error, please contact the sender and please delete all traces of this material from all
devices.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message