[英]proxy class not calling web services
I am trying to call a webservice whose wsdl is not published on their website. 我正在尝试调用wsdl未在其网站上发布的Web服务。 The developers of the service have given me wsdl file to generate the proxy class from it. 服务的开发人员给了我wsdl文件,以便从中生成代理类。
I have successfully generated the file using VS2010 svcutil.exe command. 我已经使用VS2010 svcutil.exe命令成功生成了文件。 I included the file in the project I am working on, however, when calling for the webservice, there is no request going out as evidenced by fiddler2 that I used to check outgoing request and responses. 我在正在处理的项目中包含了该文件,但是,在调用Web服务时,没有任何请求出去,正如fiddler2所证明的那样,我曾经检查过传出的请求和响应。
on the below file, I will be getting data from the database but for testing reasons, I am just sending through static information. 在下面的文件中,我将从数据库中获取数据,但是出于测试原因,我只是通过静态信息进行发送。
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
==part of the app.config file== == 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>
==Part of the proxy class file == ==代理类文件的一部分==
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
You never called the service. 您从未致电服务。 All you did is create an empty response, then take the (empty) data from it. 您所做的只是创建一个空响应,然后从中获取(空)数据。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.