BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 05-07-2009, 05: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, 05: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, 11: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  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





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