View Single Post
Old 04-02-2009, 03:33 PM   #24
zona21
New Member
 
Join Date: Mar 2009
Model: 8800
PIN: N/A
Carrier: development
Posts: 2
Default problem using ksoap2 for sending parameters

hi

I have been using ksoap2 for a couple of days and i can't send the parameters to my web service,I can connect it but i don't know what's the problem for sending parameters.

this is my code


import org.ksoap2.*;
import org.ksoap2.serialization.*;
import org.ksoap2.transport.*;

public class webService {

public webService() {
String serviceUrl = "h t t p://192.168.44.250/SerW_SubirArch/SubirArch.asmx";
String serviceNamespace = "h t t p://192.168.44.250/SerW_SubirArch/";
String soapAction = "mx.com.medisist.WebService/SignosVitalesblack";
String methodName= "SignosVitalesblack";

SoapObject rpc = new SoapObject(serviceNamespace, methodName);

rpc.addProperty("idPaciente", String.valueOf(340).toString());
rpc.addProperty("glucosa",String.valueOf(120).toSt ring());
rpc.addProperty("Medicamento","Metformina tableta 1000mg");
rpc.addProperty("Cantidad",String.valueOf(5).toStr ing());
rpc.addProperty("medida","Pastillas");


SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

envelope.bodyOut = rpc;
envelope.dotNet = true;
envelope.encodingStyle = SoapSerializationEnvelope.ENC;
envelope.setOutputSoapObject(rpc);

HttpTransport ht = new HttpTransport(serviceUrl);
ht.debug = true;
ht.setXmlVersionTag("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

int result= -1;
try {

ht.call(soapAction, envelope);

result = Integer.valueOf((envelope.getResult()).toString()) .intValue();


} catch (org.xmlpull.v1.XmlPullParserException ex2) {
} catch (Exception ex) {
String bah = ex.toString();
System.out.println(bah);

}

}
}





I would appreciate much if you could help me
Offline   Reply With Quote