You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Jon Carmignani <jc...@rhinocorps.com> on 2006/08/18 00:12:41 UTC

handleResponse cannot access message data

When I am running Axis 1.3 and trying to use message handlers.  The
point of my message handlers is to calculate the amount of overhead in
the XML messages I am sending.  To this end, I am taking a very simple
view of what is necessary data, and what is overhead: everything in tags
(< and >) is overhead and all text in between is useful data.

In case this helps, I am using document literal wrapped style SOAP messages.

In order to calculate the entire document size, I simply cast the
MessageContext that comes into the handler as a SOAPMessageContext, call
the getMessage method on that, send it to a ByteArrayOutputStream using
the writeTo method, and call the size method on that stream.

Calculating the size of the text in between elements uses a recursive
algorithm to traverse the document tree.  I simply recursively expand
any nodes that are an instance of SOAPElement until I reach a Text
node.  Once I reach a Text node, I propagate the length of that string
up the tree, summing the whole way.

I use this same algorithm on both request and response sides.  The
request is extremely simple, so I have no problem calculating the size
there, but the response seems to simply quit traversing the document
tree once it gets to a node that is a holder class for wrapper-style
parameter passing.  It also never recognizes that a node is an instance
of a Text node.

This would seem to be an issue with the handler implementation code at
first glance.  However, I used TCPMon to send exactly the same message
to the web service, knowing full well that the service will choke on its
format.  The issue here, however, is that the handler code executes
first and doesn't care about its format aside from the fact that it is
SOAP compatible.  Now, the same message coming in and being handled by
handleRequest instead of handleResponse traverses the full document tree
and sums up the Text nodes correctly.

This same thing happens regardless of the size of either request or
response message.  Is this a known issue with my version of Axis?  Am I
doing something completely wrong?  I can provide code and sample data if
necessary.  I am reluctant to do so here because there are so many
interacting pieces.

Thank you in advance for any assistance you can offer.

Jon Carmignani


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


Re: handleResponse cannot access message data

Posted by Jon Carmignani <jc...@rhinocorps.com>.
Jon Carmignani wrote:
> When I am running Axis 1.3 and trying to use message handlers.  The
> point of my message handlers is to calculate the amount of overhead in
> the XML messages I am sending.  To this end, I am taking a very simple
> view of what is necessary data, and what is overhead: everything in tags
> (< and >) is overhead and all text in between is useful data.
>
> In case this helps, I am using document literal wrapped style SOAP 
> messages.
>
> In order to calculate the entire document size, I simply cast the
> MessageContext that comes into the handler as a SOAPMessageContext, call
> the getMessage method on that, send it to a ByteArrayOutputStream using
> the writeTo method, and call the size method on that stream.
>
> Calculating the size of the text in between elements uses a recursive
> algorithm to traverse the document tree.  I simply recursively expand
> any nodes that are an instance of SOAPElement until I reach a Text
> node.  Once I reach a Text node, I propagate the length of that string
> up the tree, summing the whole way.
>
> I use this same algorithm on both request and response sides.  The
> request is extremely simple, so I have no problem calculating the size
> there, but the response seems to simply quit traversing the document
> tree once it gets to a node that is a holder class for wrapper-style
> parameter passing.  It also never recognizes that a node is an instance
> of a Text node.
>
> This would seem to be an issue with the handler implementation code at
> first glance.  However, I used TCPMon to send exactly the same message
> to the web service, knowing full well that the service will choke on its
> format.  The issue here, however, is that the handler code executes
> first and doesn't care about its format aside from the fact that it is
> SOAP compatible.  Now, the same message coming in and being handled by
> handleRequest instead of handleResponse traverses the full document tree
> and sums up the Text nodes correctly.
>
> This same thing happens regardless of the size of either request or
> response message.  Is this a known issue with my version of Axis?  Am I
> doing something completely wrong?  I can provide code and sample data if
> necessary.  I am reluctant to do so here because there are so many
> interacting pieces.
>
> Thank you in advance for any assistance you can offer.
>
> Jon Carmignani
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org


In addition to the above, I tried extending the BasicHandler class 
instead of GenericHandler, and overrode the invoke method in there.  I 
made no discrimination between request and response messages in this 
method.  I finally modified the server-config.wsdd file as required and 
tried again.  I get the exact same lack of functionality as before.

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