[ 
http://issues.apache.org/jira/browse/AXIS-2081?page=comments#action_12314672 ] 

Venkat Reddy commented on AXIS-2081:
------------------------------------

Couldn't reproduce the issue. I've deployed 
samples\userguide\example2\Calulator.java and ran your test case.

I got the following output
--------------------------------------------------------
C:\dev2\runjava>ant run -Djc=samples.userguide.example2.CalcClient
Buildfile: build.xml

run:
     [java] EnvelopeHeader 24417480 class org.apache.axis.message.SOAPHeader
     [java] Body 13884241 class org.apache.axis.message.SOAPBody

BUILD SUCCESSFUL
Total time: 2 seconds
--------------------------------------------------------

-- venkat

> use SOAPEnvelope.getChildElements() get multi SOAPBody objects
> --------------------------------------------------------------
>
>          Key: AXIS-2081
>          URL: http://issues.apache.org/jira/browse/AXIS-2081
>      Project: Apache Axis
>         Type: Bug
>     Versions: 1.1
>  Environment: windows xp 
> java version "1.5.0_01"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
> Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)
>     Reporter: zhanghongbin
>     Assignee: Venkat Reddy

>
>       When I use the SOAPEnvelope.getChildElements() to get all the child 
> nodes of the SOAPEnvelope, what i expected is that 
>       the only header and the only body. But i got the followed:
>               EnvelopeHeader 32392776 class org.apache.axis.message.SOAPHeader
>               Body 4729123 class org.apache.axis.message.SOAPBody
>               Body 25488452 class org.apache.axis.message.SOAPBody
>               Body 25488452 class org.apache.axis.message.SOAPBody
>       We can see that the SOAPEnvelope has two different objects of type 
> class org.apache.axis.message.SOAPBody and two same references
>       tos Body 25488452.
>       According to the apidocs of SOAPEnvelope that an SOAPEnvelope can have 
> the only one SOAPBody object. So is there something wrong 
>       in my code or the implementions????
>                                               thanks
>                                                sincerely
> attachement:(my test code)                                    
> import org.apache.axis.MessageContext;
> import org.apache.axis.client.Call;
> import org.apache.axis.client.Service;
> import org.apache.axis.encoding.XMLType;
> import org.apache.axis.utils.Options;
> import javax.xml.namespace.QName;
> import javax.xml.rpc.ParameterMode;
> import java.util.Iterator;
> import javax.xml.soap.SOAPEnvelope;
> import javax.xml.soap.SOAPElement;
> public class CalcClient
> {
>    public static String getSubValueNonRecursive(SOAPElement sel){
>          String ret = "";
>        //ret += sel.getElementName().getLocalName() + sel.getValue() + "\n";
>               ret += sel.getElementName().getLocalName();
>          for(Iterator it = sel.getChildElements();it.hasNext();){
>                       SOAPElement se = (SOAPElement)it.next();
>                       ret += se.getElementName().getLocalName() + " " + 
> se.hashCode() + " " + se.getClass() + "\n";
>          }
>          return ret;
>    }
>    public static void main(String [] args){
>    try{
> //       Options options = new Options(args);
>        String endpoint = "http://localhost:8081/axis/Calculator.jws";;
> //       args = options.getRemainingArgs();
>        String method = "add";
>        Integer i1 = new Integer(1);
>        Integer i2 = new Integer(2);
>        Service  service = new Service();
>        Call     call    = (Call) service.createCall();
>        call.setTargetEndpointAddress( new java.net.URL(endpoint) );
>        call.setOperationName(new QName("",method));
>        call.addParameter( "op1", XMLType.XSD_INT, ParameterMode.IN );
>        call.addParameter( "op2", XMLType.XSD_INT, ParameterMode.IN );
>        call.setReturnType( XMLType.XSD_INT );
>        Object[] obj = new Object [] { i1, i2 };
>        Integer ret = (Integer) call.invoke(obj);
>        MessageContext mct = call.getMessageContext();
>          
>        SOAPEnvelope se = mct.getMessage().getSOAPPart().getEnvelope();
>        String value = getSubValueNonRecursive(se);
>        System.out.println(value);
>      }catch(Exception e){
>          e.printStackTrace();
>      }
>    }
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to