Web services WP7/8应用程序中的SOAP头身份验证

Web services WP7/8应用程序中的SOAP头身份验证,web-services,windows-phone-7,soap,windows-phone-8,Web Services,Windows Phone 7,Soap,Windows Phone 8,我有一个Web服务,如下所示: POST /mobileservice.asmx HTTP/1.1 Host: services.segwaycommunications.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://services.segwaycommunications.com/ValidateUser" <?xml

我有一个Web服务,如下所示:

                      POST /mobileservice.asmx HTTP/1.1
Host: services.segwaycommunications.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://services.segwaycommunications.com/ValidateUser"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <PlatformAuthentication xmlns="http://services.segwaycommunications.com">
      <UserName>string</UserName>
      <Password>string</Password>
    </PlatformAuthentication>
  </soap:Header>
  <soap:Body>
    <ValidateUser xmlns="http://services.segwaycommunications.com">
      <username xmlns="">string</username>
      <password xmlns="">string</password>
      <resellerid xmlns="">int</resellerid>
    </ValidateUser>
  </soap:Body>
</soap:Envelope>
POST/mobileseservice.asmx HTTP/1.1
主持人:services.segwaycommunications.com
内容类型:text/xml;字符集=utf-8
内容长度:长度
SOAPAction:“http://services.segwaycommunications.com/ValidateUser"
一串
一串
一串
一串
int
现在,正如我们在这里看到的,soap头需要通过类platformauthentication进行身份验证

有人可以帮助我如何使用此Web服务在windows phone 7/8应用程序中进行身份验证吗

我找了很多,但没有找到合适的解决办法


如果有人能帮忙,谢谢。

根据我的意见,Json解析是最好的

因此,首先您需要下载Newtonsoft.Json dll来解析web serevice

只需遵循下面的步骤

步骤1:通过右键单击添加引用来添加服务引用

第2步:现在将您的web服务链接放在服务引用上,然后按go按钮,并添加服务引用的名称空间

步骤3:现在使用
Newtonsoft.Json.Linq添加名称空间

步骤4:现在在cs文件中添加以下代码

 WhatsupServices.WhatsUpServiceSoapClient ws = new WhatsupServices.WhatsUpServiceSoapClient();
ws.ContactUsJSONCompleted += ws_ContactUsJSONCompleted;
ws.ContactUsJSONAsync(txtContactUsName.Text, txtContactUsPhone.Text, txtContactUsEmail.Text, txtContactUsComment.Text);
第6步:现在制定您的解决方法

 void ws_ContactUsJSONCompleted(object sender, dynamic e)
        {
            if (e.Error != null)
            {
                MessageBox.Show(LogIn.NetworkBusyMsg, LogIn.MsgHdr, MessageBoxButton.OK);
                busyIndicator.IsRunning = false;
            }
            else
            {
                busyIndicator.IsRunning = false;
                string Result = e.Result;
                JObject obj = JObject.Parse(Result);
                string ResultCode = (string)obj["ResultCode"];
                string ResponceMessage = (string)obj["ResponseMessage"];

                if (ResultCode == "1")
                {
                    MessageBox.Show("Thank you for your message. We'll get back to you soon.", LogIn.MsgHdr, MessageBoxButton.OK);
                    NavigationService.GoBack();
                }
                else
                {

                }
            }
        }
希望它能帮助你

如果有任何疑问,请在这里发表评论。我会帮你的

Soap头验证

谢谢,但问题是,我必须先验证平台,然后才能使用提供的任何服务。。。。如果您知道如何进行soap头身份验证的编码,请提供帮助。