views:

66

answers:

0

I m facing an exception when call a web method of my web service , the exception generated when the method is creating object of Microsoft.Web.Services3.WebServicesClientProtocol. The code segment of method is :

<WebMethod(), SoapDocumentMethod(Action:="http://tempuri.org/service/SetClientCredential", _
     RequestElementName:="Default", RequestNamespace:="http://tempuri.org/", _
     ResponseElementName:="Default", RequestNameSpace:="http://tempuri.org/", _
     Use:=System.Web.Services.Description.SoapBindingUse.Literal, _
   ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _
    Public Sub SetClientCredential(ByVal username As String, ByVal userpass As String)
        Dim cProxy As New Microsoft.Web.Services3.WebServicesClientProtocol
        Dim usernametoken As New Microsoft.Web.Services3.Security.Tokens.UsernameToken(username, userpass)

        cProxy.SetClientCredential(usernametoken)
    End Sub

The Exception stated : System.InvalidOperationException: WebServiceBindingAttribute is required on proxy classes. at System.Web.Services.Protocols.SoapClientType..ctor(Type type) at System.Web.Services.Protocols.SoapHttpClientProtocol..ctor() at Microsoft.Web.Services3.WebServicesClientProtocol..ctor() at Service.SetClientCredential(String username, String userpass)

Can Anyone help me?