Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/313.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WCF中的Android Soap请求_C#_Android_Wcf_Soap - Fatal编程技术网

C# WCF中的Android Soap请求

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" /> &

如何在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端点接受的内容类型是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