You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Guillaume Sauthier (JIRA)" <ax...@ws.apache.org> on 2004/12/06 14:23:23 UTC

[jira] Commented: (AXIS-1697) RPCParam.getValue() returns null

     [ http://nagoya.apache.org/jira/browse/AXIS-1697?page=comments#action_56256 ]
     
Guillaume Sauthier commented on AXIS-1697:
------------------------------------------

After further testing, I must admit that this works in really simple case only :)

Another example that fails (always from a JAXRPC client side Handler) : 
SOAPMessage
->SOAPPart
 ->SOApEnvelope
   ->SOAPBody
     ->* SOAPElement (operation)
       ->* SOAPElement (parameter)
         -> getChildElements() return an Iterator

The iterator returned is expected to be non-empty (because the SOAPElement contains a String), but as NodeImpl.childrens is never initialized, an empty Iterator is returned.

the SOAPElement of the parameter looks like this :
<String_1 xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">MyText</String_1>

That sounds reasonnable to expect a Text as first child.

In the client side, RPCParam is used only onced : when instanciated. Should the constructor build more (add chlidrens, ...) ?

> RPCParam.getValue() returns null
> --------------------------------
>
>          Key: AXIS-1697
>          URL: http://nagoya.apache.org/jira/browse/AXIS-1697
>      Project: Axis
>         Type: Bug
>   Components: Basic Architecture
>     Versions: 1.2RC2
>  Environment: JOnAS 4.2.0+
>     Reporter: Guillaume Sauthier
>  Attachments: axis-rpcparam-patch.txt
>
> I've got a JAXRPC client handler, that modify the SOAP Message in the request step. In order to do this, it navigate from the SOAPMessage of the MessageContext to the SOAPBody; iterates on the body childs SOAPElement (representing operation name), and for each operation, it iterates too on the operation childs elements (parameters).
> Finally, it invoke SOAPElement.getValue() on the parameter for retrieving the inner value of the param (wich is a String in my case). And this call return always null !
> Schematically :
> SOAPMessage
> ->SOAPPart
>  ->SOApEnvelope
>    ->SOAPBody
>      ->* SOAPElement (operation)
>        ->* SOAPElement (parameter)
>          -> getValue() (=null)
> After a little debugging, i found that the final SOAPElement I get is for real a RPCParam instance. Going a little deeper, I discover that RPCParam "delegate" to MessageElement (its super class) the getValue() call that return null. Here is a code snippet (comments inside) :
> //======================================================
>    /**
>     * Get the value of the doc as a string.
>     * This uses {@link #getAsDOM()} so is a heavyweight operation.
>     * @return the value of any child node, or null if there is no node/something went
>     * wrong during serialization. If the first child is text, the return value
>     * is the text itself.
>     * @see javax.xml.soap.Node#getValue() ;
>     */
>    public String getValue() {
>        // no recorder for me
>        // ======================
>        if ((recorder != null) && (!_isDirty)) {
>            StringWriter writer = new StringWriter();
>            TextSerializationContext outputContext =
>                new TextSerializationContext(writer);
>            try {
>                recorder.replay(startEventIndex,
>                                endEventIndex,
>                                new SAXOutputter(outputContext));
>            } catch (Exception t) {
>                log.debug("getValue()", t);
>                return null;
>            }
>            String value = writer.toString();
>            return (value.length() == 0) ? null : value;
>        }
>        // textRep is null for me
>        // ======================
>        if (textRep != null) {
>            // weird case: error?
>            return textRep.getNodeValue();
>        }
>        // objectValue too
>        // ======================
>        if (objectValue != null) {
>            return getValueDOM();
>        }
>        // children too
>        // ======================
>        if (children != null && !children.isEmpty()) {
>            if (children.get(0) instanceof org.apache.axis.message.Text) {
>                return ((org.apache.axis.message.Text)children.get(0)).getNodeValue();
>            }
>        }
>        // then, it always return null
>        // ======================
>        return null;
>    }
> //======================================================
> But there is other thing I view when debugging : RPCParam has a field named "value" with value accessible via getObjectValue(). And this is this value that I want to be returned.
> Maybe we can add a RPCParam.getValue() that return this.getObjectValue() ?? 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://nagoya.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira