我正在尝试从 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 天,请帮忙。