Issues/Errors consuming Coldfusion generated SOAP service in .Net 4 WCF

旧时模样 提交于 2019-12-08 06:45:26

问题


I have a .Net 4 project that has to consume a SOAP Web Service. I have had some experience adding web references in Visual Studio (2008/2010), and I use the web service reference tools.

Before I begin:

I have uploaded the WSDL to http://pastebin.com/huSE0Qeh

So to my problem:

I added my Web service reference to my project, the classes and methods were generated and I wrote some basic code for testing. I have had the code confimed by those responsible for the service and by getting my PHP counterpart to generate some PHP files from the same WSDL.

The issue is that the response object contains null properties. I do not get an exception.

What I Tried Next:

I tried using WSDL.exe to create the class files, which it did but again I get a null in the response object. I also saw the following errors (I have trimmed them down):

> 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'.

I then tried (after Googling) using the svcutil.exe using the following command:

svcutil.exe /language:cs /out:generatedProxy.cs /config:app.config http://www.myurl.com/test.wsdl

But then received the following errors (trimmed down again):

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.

I also tried (after more Googling) using the /useSerializerForFault flag but again I received more errors.

So I am now at a loss. The PHP equivalent works fine and so does a tool called SOAP UI, so am I right in thinking this is a Visual Studio/.Net issue?

Any help would be great!


回答1:


After many hours of trial and error it was "discovered" that having attributes set to encoded rather than literal was the culprit. Visual Studio was having issues dealing with this and thankfully the Coldfusion developers changed to literal for me.




回答2:


It seems the ColdFusion WSDL definition of their CFCInvocationException fault is not acceptable to the Visual Studio proxy generators. You could try figuring out how to tweak the WSDL to get the WCF (or ASMX) proxy generator to accept it but I'd recommend you simply remove the fault definition altogether from the WSDL.

A fault definition is used to produce strongly-type versions of the WCF FaultException generic (don't remember what happens in ASMX land). If you remove the "offending" fault definition from the WSDL, you could lose some detail information it may contain but you'll still be able to catch the fault if it is thrown. At least do this as a first step to getting a successful call to the ColdFusion service, you can always circle back and add-in the fault WSDL later.



来源:https://stackoverflow.com/questions/10209067/issues-errors-consuming-coldfusion-generated-soap-service-in-net-4-wcf

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