Java SOAP - Need help on Body and ChildElement manipulation

Posted by techventure on Stack Overflow See other posts from Stack Overflow or by techventure
Published on 2010-06-17T03:35:24Z Indexed on 2010/06/17 3:43 UTC
Read the original article Hit count: 211

Filed under:
|
|

Hi guys I'm trying to write some code in java to learn more about coding with WSDL and SOAP.

I've been able to build up a BodyElement for a given namespace. But when i come to adding the childElements I'm runnig intp problems.

For example given :

'<'to:checkAccount xmlns:to="http://foo">
       '<'to:id>  test'  <'/to:id>
       '<'to:password>  test  '<'/to:password>
'<'to:checkAccount >" 

I'm able to set the bodyElement(to:checkAccount), but when i try to add the childElements (to:id, to:password) , the childElement needs to have the "to" prefix otherwise it won't work.

ie.

 sf = SOAPFactory.newInstance();
 Name childName = sf.createName("id");
 SOAPElement symbol = bodyElement.addChildElement(childName);

this doesn't work since it doesn't have the "to" prefix to id and password. I cannot do

Name childName = sf.createName("id","to",null);

as it gives me an error saying wrong namespace...

can someone tell me how i can add to:id and to:password to to:checkAccount ?

© Stack Overflow or respective owner

Related posts about java

Related posts about soap