C# WCF中的Android Soap请求
如何在Soap Android for WCF中请求此xml。 这是来自WCF测试客户端的C# WCF中的Android Soap请求,c#,android,wcf,soap,C#,Android,Wcf,Soap,如何在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" /> &
<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端点接受的内容类型是application/Json
RequestFormat = WebMessageFormat.Json
因此,可能首先将其更改为WebMessageFormat.Xml
其次,我相信为了让您的WCF服务接受SOAP消息,您还必须将您的服务配置为适用于SOAP 1.1的basicHttpBinding或适用于SOAP 1.2的wsHttpBinding,因为我正在接收SOAP请求,但它为空,并且我不需要接受XML,我需要SOAP。
[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; }
}
RequestFormat = WebMessageFormat.Json