How to use ColdFusion web service using dotnet

In SOAP and web services, I have no experience at all. I am trying to call the ColdFusion web service with C # (.NET 4.0). I am creating a proxy from WSDL using svcutil.exe. The web service works when I call ListCases from the SoapUI, but when I call it from the proxy, I get a map with one mapItem element, and mapItem has a null element and a value. I would suggest that this does not work, because WSDL does not include a QueryBean definition. If this is a problem, I will try to force the author of the web service to add a definition, otherwise I have any options other than manually parse the XML?

<wsdl:definitions xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://syndication.v63" xmlns:intf="http://syndication.v63" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://rpc.xml.coldfusion" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://syndication.v63"> <!-- WSDL created by ColdFusion version 9,0,1,274733 --> <wsdl:types> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xml.apache.org/xml-soap"> <import namespace="http://rpc.xml.coldfusion"/> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/> <complexType name="mapItem"> <sequence> <element name="key" nillable="true" type="xsd:anyType"/> <element name="value" nillable="true" type="xsd:anyType"/> </sequence> </complexType> <complexType name="Map"> <sequence> <element maxOccurs="unbounded" minOccurs="0" name="item" type="apachesoap:mapItem"/> </sequence> </complexType> </schema> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://rpc.xml.coldfusion"> <import namespace="http://xml.apache.org/xml-soap"/> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/> <complexType name="CFCInvocationException"> <sequence/> </complexType> </schema> </wsdl:types> <wsdl:message name="ListCasesResponse"> <wsdl:part name="ListCasesReturn" type="apachesoap:Map"/> </wsdl:message> <wsdl:message name="FolderDetailsResponse"> <wsdl:part name="FolderDetailsReturn" type="apachesoap:Map"/> </wsdl:message> <wsdl:message name="ListBoxesRequest"> <wsdl:part name="CaseDatabase" type="xsd:string"/> <wsdl:part name="Prefix" type="xsd:string"/> </wsdl:message> <wsdl:message name="ListFoldersRequest"> <wsdl:part name="CaseDatabase" type="xsd:string"/> <wsdl:part name="Prefix" type="xsd:string"/> <wsdl:part name="Box" type="xsd:string"/> </wsdl:message> <wsdl:message name="CFCInvocationException"> <wsdl:part name="fault" type="tns1:CFCInvocationException"/> </wsdl:message> <wsdl:message name="ListPrefixesRequest"> <wsdl:part name="CaseDatabase" type="xsd:string"/> </wsdl:message> <wsdl:message name="ListFoldersResponse"> <wsdl:part name="ListFoldersReturn" type="apachesoap:Map"/> </wsdl:message> <wsdl:message name="ListPrefixesResponse"> <wsdl:part name="ListPrefixesReturn" type="apachesoap:Map"/> </wsdl:message> <wsdl:message name="FolderDetailsRequest"> <wsdl:part name="CaseDatabase" type="xsd:string"/> <wsdl:part name="Prefix" type="xsd:string"/> <wsdl:part name="Box" type="xsd:string"/> <wsdl:part name="Folder" type="xsd:string"/> </wsdl:message> <wsdl:message name="ListCasesRequest"></wsdl:message> <wsdl:message name="ListBoxesResponse"> <wsdl:part name="ListBoxesReturn" type="apachesoap:Map"/> </wsdl:message> <wsdl:portType name="Ricoh_syndication"> <wsdl:operation name="ListCases"> <wsdl:input message="impl:ListCasesRequest" name="ListCasesRequest"/> <wsdl:output message="impl:ListCasesResponse" name="ListCasesResponse"/> <wsdl:fault message="impl:CFCInvocationException" name="CFCInvocationException"/> </wsdl:operation> <wsdl:operation name="FolderDetails" parameterOrder="CaseDatabase Prefix Box Folder"> <wsdl:input message="impl:FolderDetailsRequest" name="FolderDetailsRequest"/> <wsdl:output message="impl:FolderDetailsResponse" name="FolderDetailsResponse"/> <wsdl:fault message="impl:CFCInvocationException" name="CFCInvocationException"/> </wsdl:operation> <wsdl:operation name="ListFolders" parameterOrder="CaseDatabase Prefix Box"> <wsdl:input message="impl:ListFoldersRequest" name="ListFoldersRequest"/> <wsdl:output message="impl:ListFoldersResponse" name="ListFoldersResponse"/> <wsdl:fault message="impl:CFCInvocationException" name="CFCInvocationException"/> </wsdl:operation> <wsdl:operation name="ListPrefixes" parameterOrder="CaseDatabase"> <wsdl:input message="impl:ListPrefixesRequest" name="ListPrefixesRequest"/> <wsdl:output message="impl:ListPrefixesResponse" name="ListPrefixesResponse"/> <wsdl:fault message="impl:CFCInvocationException" name="CFCInvocationException"/> </wsdl:operation> <wsdl:operation name="ListBoxes" parameterOrder="CaseDatabase Prefix"> <wsdl:input message="impl:ListBoxesRequest" name="ListBoxesRequest"/> <wsdl:output message="impl:ListBoxesResponse" name="ListBoxesResponse"/> <wsdl:fault message="impl:CFCInvocationException" name="CFCInvocationException"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="ricoh_syndication.cfcSoapBinding" type="impl:Ricoh_syndication"> <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="ListCases"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="ListCasesRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://syndication.v63" use="encoded"/> </wsdl:input> <wsdl:output name="ListCasesResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://syndication.v63" use="encoded"/> </wsdl:output> <wsdl:fault name="CFCInvocationException"> <wsdlsoap:fault encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="CFCInvocationException" namespace="http://syndication.v63" use="encoded"/> </wsdl:fault> </wsdl:operation> <wsdl:operation name="FolderDetails"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="FolderDetailsRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://syndication.v63" use="encoded"/> </wsdl:input> <wsdl:output name="FolderDetailsResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://syndication.v63" use="encoded"/> </wsdl:output> <wsdl:fault name="CFCInvocationException"> <wsdlsoap:fault encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="CFCInvocationException" namespace="http://syndication.v63" use="encoded"/> </wsdl:fault> </wsdl:operation> <wsdl:operation name="ListFolders"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="ListFoldersRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://syndication.v63" use="encoded"/> </wsdl:input> <wsdl:output name="ListFoldersResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://syndication.v63" use="encoded"/> </wsdl:output> <wsdl:fault name="CFCInvocationException"> <wsdlsoap:fault encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="CFCInvocationException" namespace="http://syndication.v63" use="encoded"/> </wsdl:fault> </wsdl:operation> <wsdl:operation name="ListPrefixes"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="ListPrefixesRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://syndication.v63" use="encoded"/> </wsdl:input> <wsdl:output name="ListPrefixesResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://syndication.v63" use="encoded"/> </wsdl:output> <wsdl:fault name="CFCInvocationException"> <wsdlsoap:fault encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="CFCInvocationException" namespace="http://syndication.v63" use="encoded"/> </wsdl:fault> </wsdl:operation> <wsdl:operation name="ListBoxes"> <wsdlsoap:operation soapAction=""/> <wsdl:input name="ListBoxesRequest"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://syndication.v63" use="encoded"/> </wsdl:input> <wsdl:output name="ListBoxesResponse"> <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://syndication.v63" use="encoded"/> </wsdl:output> <wsdl:fault name="CFCInvocationException"> <wsdlsoap:fault encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" name="CFCInvocationException" namespace="http://syndication.v63" use="encoded"/> </wsdl:fault> </wsdl:operation> </wsdl:binding> <wsdl:service name="Ricoh_syndicationService"> <wsdl:port binding="impl:ricoh_syndication.cfcSoapBinding" name="ricoh_syndication.cfc"> <wsdlsoap:address location="https://www2.delium.com/v6-3/syndication/ricoh_syndication.cfc"/> </wsdl:port> </wsdl:service> </wsdl:definitions> 

