RPCProvider's getBody does not work for SOAPBodyElement with null parameter 
argument
------------------------------------------------------------------------------------

                 Key: AXIS-2734
                 URL: https://issues.apache.org/jira/browse/AXIS-2734
             Project: Axis
          Issue Type: Bug
          Components: Basic Architecture
    Affects Versions: 1.4
         Environment: JDK 1.4, Win XP
            Reporter: Akitoshi Yoshida
             Fix For: current (nightly)


org.apache.axis.providers.java.RPCProvider's getBody is suposed to return an 
RPCElement.
When the actual SOAP body contains the plain SOAPBodyElement and not the 
RPCElement, it instantiates an RPCElement with the content of the 
SOAPBodyElement. But this code does not work when the operation has no 
parameter, as param is returned as null to skip the body creation block.

            if (!(bodies.get(bNum) instanceof RPCElement)) {
                SOAPBodyElement bodyEl = (SOAPBodyElement) bodies.get(bNum);
                // igors: better check if bodyEl.getID() != null
                // to make sure this loop does not step on SOAP-ENC objects
                // that follow the parameters! FIXME?
                if (bodyEl.isRoot() && operation != null && bodyEl.getID() == 
null) {
                    ParameterDesc param = operation.getParameter(bNum);
                    // at least do not step on non-existent parameters!
                    if (param != null) {
                        Object val = 
bodyEl.getValueAsType(param.getTypeQName());
                        body = new RPCElement("",
                                              operation.getName(),
                                              new Object[]{val});
                    }
                }
            } else {


In order to fix this problem, the above code needs to be modified to:

            if (!(bodies.get(bNum) instanceof RPCElement)) {
                SOAPBodyElement bodyEl = (SOAPBodyElement) bodies.get(bNum);
                // igors: better check if bodyEl.getID() != null
                // to make sure this loop does not step on SOAP-ENC objects
                // that follow the parameters! FIXME?
                if (bodyEl.isRoot() && operation != null && bodyEl.getID() == 
null) {
                    ParameterDesc param = operation.getParameter(bNum);
                    // at least do not step on non-existent parameters!
                    QName qname = operation.getElementQName();
                    if (param != null) {
                        Object val = 
bodyEl.getValueAsType(param.getTypeQName());
                        body = new RPCElement(qname.getNamespaceURI(),
                                              qname.getLocalPart(),
                                              new Object[]{val});
                    }  else {
                        body = new RPCElement(qname.getNamespaceURI(),
                                              qname.getLocalPart(),
                                              new Object[]{});
                    }
                }
            } else {


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to