Convert WSDL file to asmx
I have got wsdl file and based on wsdl I am trying to create asmx service.
Wsdl file holding some credential user id and password it is working fine when I used SOAP UI tools
In same manner when I am creating web method like given scarch code
[SoapHeader("authentication")]
[WebMethod]
public string getHierarchy()
{
string strResult="Hello", strRegion="";
Service serviceProxy = new Service();
UsernameToken userToken = new UsernameToken("admin", "password", PasswordOption.SendHashed);
//SoapContext requestContext = serviceProxy.RequestSoapContext;
serviceProxy.RequestSoapContext.Security.Tokens.Add(userToken);
//requestContext.Security.Timestamp.TtlInSeconds = 60;
smartForms objSmartForms = new smartForms();
// authentication.strUserName = "admin";
//authentication.strPassword = "password";
strResult = objSmartForms.getHierarchy("TLANTIC",out strRegion);
return strResult;
}
When I Invoking this method getting SOAP Excepetion
System.Web.Services.Protocols.SoapException: Error retrieving user and/or password from header - header=null
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at smartForms.getMarketHierarchy(String market, String& region) in c:\Project\TestWebserviceForESB\App_Code\smartForms.cs:line 225