WCF 客户端返回“无”作为对第三方网络服务的响应

发布于 2024-09-08 11:49:38 字数 1179 浏览 4 评论 0原文

我有一个第三方 Web 服务(恰好是 peoplesoft EIP 服务),我试图从 .net 调用它。我尝试使用服务引用和旧的 Web 引用来调用此服务,每次调用它时,我都会从服务中得到“无”响应。

我已经通过 SoapUI 运行了服务调用,并且工作正常。我已经使用 Fiddler 捕获了网络流量,并注意到当我从 SoapUi 或 .Net 调用该服务时,我从调用中得到了相同的结果 xml。这意味着通话正常。我已在 WCF 中打开跟踪和日志记录,但没有看到任何错误。它也没有抛出异常。

所以我的理论是,.net 很难将服务中的 xml 转换回 .net 对象。

这是我的代码片段:

Dim psclient As New psService.LSS_WEBORDER_PortTypeClient

Dim psreq As New psService.LSS_WEBORDER_REQ_MSG_TypeShape
psreq = New psService.LSS_WEBORDER_REQ_MSG_TypeShape

Dim orderinfo(1) As psService.Transaction_TypeShape

Dim captureid As String = "WB" & Right(Guid.NewGuid.ToString, 8)
orderinfo(0) = New psService.Transaction_TypeShape
orderinfo(0).LSS_WEBOHDR_WRK = New psService.LSS_WEBOHDR_WRKMsgDataRecord_TypeShape
orderinfo(0).LSS_WEBOHDR_WRK.CAPTURE_ID = New psService.CAPTURE_ID_TypeShape
orderinfo(0).LSS_WEBOHDR_WRK.CAPTURE_ID.Value = captureid

psreq.MsgData() = orderinfo

Dim response As New psService.LSS_WEBORDER_RESP_MSG_TypeShape
response = psclient.LSS_WEBORDER_OP(psreq)
response.ToString() <-- this throws an exception because "response" is nothing. 
psclient.Close()

任何帮助将不胜感激。

保罗

I have a 3rd party webservice (happens to be a peoplesoft EIP service) that I'm trying to call from .net. I've tried using a service reference and the old web reference to call this service and every time I call it I get a response of "nothing" back from the service.

I've ran the service call through SoapUI and it works fine. I've captured the network traffic using Fiddler and notice that when i call the service from SoapUi or from .Net I get the same resulting xml back from the call. So that means the call is working. I've turned on tracing and logging within WCF and I'm not seeing any errors. Nor is it throwing an exception.

So my theory is that .net is having a hard time translating the xml from the service back into a .net object.

Here is a snippet of my code:

Dim psclient As New psService.LSS_WEBORDER_PortTypeClient

Dim psreq As New psService.LSS_WEBORDER_REQ_MSG_TypeShape
psreq = New psService.LSS_WEBORDER_REQ_MSG_TypeShape

Dim orderinfo(1) As psService.Transaction_TypeShape

Dim captureid As String = "WB" & Right(Guid.NewGuid.ToString, 8)
orderinfo(0) = New psService.Transaction_TypeShape
orderinfo(0).LSS_WEBOHDR_WRK = New psService.LSS_WEBOHDR_WRKMsgDataRecord_TypeShape
orderinfo(0).LSS_WEBOHDR_WRK.CAPTURE_ID = New psService.CAPTURE_ID_TypeShape
orderinfo(0).LSS_WEBOHDR_WRK.CAPTURE_ID.Value = captureid

psreq.MsgData() = orderinfo

Dim response As New psService.LSS_WEBORDER_RESP_MSG_TypeShape
response = psclient.LSS_WEBORDER_OP(psreq)
response.ToString() <-- this throws an exception because "response" is nothing. 
psclient.Close()

Any help would be appreciated.

Paul

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

提笔落墨 2024-09-15 11:49:38

今天,在一位同事的帮助和一些深入的谷歌挖掘下,我解决了这个问题。

基本上,peoplesoft WSDL 的命名空间是: http://xmlns.oracle.com /Enterprise/Tools/schemas/LSS_WEBORDER_RESP_MSG.v1
但经过一番挖掘后,我注意到响应上的命名空间不同: http://peoplesoft.com/LSS_WEBORDER_RESP_MSGResponse

所以我有两个选择。
1. 在生成代理类之前更改 wsdl 中的命名空间。
2. 修改reference.vb 代理类以具有正确的命名空间。

我现在选择选项1。我希望有更好的方法。

我从这里得到了一些帮助: http://www.primordialcode.com/index.php/2008/10/15/invoking-javaaxis-web-service-net-return-null-issue/

I figured it out today with a little help from a colleague and some deep Google digging.

Basically the namespace the peoplesoft WSDL had was: http://xmlns.oracle.com/Enterprise/Tools/schemas/LSS_WEBORDER_RESP_MSG.v1
But after some digging i noticed the namespace on the response was different: http://peoplesoft.com/LSS_WEBORDER_RESP_MSGResponse

So i have two options.
1. Change the namespace in the wsdl before i generate my proxy classes.
2. Modify the reference.vb proxy class to have the correct namespace.

I'm choosing option 1 for now. I wish there was a better way.

I got some help from here: http://www.primordialcode.com/index.php/2008/10/15/invoking-javaaxis-web-service-net-return-null-issue/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文