BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 11-13-2009, 05:32 AM   #1 (permalink)
New Member
 
Join Date: Oct 2009
Model: 7100T
PIN: N/A
Carrier: Vodafone
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Ksoap passing complex type input to ws

Please Login to Remove!

I am trying to use Ksoap to call a .net webservice.

Sample request is as follows:
<soap:Body>
<RegisterUserDetails xmlns=" ">
<User>
<SPName>string</SPName>
<Mode>string</Mode>
<UserID>int</UserID>
<UserFirstName>string</UserFirstName>
<UserLastName>string</UserLastName>
<UserPassword>string</UserPassword>
<UserEmail>string</UserEmail>
<UserName>string</UserName>
<UserPhoto>string</UserPhoto>
<Msg>string</Msg>
<UserAge>int</UserAge>
<UserMobilePhone>string</UserMobilePhone>
<UserAlternateEmail>string</UserAlternateEmail>
<UserAddress>string</UserAddress>
<UserFavouriteQuote>string</UserFavouriteQuote>
<UserGender>boolean</UserGender>
</User>
</RegisterUserDetails>
</soap:Body>
</soap:Envelope>

I have coded as follows:

Code:
SoapObject soap = new SoapObject(URN, methodName);

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
					SoapEnvelope.VER11);
PropertyInfo pinfo = new PropertyInfo();
pinfo.name="User";
pinfo.namespace="mynamespace"
 pinfo.type=Prop_User.EVENT_CLASS;
Prop_User userObj = new Prop_User();
userObj.setSpName("spname");
userObj.setMode("mode");
userObj.setUserid(28);
userObj.setFName("baj");
userObj.setLName("baj");
userObj.setPwd("baj");
.........................	         	           
soap.addProperty(pinfo,userObj);
envelope.bodyOut = soap;
envelope.dotNet = true;
//envelope.setOutputSoapObject(soap);

HttpTransport ht = new HttpTransport(address);
ht.debug = true;
ht.call(soapAction, envelope);
I am getting a Faultstring as:
Server was unable to read request. ---&gt; There is an error in XML document (1, 301). ---&gt; The specified type was not recognized: name='anyType',

Can somebody point out my mistake. Thanks
Offline  
Old 11-13-2009, 05:58 AM   #2 (permalink)
New Member
 
Join Date: Oct 2009
Model: 7100T
PIN: N/A
Carrier: Vodafone
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Working now after changing the below lines:

soap.addProperty("User",userObj);
envelope.addMapping(namespace, "Prop_User", Prop_User.EVENT_CLASS);
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

MSA ALTAIR 4X MULTI GAS DETECTOR
$15.45
MSA ALTAIR 4X MULTI GAS DETECTOR   pictureLot Of (2)MSA ALTAIR2X 10153984C Multi-Gas Detector Monitor, H2S , Charcoal Gray
$100.0
Lot Of (2)MSA ALTAIR2X 10153984C Multi-Gas Detector Monitor, H2S , Charcoal Gray pictureALTAIR 5 / 5X BATTERIES
$0.99
ALTAIR 5 / 5X BATTERIES pictureALTAIR 4/4X/5/5X COMBUSTIBLE SENSOR
$6.5
ALTAIR 4/4X/5/5X COMBUSTIBLE SENSOR pictureMSA Altair 4X Multigas Detector safety Kit
$399.0
MSA Altair 4X Multigas Detector safety Kit picture






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