Hi,

I have come across an interesting (bug?) in Axiom. As I am still new to
Axis, I wanted to know others thoughts before I went around making
patches in critical components, as it may have far reaching consequences
that I am not aware of yet.

I enabled REST support and in an attempt to trace code paths, I set up a
simple example with the "echo" service. The payload sent to the server
contains a <Text>sdf</Text> element, and the server is expected to
change this to <Text>Changed by service</Text>.

I noticed that the payload sent was correct, but what the server sent
back was <Text>sdfChanged by service</Text>. So I checked it out to see
why that "sdf" was still there. Here is what is happening:

HTTPTransportUtils.createEnvelopeFromGetRequest() calls
omEle.setText(value)

omEle is an OMElement. In OMElement.setText(), there is the line:

this.addChild(OMAbstractFactory.getOMFactory().createText(this, text));

This is causing a duplicate entry because OMFactory.createText() creates
an OMTextImpl (which extends OMNodeImpl), and OMNodeImpl's constructor
has a call to addChild() on the parent.

Thus, in short, setText() calls createText() which causes the text
element to be added as a child to the parent, and then further down,
setText() calls addChild() explicitly, causing the text child to be
added again. This is why that "sdf" was showing up in the response
message, because only the first "sdf" node was being removed when I
called setText() on server side.

I was thinking of removing the explicit addChild() call in setText().
This seems to be a workable solution with no side-effects. Does anyone
who knows the code better, know if this may break anything?

Thanks,
Deepak

Reply via email to