Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 代理类上需要WebServiceBindingAttribute_.net_Web Services - Fatal编程技术网

.net 代理类上需要WebServiceBindingAttribute

.net 代理类上需要WebServiceBindingAttribute,.net,web-services,.net,Web Services,我创建了一个基于soap的web服务,并创建了一个名为SetclientCredential的函数 它使用Microsoft.Web.Services3.Security.Tokens.UsernameToken设置客户端凭据 下面给出了代码示例: <SoapDocumentMethod(Action:="http://tempuri.org/SetClientCredential", _ RequestNamespace:="http://tempuri.org/", _ Reque

我创建了一个基于soap的web服务,并创建了一个名为SetclientCredential的函数 它使用Microsoft.Web.Services3.Security.Tokens.UsernameToken设置客户端凭据 下面给出了代码示例:

<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
例外情况说明: Dim cProxy作为新的Microsoft.Web.Services3.WebServicesClientProtocol

有人知道问题出在哪里吗


谢谢

我不想让人觉得我在指出一些愚蠢的事情,但是代理类是否定义了相应的WebServiceBindingAttribute

在C#中是这样的:

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

//Forgive me, I'm not a VB person.
我认为应该是这样
[System.Web.Services.WebServiceBindingAttribute(Name=“ServiceName”,Namespace=”“)]

这不是问题,而是陈述。
[WebServiceBindingAttribute(Name = "TempName", Namespace = "http://tempuri.org/")]
public class WSProxyClass : Microsoft.Web.Services3.WebServicesClientProtocol
{

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