axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Glenn Bech" <>
Subject Problem parsing/retrieving information from SOAPBody in a handler
Date Fri, 16 Dec 2005 00:34:03 GMT

I really hope someone can provide some insight on this as It's been driving
me crazy for a while. Short story; I can't seem to be able to retrieve the
elements of a SOAPBody from my "BasicHandler". 

I'm writing ha handler that works on a response message from a "LOGIN"

The task of the handler is to store an association between the returned
"SessionID" (Given from my "LOGIN" service) with the actual HTTP Session. 

Client will later send the Session ID in the SOAP Header, and its 
value get compared to the one associated with the HTTP Session. 

It's declared like this in my deploy.wssd.

            <handler name="StoreSession"
type="java:com.product.service.webservice.StoreSession" />

The Outgoiung SOAP Message looks like this ;

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv=""

My handler code looks like this. It is invoked, after the Pivot, but the
results are bizarre. When using the method getChildElements() in SOAPElement
to retrieve the content of the soap Body, the sessionId and baseSequenceId
are nowhere to be found (!) 

Instead it seems that the object hiearachy looks like this ;

SOAPBody  (1 child) 
|	- LoginResponse (has 1 child) 
		- LoginResponse (has 0 children)

---8< CODE SNIPPET -- 8 < --

Looking at my handler code ;
final SOAPPart sp = messageContext.getMessage().getSOAPPart();
final SOAPEnvelope spEnvelope = sp.getEnvelope();
final SOAPBody spBody = messageContext.getMessage().getSOAPBody();

Iterator i = spBody.getChildElements();
if (i.hasNext())
	log.debug("SOAPBody Element has child elements...");
SOAPBodyElement loginResponseElement = (SOAPBodyElement);
log.debug("First Child of SOAPBody should be LoginResponse. It is " +

i = loginResponseElement.getChildElements();
SOAPElement element = (SOAPElement);
log.debug("First Child of loginResponse element should be SessionID, it is
not! It is : " + element.getLocalName());

---8< CODE SNIPPET ENDS -- 8 < --

Output the following debug log 

- SOAPBody Element has child elements...
- First Child of SOAPBody should be LoginResponse. It is LoginResponse
- First Child of loginResponse element should be SessionID, it is not! It is
: LoginRespons

Am I Missing something very obvious here ? Bug ? 

Best regards, any help will be very welcome !!

glenn richard bech

View raw message