Handling WCF Proxy null return issue

吃可爱长大的小学妹 提交于 2019-11-27 07:11:26

问题


I have a WCF Client Proxy connected to a third party webservice. The proxy works fine with nearly everything except on function.

This function works just fine with a ASMX proxy.

I have added service trace logging and can see the response from the service coming back. Only the proxy returns null.

So now I know for sure that the proxy is at fault.

Where to from here?

RESOLUTION I found the issue. WCF is less forgiving than an ASMX proxy. The service WSDL specifies that the returned object was called "data", and the actual xml passed back was called "result"

So that was a great goose chase! I think i wasted 4 hours on this problem!


回答1:


You can try to use Trace Viewer to analyse WCF communications in more detail and find out more detail when errors are encountered.

Within the app.config (Client) and web.config (Server), you can add blocks. To enable tracing, simply add dignostics blocks and trace files will be generated in the specified location when the app is run. This should enable you to dig a little deeper with the problem.

Trace viewer can be found:

("C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\SvcTraceViewer.exe")

Info on trace viewer usage:

http://msdn.microsoft.com/en-us/library/aa751795.aspx

Also, what type of method is it? does it return complex types or simple types?

ADDED: Ah, sorry about the mis-read, didn't realise you had no control of server side. I'd try to update the service reference/proxy (you've probably already done that) and check if anything has changed.

WCF doesn't make tracking down issues very easy i'm afraid. Is it possible to provide the method signatures for a call that works and one that doesn't so we can see what data types are being passed about?



来源:https://stackoverflow.com/questions/560370/handling-wcf-proxy-null-return-issue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!