【问题标题】:Issues/Errors consuming Coldfusion generated SOAP service in .Net 4 WCF在 .Net 4 WCF 中使用 Coldfusion 生成的 SOAP 服务的问题/错误
【发布时间】: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


    【解决方案1】:

    经过数小时的反复试验,“发现”将属性设置为encoded 而不是literal 是罪魁祸首。 Visual Studio 在处理这个问题时遇到了问题,谢天谢地,Coldfusion 开发人员为我更改为 literal

    【讨论】:

      【解决方案2】:

      似乎他们的CFCInvocationException 故障的 ColdFusion WSDL 定义对于 Visual Studio 代理生成器来说是不可接受的。您可以尝试弄清楚如何调整 WSDL 以使 WCF(或 ASMX)代理生成器接受它,但我建议您从 WSDL 中完全删除故障定义。

      错误定义用于生成 WCF FaultException 泛型的强类型版本(不记得在 ASMX 领域发生了什么)。如果您从 WSDL 中删除“有问题的”故障定义,您可能会丢失它可能包含的一些详细信息,但如果它被抛出,您仍然能够捕捉到故障。至少这样做是成功调用 ColdFusion 服务的第一步,您可以随时返回并在以后添加错误的 WSDL。

      【讨论】:

        猜你喜欢
        • 2013-05-02
        • 1970-01-01
        • 1970-01-01
        • 2013-07-03
        • 1970-01-01
        • 2011-05-08
        • 2020-04-11
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多