【发布时间】:2015-06-09 07:47:05
【问题描述】:
我正在尝试将手机的用户名和设备 ID 提交到我的服务器,但我不断收到以下错误:
W/System.err:SoapFault - 故障代码:'soap:Client' 故障字符串:'解组错误:意外元素(uri:“http://eventmanagement.management.de/”,本地:“用户名”)。预期元素是 , ' faultactor: 'null' detail: null
这是我的代码:
PropertyInfo pi = new PropertyInfo();
pi.setNamespace(NAMESPACE);
pi.setName("username");
pi.setValue(userName.getText().toString());
pi.setType(PropertyInfo.STRING_CLASS);
request.addProperty(pi);
pi.setNamespace(NAMESPACE);
pi.setName("deviceID");
pi.setValue(android.provider.Settings.Secure.getString(
getContentResolver(),
android.provider.Settings.Secure.ANDROID_ID));
pi.setType(PropertyInfo.STRING_CLASS);
request.addProperty(pi);
SoapSerializationEnvelope envelope =
new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
这是 wsdl 文件:
<xs:complexType name="addUser">
<xs:sequence>
<xs:element minOccurs="0" name="username" type="xs:string"/>
<xs:element minOccurs="0" name="deviceID" type="xs:string"/>
</xs:sequence>
</xs:complexType>
有人可以帮我吗? 我已经搜索了 2 个小时,没有找到任何东西。
编辑2: http-Request 转储的左上角 右上角的 SoapUI 生成的请求有效 http://www.directupload.net/file/d/4013/5iwbvowk_png.htm
【问题讨论】:
-
我的问题中不能打招呼有什么原因吗?:D
-
尝试使用
String.class而不是PropertyInfo.STRING_CLASS -
以前试过。也没有用。
标签: android web-services wsdl ksoap2