Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.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
Asp.net 代理类不调用web服务_Asp.net_Visual Studio 2010_Web Services_Vb.net 2010 - Fatal编程技术网

Asp.net 代理类不调用web服务

Asp.net 代理类不调用web服务,asp.net,visual-studio-2010,web-services,vb.net-2010,Asp.net,Visual Studio 2010,Web Services,Vb.net 2010,我试图调用一个Web服务,其wsdl未发布在其网站上。该服务的开发人员给了我wsdl文件,以便从中生成代理类 我已使用VS2010 svcutil.exe命令成功生成该文件。我将该文件包括在我正在处理的项目中,但是,当调用Web服务时,没有请求发出,我用来检查发出的请求和响应的fiddler2证明了这一点 在下面的文件中,我将从数据库中获取数据,但出于测试原因,我只发送静态信息 Imports System.Data Imports System.ServiceModel Imp

我试图调用一个Web服务,其wsdl未发布在其网站上。该服务的开发人员给了我wsdl文件,以便从中生成代理类

我已使用VS2010 svcutil.exe命令成功生成该文件。我将该文件包括在我正在处理的项目中,但是,当调用Web服务时,没有请求发出,我用来检查发出的请求和响应的fiddler2证明了这一点

在下面的文件中,我将从数据库中获取数据,但出于测试原因,我只发送静态信息

Imports System.Data
    Imports System.ServiceModel
    Imports System.Web.UI.Page
    Imports System.Math 
    Imports MusicShop.Album.Song
    Public Class webservicetest
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim Song As New request
        Try
            Song.songname() = "TameMeHome"
            Song.trackNumber() = Convert.ToInt32("1")
            Song.requestNumber() = Convert.ToInt32("5689")
            Song.language() = "english"
            Song.albumtitle() = "GetMeThere"
            Song.totalAlbums() = Convert.ToDecimal("35")

            Dim songresponse As New responce

            Label1.Text = songresponse.errorMessage()
            Label2.Text = songresponse.requestDateTime()
            Label3.Text = songresponse.requestNumber()
            Label4.Text = songresponse.status()
        Finally
        End Try
    End Sub

    End Class
==app.config文件的一部分==

    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_Songinformation" closeTimeout="00:01:00"
                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                    allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="false">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="Transport">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="" />
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="urlWherewebserviceIsDeployed"
                binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Songinformation"
                contract="Songdata" name="BasicHttpBinding_Songdata" />
        </client>
    </system.serviceModel>

==代理类文件的一部分==

Option Strict Off
Option Explicit On

Imports System.Runtime.Serialization
<Assembly: System.Runtime.Serialization.ContractNamespaceAttribute("URLForDataContract", ClrNamespace:="New MusicShop.Album.Song")> 

Namespace New MusicShop.Album.Song

    <System.Diagnostics.DebuggerStepThroughAttribute(), _
     System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0"), _
     System.Runtime.Serialization.DataContractAttribute(Name:="Request", [Namespace]:="URLforDataContract")> _
    Partial Public Class Request
        Inherits Object
        Implements System.Runtime.Serialization.IExtensibleDataObject

        Private extensionDataField As System.Runtime.Serialization.ExtensionDataObject

        Private albumtitle As String

        Private songname = As String

        Private trackNumber As Integer

        Private language As String

        Private requestNumber As UInteger

        Private totalAlbums As Integer


        Public Property ExtensionData() As System.Runtime.Serialization.ExtensionDataObject Implements System.Runtime.Serialization.IExtensibleDataObject.ExtensionData
            Get
                Return Me.extensionDataField
            End Get
            Set(ByVal value As System.Runtime.Serialization.ExtensionDataObject)
                Me.extensionDataField = Value
            End Set
        End Property

        <System.Runtime.Serialization.DataMemberAttribute(IsRequired:=True)> _
        Public Property albumtitle() As String
            Get
                Return Me.albumtitle
            End Get
            Set(ByVal value As String)
                Me.albumtitlebox = Value
            End Set
        End Property
选项严格关闭
选项显式打开
导入System.Runtime.Serialization
名称空间New MusicShop.Album.Song
_
部分公共类请求
继承对象
实现System.Runtime.Serialization.IExtensibleDataObject
私有extensionDataField作为System.Runtime.Serialization.ExtensionDataObject
私有相册标题作为字符串
Private songname=作为字符串
私有trackNumber为整数
作为字符串的专用语言
作为UInteger的私有requestNumber
作为整数的私有totalAlbums
公共属性ExtensionData()作为System.Runtime.Serialization.ExtensionDataObject实现System.Runtime.Serialization.IExtensibleDataObject.ExtensionData
得到
Return Me.extensionDataField
结束
Set(ByVal值为System.Runtime.Serialization.ExtensionDataObject)
Me.extensionDataField=值
端集
端属性
_
作为字符串的公共属性albumtitle()
得到
把我的名字还给我
结束
设置(ByVal值作为字符串)
Me.albumtitlebox=值
端集
端属性

您从未呼叫过该服务。您所做的只是创建一个空响应,然后从中获取(空)数据。

哦,谢谢您,John,我已根据编辑的代码在应用程序文件中包含imports MusicShop.Album.Song,但仍然返回空响应,我是否遗漏了什么?