and the result (I changed it to have a shorter list of data and not contain confidential information)

 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <ns1:ListCasesResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://syndication.v63"> <ListCasesReturn xsi:type="ns2:Map" xmlns:ns2="http://xml.apache.org/xml-soap"> <item xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> <key xsi:type="soapenc:string">RETURNCODE</key> <value xsi:type="soapenc:string">1</value> </item> <item> <key xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">RETURNTEXT</key> <value xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">Success (1)</value> </item> <item> <key xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">OUTPUTS</key> <value xsi:type="ns2:Map"> <item xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"> <key xsi:type="soapenc:string">QCASES</key> <value xsi:type="ns3:QueryBean" xmlns:ns3="http://rpc.xml.coldfusion"> <columnList soapenc:arrayType="xsd:string[2]" xsi:type="soapenc:Array"> <columnList xsi:type="xsd:string">CASENAME</columnList> <columnList xsi:type="xsd:string">CASEDATABASE</columnList> </columnList> <data soapenc:arrayType="xsd:anyType[][35]" xsi:type="soapenc:Array"> <data soapenc:arrayType="xsd:anyType[2]" xsi:type="soapenc:Array"> <data xsi:type="soapenc:string">test1</data> <data xsi:type="soapenc:string">test2</data> </data> </data> </value> </item> <item> <key xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">REMOTEIPADDRESS</key> <value xsi:type="soapenc:string" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">219.89.202.100</value> </item> </value> </item> </ListCasesReturn> </ns1:ListCasesResponse> </soapenv:Body> </soapenv:Envelope> 
+6
source share
1 answer

yes it looks like this: WSDL does not have a specific type of ns3: QueryBean, and the proxy server cannot serialize it to this type; The best option is to ask the author of the web service to provide you with all the necessary types. They must have already defined all types at their end, so it would be easier to get their XSDs that have type definitions or WSDL that contains types.

In the case when they dynamically generate random types (for example: QueryBean, Foo, Foobar), etc., then you may be out of luck, and in this case there is no other way than manually moving the xml.

+2
source

Source: https://habr.com/ru/post/910306/


All Articles