
Originally Posted by
poutsma
Have tried marshalling to a DOM document? Basically, it could be a bug in the DOM code of Castor.
I tried to marshal to a DOMResult as you suggested and got the following exception...
Code:
java.lang.IllegalArgumentException: DOMResult does not contain Node
at org.springframework.util.Assert.notNull(Assert.java:113)
at org.springframework.oxm.AbstractMarshaller.marshalDomResult(AbstractMarshaller.java:203)
at org.springframework.oxm.AbstractMarshaller.marshal(AbstractMarshaller.java:100)
at com.habuma.poker.webservice.EvaluateHandEndpoint.invokeInternal(EvaluateHandEndpoint.java:25)
at com.habuma.poker.webservice.MyMarshallingEndpoint.invoke(MyMarshallingEndpoint.java:35)
... { cut for brevity's sake }
Then I changed the way I create the DOMResult to:
Code:
Document document = new CoreDocumentImpl();
DOMResult domResult = new DOMResult(document);
This got me past the exception. Then I walked the DOM...everything appears to be in place in the DOM...which leads me to believe that it marshalled correctly. But the result I got back on the client was the bogus XML I showed in the original forum post. (I confirmed this by using tcpmon to intercept the response.)
I then tried to walk the DOM of the payload result's node and it gave me nothing. It was as if there were no elements in the result.
Again, from all appearances, Castor is marshalling the object correctly...marshalling to a StreamResult or a DOMResult that I create backs this up. But it doesn't seem to work when marshalling to the payload result.
Any more clues?