BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 05-07-2009, 04:53 AM   #1 (permalink)
New Member
 
Join Date: Apr 2009
Model: 8120
PIN: N/A
Carrier: a
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy adding properties to SoapObject

Please Login to Remove!

Dear All,

I am unable to add multilevel properites to a SoapObject. Please help me.

The format of the Input parametres is like

<m30:message name>
<m30:property1>abc</m30:property1>
<m30:property2>
<m30:property21>123</m30:property21>
<m30:property22>lmn</m30:property22>
</m30:property2>

</m30:message name>

Please help me in adding property to Input SoapObject
the code is as below:

SoapObject rpc = new SoapObject("--message block--m30 namespace", "message name");

rpc.addProperty("property1","abc");
Object o= new Object();
SoapObject sub= (SoapObject)o;
sub.addProperty("property21","123");
sub.addProperty("property22","lmn");
rpc.addProperty("prperty2",sub);


But I am getting exceptions ... Please help me out --to add this hierarchy input field.
Offline  
Old 05-08-2009, 04:19 AM   #2 (permalink)
New Member
 
Join Date: Apr 2009
Model: 8120
PIN: N/A
Carrier: a
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up Gottacha!!!!

I got the solution after trying all posssible trial-n-error methods

The code can be written like this to add such properties:

rpc.addProperty("property1","abc");

SoapObject sub = new SoapObject("--message block--m30 namespace", "message name.property2");

sub.addProperty("property21","123");
sub.addProperty("property22","lmn");

rpc.addProperty("property2",sub);


Then I have got the appropriate Input envelope structure

<m30:message name>
<m30:property1>abc</m30:property1>
<m30:property2>
<m30:property21>123</m30:property21>
<m30:property22>lmn</m30:property22>
</m30:property2>

</m30:message name>
Offline  
Old 05-20-2009, 10:02 AM   #3 (permalink)
New Member
 
Join Date: Apr 2009
Model: 8300
PIN: N/A
Carrier: AT&T
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default thank you

Thanks very much for posting your findings. Once explained, it makes sense.
Offline  




Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.