0

我在我的 VS2010 项目中创建了一个 Web 服务引用,并使用 WSDL 服务地址 URL 对其进行了配置。VS2010 为我创建了一个不错的代理类来使用 Web 服务。

我得到了一个我不喜欢的结果,并且为了排除故障,我希望看到从 Web 服务返回的 XML。最简单的方法是什么?我希望能够在我的 Visual Studio 调试会话中执行此操作,但如果我必须超出此范围,那就这样吧。

我正在尝试进行以下工作:

        Dim response As HttpWebResponse = Nothing
        Dim reader As System.IO.StreamReader = Nothing

        Dim hwrResponse As HttpWebResponse = DirectCast(**request**.GetResponse(), HttpWebResponse)
        Dim responseStream As System.IO.Stream = hwrResponse.GetResponseStream()

        Dim xtrSmp As New System.Xml.XmlTextReader(responseStream)
        Dim strXm As String = xtrSmp.ReadInnerXml()
        xtrSmp.Close()

        hwrResponse.Close()

但我不知道我的要求应该是什么。

4

2 回答 2

0

您的REQUEST应该是一个 REQUEST 对象,它被配置为访问您尝试访问的 SOAP 服务...

在这里你可以找到更多...

HTTPWEBRESPONSE 对象http://msdn.microsoft.com/en-us/library/system.net.httpwebresponse.aspx

HTTPWEBREQUEST 对象http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx

于 2012-12-28T18:06:52.463 回答
0

使用其中一种
WebServiceStudio ( http://webservicestudio.codeplex.com/ )、Storm ( http://storm.codeplex.com/ ) 或出色的 Eclipse WSDL 编辑器和 Web 服务资源管理器(查看http://wiki. eclipse.org/index.php/Introduction_to_the_WSDL_Editor

这些将允许您使用从 WSDL 生成的 ad-hoc GUI 客户端调用您的服务方法,并访问请求和响应 XML。

上面的工具列表当然是不完整的。

于 2013-07-03T10:42:57.947 回答