soap - Using String Envelope on Ksaop Android -
i want know how can use string envelope in soap call method. here envelope :
string soapenvelope = "<soap:envelope xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:tem=\"http://tempuri.org\">\n" + "<soap:header/>\n" + "<soap:body>\n" + "<tem:getitems>\n" + "<tem:catid>"+categoryid+"</tem:catid>\n" + "</tem:getitems>\n" + "</soap:body>\n" + "</soap:envelope>\n";
i use
soapobject request = new soapobject(namespace, methodname_maincategories); soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11); envelope.dotnet = true; envelope.setoutputsoapobject(request); httptransportse httptransportse = new httptransportse(url); httptransportse.debug = true; soapobject response = null; try{ httptransportse.call(soap_action, envelope); response = (soapobject)envelope.getresponse(); soapobject main = (soapobject)response.getproperty(1); soapobject list = (soapobject)main.getproperty(0); //string = integer.tostring(list.getpropertycount()); //log.i("property count", a); for(int = 0; i<list.getpropertycount(); i++){ categories c = new categories(); soapobject nsoap = (soapobject)list.getproperty(i); if(nsoap != null){ c.setid(nsoap.getproperty("id").tostring()); c.setmainid(nsoap.getproperty("mainid").tostring()); c.setname(nsoap.getproperty("name").tostring()); } } } catch(exception e){ e.printstacktrace(); } return categories;
kind of approach. need add parameter call, integer value. tried add
request.addparameter("myvalue", myvalue);
where myvalue parameter required call function. here portion of code:
public arraylist<item> getitems(int myvalue){ soapobject request = new soapobject(namespace, methodname_items); request.addproperty("myvalue", myvalue); log.i("catid", string.valueof(myvalue)); soapserializationenvelope envelope = new soapserializationenvelope(soapenvelope.ver11); envelope.dotnet = true; envelope.setoutputsoapobject(request); httptransportse httptransportse = new httptransportse(url); httptransportse.debug = true; soapobject response = null;
i tried both string , int myvalue params
, request returns "myvalue" 0 (it returns items 0 if enter 1,2,3,4 etc.). made research , learned need create envelope , give parameter there. created string envelope gave above, how integrate call ? answers !
try adding parameters follows
soapobject request = new soapobject(namespace, methodname_items); propertyinfo paraid = new propertyinfo(); paraid.setname("your parameter name"); paraid.setvalue("your parameter value"); paraid.namespace=namespace; paraid.settype(string.class); // or integer whatever type is... request.addproperty(wallpapercatid);
Comments
Post a Comment