我正在尝试使用以下演示URL的服务:
[https://demo.unicommerce.com/services/soap/uniware13.wsdl?facility=01][1]
当我添加此服务并尝试在我的代码中使用时,如下所示:using abc;
public partial class unicommerce : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
unicommerce u = new unicommerce();
UnicommerceClient us = new UnicommerceClient();
Customer c=new Customer ();
PartyAddress pa=new PartyAddress ();
pa.StateCode="25";
pa.Pincode="302017";
c.BillingAddress=pa;
PartyContact p=new PartyContact ();
c.Contact=p;
c.CSTNumber="123";
c.CustomerCode="ABC";
c.Name="example";
c.PAN="CYKPS7842";
c.Website="http://mywebsite.in";
CreateCustomerRequest cr = new CreateCustomerRequest();
cr.Customer = c;
us.CreateCustomer(cr);
}
}
它抛出错误。
No WS-Security header found
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ServiceModel.FaultException: No WS-Security header found
[1]: https://demo.unicommerce.com/services/soap/uniware13.wsdl?facility=01
我向创建此服务的人询问了这件事,他告诉我这个服务是用Java代码和Apace一起创建的。
据我所知,这个错误与用户名和密码(身份验证)有关,但我不知道应该在哪里输入这些凭据。
us.ClientCredentials.UserName.username="用户名"; us.ClientCredentials.UserName.Password="密码";
- Sujit.Warrier