views:

54

answers:

1

I created a soap based web service and create a function named SetclientCredential which set the client credential using Microsoft.Web.Services3.Security.Tokens.UsernameToken the code sample is given below:

<SoapDocumentMethod(Action:="http://tempuri.org/SetClientCredential", _
 RequestNamespace:="http://tempuri.org/", _
 RequestElementName:="GetUserNameRequest", _
 ResponseNamespace:="http://tempuri.org/", _
 ResponseElementName:="GetUserNameResponse"), _
WebMethod(Description:="Obtains the User Name")> _

Public Sub SetClientCredential(ByVal username As String, ByVal userpass As String)
    username = "ADMIN"
    userpass = "password"
    Dim usernametoken As New Microsoft.Web.Services3.Security.Tokens.UsernameToken(username, userpass)
    Dim cProxy As New Microsoft.Web.Services3.WebServicesClientProtocol
    cProxy.SetClientCredential(usernametoken)
End Sub

Then I debug the service it gave exception on :

Dim cProxy As New Microsoft.Web.Services3.WebServicesClientProtocol

The Exception stated that : Dim cProxy As New Microsoft.Web.Services3.WebServicesClientProtocol.

Does anybody know where is the problem.

Thanks

A: 

I don't want to seem like I'm point out something silly but does the Proxy class have the appropriate WebServiceBindingAttribute defined?

In C# it would be like so:

[WebServiceBindingAttribute(Name = "TempName", Namespace = "http://tempuri.org/")]
public class WSProxyClass : Microsoft.Web.Services3.WebServicesClientProtocol
{

//Forgive me, I'm not a VB person.
jkc