My SAAJ-based client generates the following XML and sends it to a .NET web service:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<AuthenticationHeader xmlns="http://www.w3.org/2001/XMLSchema-instance">
<Password xmlns="http://schemas.datacontract.org/2004/07/">temp123</Password>
<UserName xmlns="http://schemas.datacontract.org/2004/07/">temp321</UserName>
</AuthenticationHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<GetTracks xmlns="http://tempuri.org/">
<TrackName>baby</TrackName><ArtistID>0</ArtistID><AlbumID>0</AlbumID><Start>0</Start><Count> 20</Count>
</GetTracks></SOAP-ENV:Body></SOAP-ENV:Envelope>
The problem I am experiencing is that for the AuthenticationHeader element I must have a prefix defined but it should not be appended to the very beginning. This is exactly what I need to get generated in order not to get an error from the web service:
<AuthenticationHeader xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
While if I generate a prefix during the Name creation, it is automatically added after the xmlns attribute and at the very beginning of the element.
I tried to poke around with the whole javax.xml.soap package but wasn't able to find anything that could help me to get around this. Can you give me a hint on which direction to go in order to get such an xml generated?
On a side note, I wonder if this is even valid behavior for a web service to reject valid xml like this? What is the motivation for such an interpretation behavior?
Thank you!