【发布时间】:2014-05-16 14:31:14
【问题描述】:
如何在 Soap Android for WCF 中请求此 xml。 这是来自 WCF 测试客户端
<LoginNew xmlns="http://192.168.10.60/Services/">
<Username xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Password i:nil="true" />
<Username i:nil="true" />
<VersionCode>0</VersionCode>
</Username>
</LoginNew>
</s:Body>
我已经尝试过了,但没有希望。它在 WCF 中返回 null
SoapObject request = new SoapObject(NAMESPACE, "LoginNew");
SoapObject UsernamePassword = new SoapObject();
UsernamePassword.addProperty("Username", "arlind");
UsernamePassword.addProperty("Password", "arlind");
request.addSoapObject(UsernamePassword);
<s:Body>
我的 Wcf 代码:
[OperationContract]
[WebInvoke(Method = "POST",
RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Bare,
UriTemplate = "/LoginNew")]
string LoginNew(UsernamePassword Username);
public class UsernamePassword
{
[DataMember]
public string Username { get; set; }
[DataMember]
public string Password { get; set; }
[DataMember]
public int VersionCode { get; set; }
}
【问题讨论】: