【发布时间】:2012-02-13 15:51:47
【问题描述】:
我正在尝试从 android 客户端连接到 Wcf Web 服务。我的客户端在使用简单数据类型时运行良好,但是当我尝试使用复杂数据调用时,它会出现问题。 我已经这样做了:
Credentials credentials=new Credentials();
credentials.Username="xyz";
credentials.Password="123";
PropertyInfo info=new PropertyInfo();
info.setName("credentials");
info.setValue(credentials);
info.setNamespace(NAMESPACE);
info.setType(new Credentials().getClass());
request.addProperty(info);
SoapSerializationEnvelope envelope =
new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(URL);
Object response=null;
httpTransport.call(SOAP_ACTION, envelope);
response = envelope.getResponse();
每当我在不执行 info.setValue(credentials) 的情况下发送凭据时,我都可以将请求发送到服务器,但用户名和密码字段为空白。 如果我添加这个 info.setValue(credentials) 我会得到 eserilization 错误。我在这方面浪费了大约 2-3 天,请帮忙。
【问题讨论】:
-
您收到的响应是 Json 字符串还是soap 格式?如果您收到的是Json 字符串响应,那么我们可以对请求进行硬编码。
-
不,我正在发送请求以及以肥皂格式接收请求..
标签: android wcf android-ksoap2