PremiumServicesPayList psList = new PremiumServicesPayList(); UsernameToken token = new UsernameToken(ServiceUser, ServiceKey, PasswordOption.SendHashed); // Set the token onto the proxy psList.SetClientCredential(token); // Set the ClientPolicy onto the proxy psList.SetPolicy("ClientPolicy"); // psList.DeleteByOrderID(strOrder);
修改Reference.cs里的System.Web.Services.Protocols.SoapHttpClientProtocol 为 Microsoft.Web.Services3.WebServicesClientProtocol
PremiumServicesPayList :[WebMethod] public string Test(string strName) { if (RequestSoapContext.Current != null && RequestSoapContext.Current.IdentityToken.Identity.Name == ServiceUser) { return "Hello " + strName; } else return "nonono"; }