views:

50

answers:

0

I got this example code from a website, can I get the parameter input value and response return value from handleMessage also? in this example i can only get the method name. (Method being called)

public boolean handleMessage(SOAPMessageContext context) {

    // get the SOAPMessageContext
    SOAPMessageContext sctx = (SOAPMessageContext)context;

    // retrieve SOAP message from the context
    SOAPMessage sm = sctx.getMessage();

    // variable for soap body
    SOAPBody sb = null;
    try {
        // get soap body from soap message
        sb = sm.getSOAPBody();

        // get all child nodes of soap body element
        NodeList nl = sb.getChildNodes();
        // iterate through child elements
        for (int i = 0; i < nl.getLength(); i++) {
            //get the node
            Node node = (Node)nl.item(i);

            // get the soap element
            if (node instanceof SOAPElement) {
                SOAPElement se = (SOAPElement)node;

                // get the name of operation being performed
                String operationName = se.getLocalName();
                System.out.println(operationName);
            }
        }            
    } // catch any exceptions
    catch (SOAPException ex) {
        System.out.println(ex.getMessage());
    }return true; }