axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yashwanth Rajaram -X (yrajaram - Zensar at Cisco)" <yraja...@cisco.com>
Subject RE: [AXIS2] SOAPENVELOPE Parsing
Date Tue, 01 Feb 2011 00:05:32 GMT
Sardar:

 

I am not very sure but if I remember right to access the Header elements
you have to do :

SOAPHeaderBlock element =  ElementHelper.toSOAPHeaderBlock((OMElement)
headerElements.next(),soapFactory); // ie you can't access as OMElement

Then you can print using element.getText();

 

cheers,

--

Yashwanth

 

From: Sardar Hussain [mailto:salarzi_qau@yahoo.com] 
Sent: Monday, January 31, 2011 1:06 PM
To: axis-dev@ws.apache.org
Subject: [AXIS2] SOAPENVELOPE Parsing

 

Hi,

I am implementing a Handler where I need to catch and parse the
SOAPEnvelope from the MssageContext, however I am getting problem with
printing its nodes.

My code as as follows:


SOAPEnvelope env = messageContext.getEnvelope();
        
        
        Iterator bodyElements = env.getBody().getChildElements();
        Iterator headerElements = env.getHeader().getChildElements();

while (bodyElements.hasNext()) {

            OMElement element = (OMElement) bodyElements.next();
            if(element.getText()!=null)
                System.out.println("Body Elements \n  " +
element.getText());

            }

        while (headerElements.hasNext()){

            OMElement element = (OMElement) headerElements.next();
            if(element.getText()!=null)
                System.out.println("\n Header
Elements\n"+element.getText());
             
       }

When I print the SOAPEnvelope then I can print that and see however when
I iterate them as above in the code then Its empty and don't display
anything.

Any clue plz?

Sardar

 


Mime
View raw message