c# - How to consume a ColdFusion web service with dotnet -
i'm not experienced @ in soap , web services. i'm trying call coldfusion web service c# (.net 4.0). i'm generating proxy wsdl svcutil.exe. web service works when call listcases soapui, when call proxy map single mapitem, , mapitem has null item , value. guess isn't working because wsdl doesn't include definition querybean. if problem i'll try , author of web service add definition, otherwise have options other parsing xml manually?
<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 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 result(i've modified have shorter list of data , 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>
yes looks wsdl doesnt have ns3:querybean type defined , proxy cant de-serialize type; best option ask author of webservice provide necessary types. must have defined types @ end might easier xsd's have type definitions or wsdl contains types.
in case dynamically generating random types (eg: querybean, foo, foobar) etc might out of luck , in case there no other way manually traversing xml.
Comments
Post a Comment