Hi there,
Question 1) Is there any issue with getBodyByName (namespace, localpart) in SOAPEnvelope class? .Because my method 1)(listed below) throws NullPointerException and Method 2 (listed below) returns result.
Method 1) -> I am calling directly getBodyByName(). Method 2) -> I am using getBodyElements() and iterate through the result to find localpart "MyBean". Here things work fine.
Method 1)
SOAPEnvelope sEnlp=mess.getSOAPEnvelope(); SOAPBodyElement
sBElement=sEnlp.
SOAPEnvelope sEnlp=mess.getSOAPEnvelope(); Vector v= sEnlp.getBodyElements(); for(int i=0;i<v.size();i++){ SOAPBodyElement sBElement=(SOAPBodyElement)v.elementAt(i); System.out.println("Name"+sBElement.getName()); String name=sBElement.getName(); if(name.equals("multiRef")){ QName qna=sBElement.getType(); String localPart=qna.getLocalPart(); System.out.println("LocalPart->"+qna.getLocalPart()); àThis prints "MyBean" System.out.println("NameSpace->"+qna.getNamespaceURI()); àThis prints "http://webservice5" if(localPart.equals("MyBean")){ Iterator itr=sBElement.getChildElements(); hile(itr.hasNext()){ MessageElement mElement=(MessageElement)itr.next(); System.out.println("ElementValue->"+ mElement.getObjectValue()); } } } }
Question 2) I am following the above procedure to get bean data at client. Is this right? If Yes once I get my MessageElement, how do I extract "name" and "value"?.
Thanks in advance for your help, Ran |