簡體   English   中英

WCF中的Android Soap Request

[英]Android Soap Request in WCF

如何在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; }

    }

您正在定義WCF終結點接受的Content-type是application / Json

    RequestFormat = WebMessageFormat.Json

所以可能首先將其更改為WebMessageFormat.Xml

其次,我相信為了使WCF服務能夠接受SOAP消息,還必須將服務配置為針對SOAP 1.1的basicHttpBinding或針對SOAP 1.2的wsHttpBinding

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM