【发布时间】:2012-04-18 12:08:25
【问题描述】:
我有一个必须使用 SOAP Web 服务的 .Net 4 项目。我有一些在 Visual Studio (2008/2010) 中添加 Web 引用的经验,并且我使用 Web 服务引用工具。
开始之前:
我已将 WSDL 上传到http://pastebin.com/huSE0Qeh
所以我的问题:
我将我的 Web 服务引用添加到我的项目中,生成了类和方法,并编写了一些用于测试的基本代码。我已经让负责服务的人员确认了代码,并让我的 PHP 对应方从相同的 WSDL 生成一些 PHP 文件。
问题在于响应对象包含空属性。我没有遇到异常。
接下来我尝试了什么:
我尝试使用 WSDL.exe 创建类文件,它确实做到了,但我再次在响应对象中得到一个空值。我还看到了以下错误(我已经把它们删掉了):
> R2706: A wsdl:binding in a DESCRIPTION MUST use the value of "literal"
> for the use attribute in all soapbind:body, soapbind:fault,
> soapbind:header and soapbind:headerfault elements.
> - Input element soapbind:body of operation 'getProfile' on portType 'connect.cfcSoapBinding' from namespace 'http://ws'.
> - Output element soapbind:body of operation 'getProfile' on portType 'connect.cfcSoapBinding' from namespace 'http://ws'.
> - soapbind:fault 'CFCInvocationException' on operation 'getProfile' on portType 'connect.cfcSoapBinding' from namespace 'http://ws'.
> - Input element soapbind:body of operation 'getGroups' on portType 'connect.cfcSoapBinding' from namespace 'http://ws'.
> - Output element soapbind:body of operation 'getGroups' on portType 'connect.cfcSoapBinding' from namespace 'http://ws'.
> - soapbind:fault 'CFCInvocationException' on operation 'getGroups' on portType 'connect.cfcSoapBinding' from namespace 'http://ws'.
> - Input element soapbind:body of operation 'MessageReply' on portType 'connect.cfcSoapBinding' from namespace 'http://ws'.
> - Output element soapbind:body of operation 'MessageReply' on portType 'connect.cfcSoapBinding' from namespace 'http://ws'.
然后我尝试(在谷歌搜索后)使用以下命令使用 svcutil.exe:
svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config http://www.myurl.com/test.wsdl
但随后收到以下错误(再次修剪):
Warning: Fault named CFCInvocationException in operation getProfile cannot be imported. Unsupported WSDL, the fault message part must reference an element. This fault message does not reference an element. If you have edit access to the WSDL document, you can fix the problem by referencing a schema element using the 'element' attribute.
Warning: Fault named CFCInvocationException in operation getGroups cannot be imported. Unsupported WSDL, the fault message part must reference an element. This fault message does not reference an element. If you have edit access to the WSDL document, you can fix the problem by referencing a schema element using the 'element' attribute.
我也尝试使用/useSerializerForFault 标志(经过更多谷歌搜索),但我再次收到更多错误。
所以我现在不知所措。 PHP 等效项工作正常,一个名为 SOAP UI 的工具也能正常工作,所以我认为这是 Visual Studio/.Net 问题是否正确?
任何帮助都会很棒!
【问题讨论】:
标签: wcf c#-4.0 coldfusion wsdl svcutil.exe