[英]complex ksoap in android java
am trying to upload some data to a webservise in .net using ksoap java on android. 我正在尝试使用android上的ksoap java将一些数据上传到.net中的webservise。 i have try to work it but with no success.
我已经尝试了,但是没有成功。 the result is null and i have no idea why this is happen the code that am using is the follow:
结果为null,我不知道为什么会这样,正在使用的代码如下:
xml web service xml Web服务
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<AddBloodPressure xmlns="http://tempuri.org/">
<PatientID>int</PatientID>
<BloodPressure>
<Sistolic>int</Sistolic>
<Distolic>int</Distolic>
</BloodPressure>
<DateTimeStamp>dateTime</DateTimeStamp>
</AddBloodPressure>
</soap:Body>
</soap:Envelope>
the KvmSerializable code is KvmSerializable代码是
public class Category implements KvmSerializable
{
public int Distolic;
public int Sistolic;
public int getDistolic() {
return Distolic;
}
public void setDistolic(int distolic) {
Distolic = distolic;
}
public int getSistolic() {
return Sistolic;
}
public void setSistolic(int sistolic) {
Sistolic = sistolic;
}
public Object getProperty(int arg0) {
switch(arg0)
{
case 0:
return getSistolic();
case 1:
return getDistolic();
}
return null;
}
public int getPropertyCount() {
return 3;
}
public void getPropertyInfo(int arg0, Hashtable arg1, PropertyInfo info) {
switch(arg0)
{
case 0:
info.type = PropertyInfo.INTEGER_CLASS;
info.name = "Sistolic";
break;
case 1:
info.type = PropertyInfo.INTEGER_CLASS;
info.name = "Distolic";
break;
default:break;
}
}
public void setProperty(int arg0, Object arg1) {
switch (arg0)
{
case 0:
this.Sistolic = Integer.parseInt(arg1.toString());
break;
case 1:
this.Distolic=Integer.parseInt(arg1.toString());
break;
}
}
}
and my main is: 我的主要是:
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("PatientId", "8");
Category i1=new Category();
i1.setDistolic(100);
i1.setSistolic(100);
PropertyInfo pi=new PropertyInfo();
pi.setName("BloodPressure");
pi.setValue(i1);
pi.setType(i1.getClass());
request.addProperty(pi); request.addProperty("DateTimeStamp","2012-01-13");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);
Object result=((Object)envelope.getResponse());
String resultString=new String(result.toString());
}
ok. 好。 this is that am using.
这就是正在使用。 does anyone know how this can be fixed?
有谁知道如何解决?
I belive that the timestamp property is incorrect. 我相信timestamp属性不正确。 Ususally .net webservices format for timestamp is something like
通常,.net webservices格式的时间戳类似于
yyyyMMddThhmmss
i can't remember the exact sintax 我不记得确切的罪过
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.