dev@jax-ws.java.net

Re: Prefix cannot be null

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 21 Aug 2006 16:45:01 +0200

Hi Arun,

Grr... i got the parameters mixed up for the
XMLStreamWriter.writeStartElement method. I do not find the various
writeStartElement method consistent with the order of parameters, and
have made such a mistake a couple of times.

I was so confident that the fix would work i did not run some tests,
sorry! This time i verified that the roundtrip tests passed.

I have committed another update to the rearch branch.

Paul.

Arun Gupta wrote:
> Hi Paul,
>
> I pulled the latest jar in MR 2.1 branch and now I'm getting the
> following exception:
>
> javax.xml.stream.XMLStreamException: xmlns has been already bound to To.
> Rebinding it to http://www.w3.org/2005/08/addre
> ssing is an error
> at
> com.sun.xml.stream.writers.XMLStreamWriterImpl.writeDefaultNamespace(XMLStreamWriterImpl.java:790)
>
> at
> javanet.staxutils.StreamWriterDelegate.writeDefaultNamespace(StreamWriterDelegate.java:124)
>
> at
> com.sun.xml.stream.buffer.stax.StreamWriterBufferProcessor.writeNamespaceAttributes(StreamWriterBufferProcess
>
> or.java:362)
> at
> com.sun.xml.stream.buffer.stax.StreamWriterBufferProcessor.writeAttributes(StreamWriterBufferProcessor.java:3
>
> 37)
> at
> com.sun.xml.stream.buffer.stax.StreamWriterBufferProcessor.writeFragmentNoEx(StreamWriterBufferProcessor.java
>
> :262)
> at
> com.sun.xml.stream.buffer.stax.StreamWriterBufferProcessor.writeFragment(StreamWriterBufferProcessor.java:124
>
> )
> at
> com.sun.xml.stream.buffer.stax.StreamWriterBufferProcessor.process(StreamWriterBufferProcessor.java:55)
>
> at
> com.sun.xml.stream.buffer.XMLStreamBuffer.writeToXMLStreamWriter(XMLStreamBuffer.java:219)
>
> at
> com.sun.xml.ws.message.stream.StreamHeader.writeTo(StreamHeader.java:219)
> at
> com.sun.xml.ws.message.stream.StreamMessage.writeEnvelope(StreamMessage.java:240)
>
> at
> com.sun.xml.ws.message.stream.StreamMessage.writeTo(StreamMessage.java:223)
> at com.sun.xml.ws.util.pipe.DumpPipe.dump(DumpPipe.java:111)
> at com.sun.xml.ws.util.pipe.DumpPipe.process(DumpPipe.java:95)
> at
> com.sun.xml.ws.addressing.WsaClientPipe.process(WsaClientPipe.java:59)
> at
> com.sun.xml.ws.protocol.soap.ClientMUPipe.process(ClientMUPipe.java:58)
> at com.sun.xml.ws.handler.HandlerPipe.process(HandlerPipe.java:107)
> at com.sun.xml.ws.handler.HandlerPipe.process(HandlerPipe.java:107)
> at com.sun.xml.ws.client.Stub.process(Stub.java:123)
> at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:122)
> at
> com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:238)
>
> at
> com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:212)
>
> at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:105)
> at $Proxy28.addNumbers(Unknown Source)
>
> -Arun
>
> Paul Sandoz wrote:
>> Hi Arun,
>>
>> This is a problem in streambuffer and the StreamWriterBufferProcessor.
>>
>> Elements with default namespace declarations were being written
>> incorrectly i.e. without a prefix and SJSXP did not know how to bind
>> the namespace of the element.
>>
>> A fix is committed and the new jars are in JAX-WS rearch-2005 branch.
>>
>> Paul.
>>
>> Arun Gupta wrote:
>>> For the following response message received at the client:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
>>> <S:Header>
>>> <To
>>> xmlns="http://www.w3.org/2005/08/addressing">http://www.w3.org/2005/08/addressing/anonymous</To>
>>>
>>> <Action
>>> xmlns="http://www.w3.org/2005/08/addressing">http://example.com/AddNumbersPortType/addNumbersResponse</Action>
>>>
>>> </S:Header>
>>> <S:Body>
>>> <addNumbersResponse xmlns="http://example.com/">
>>> <return>20</return>
>>> </addNumbersResponse>
>>> </S:Body>
>>> </S:Envelope>
>>>
>>> I'm getting the following exception only if logging is turned on:
>>>
>>> javax.xml.stream.XMLStreamException: Prefix cannot be null
>>> at
>>> com.sun.xml.stream.writers.XMLStreamWriterImpl.writeStartElement(XMLStreamWriterImpl.java:1288)
>>>
>>> at
>>> com.sun.xml.stream.writers.XMLStreamWriterImpl.writeStartElement(XMLStreamWriterImpl.java:1266)
>>>
>>> at
>>> javanet.staxutils.StreamWriterDelegate.writeStartElement(StreamWriterDelegate.java:115)
>>>
>>> at
>>> javanet.staxutils.IndentingXMLStreamWriter.writeStartElement(IndentingXMLStreamWriter.java:209)
>>>
>>> at
>>> com.sun.xml.stream.buffer.stax.StreamWriterBufferProcessor.writeFragmentNoEx(StreamWriterBufferProcessor.java
>>>
>>> :261)
>>> at
>>> com.sun.xml.stream.buffer.stax.StreamWriterBufferProcessor.writeFragment(StreamWriterBufferProcessor.java:124
>>>
>>> )
>>> at
>>> com.sun.xml.stream.buffer.stax.StreamWriterBufferProcessor.process(StreamWriterBufferProcessor.java:55)
>>>
>>> at
>>> com.sun.xml.stream.buffer.XMLStreamBuffer.writeToXMLStreamWriter(XMLStreamBuffer.java:219)
>>>
>>> at
>>> com.sun.xml.ws.message.stream.StreamHeader.writeTo(StreamHeader.java:219)
>>>
>>> at
>>> com.sun.xml.ws.message.stream.StreamMessage.writeEnvelope(StreamMessage.java:240)
>>>
>>> at
>>> com.sun.xml.ws.message.stream.StreamMessage.writeTo(StreamMessage.java:223)
>>>
>>> at com.sun.xml.ws.util.pipe.DumpPipe.dump(DumpPipe.java:111)
>>> at com.sun.xml.ws.util.pipe.DumpPipe.process(DumpPipe.java:95)
>>> at
>>> com.sun.xml.ws.addressing.WsaClientPipe.process(WsaClientPipe.java:59)
>>> at
>>> com.sun.xml.ws.protocol.soap.ClientMUPipe.process(ClientMUPipe.java:58)
>>> at
>>> com.sun.xml.ws.handler.HandlerPipe.process(HandlerPipe.java:107)
>>> at
>>> com.sun.xml.ws.handler.HandlerPipe.process(HandlerPipe.java:107)
>>> at com.sun.xml.ws.client.Stub.process(Stub.java:123)
>>> at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:122)
>>> at
>>> com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:238)
>>>
>>> at
>>> com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:212)
>>>
>>> at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:105)
>>> at $Proxy27.addNumbers(Unknown Source)
>>>
>>> If message dump is not turned on, then the test passes. This is in
>>> the MR branch (mr-21) of JAX-WS. I do have the latest
>>> streambuffer.jar from rearch-2005.
>>>
>>> Thanks,
>>> -Arun
>>>
>>>
>>
>

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109