1 Reply Latest reply on Oct 21, 2014 8:57 AM by HaroonTyagi

    Passing an Array Collection as a WebService Argument

    ericbelair Level 1
      I am trying to send an Array Collection as WebService argument to a ColdFusion CFC. Here is the SOAP Request:

      <SOAP-ENV:Envelope xmlns:SOAP-ENV=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd=" http://www.w3.org/2001/XMLSchema" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance">
      <SOAP-ENV:Body SOAP-ENV:encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/">
      <impl:iDashboardPage xmlns:impl=" http://cfc.private">
      <NameTxt xsi:type="xsd:string">New</NameTxt>
      <Widgets SOAP-ENC:arrayType="xsd:anyType[]" xsi:type="SOAP-ENC:Array" xmlns:SOAP-ENC=" http://schemas.xmlsoap.org/soap/encoding/">
      <item xsi:type="xsd:anyType">
      <item>
      <NameTxt>Available Cash</NameTxt>
      <WidgetIdNmb>3</WidgetIdNmb>
      </item>
      </item>
      </Widgets>
      </impl:iDashboardPage>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      I get the following SOAP Response:

      <?xml version="1.0" encoding="utf-8"?><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>
      <soapenv:Fault>
      <faultcode>soapenv:Server.userException</faultcode>
      <faultstring>org.xml.sax.SAXException: No deserializer for { http://www.w3.org/2001/XMLSchema}anyType</faultstring>
      <detail>
      <ns1:stackTrace xmlns:ns1=" http://xml.apache.org/axis/">org.xml.sax.SAXException: No deserializer for { http://www.w3.org/2001/XMLSchema}anyType
      at org.apache.axis.encoding.DeserializerImpl.onStartElement(DeserializerImpl.java:453)
      at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:393)
      at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java: 1048)
      at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
      at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
      at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
      at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
      at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:148)
      at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
      at coldfusion.xml.rpc.CFCProvider.invoke(CFCProvider.java:54)
      at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
      at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
      at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
      at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
      at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
      at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
      at coldfusion.xml.rpc.CFCServlet.doAxisPost(CFCServlet.java:270)
      at coldfusion.filter.AxisFilter.invoke(AxisFilter.java:43)
      at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:279)
      at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:48)
      at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40)
      at coldfusion.filter.PathFilter.invoke(PathFilter.java:86)
      at coldfusion.filter.LicenseFilter.invoke(LicenseFilter.java:27)
      at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:70)
      at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:2 8)
      at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
      at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
      at coldfusion.xml.rpc.CFCServlet.invoke(CFCServlet.java:138)
      at coldfusion.xml.rpc.CFCServlet.doPost(CFCServlet.java:289)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
      at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:89)
      at jrun.servlet.FilterChain.doFilter(FilterChain.java:86)
      at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:42 )
      at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:46)
      at jrun.servlet.FilterChain.doFilter(FilterChain.java:94)
      at jrun.servlet.FilterChain.service(FilterChain.java:101)
      at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:106)
      at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
      at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:284)
      at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:543)
      at jrun.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:203)
      at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:320)
      at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:428)
      at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:266)
      at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)
      </ns1:stackTrace>
      <ns2:hostname xmlns:ns2=" http://xml.apache.org/axis/">pcr-client103</ns2:hostname>
      </detail>
      </soapenv:Fault>
      </soapenv:Body>
      </soapenv:Envelope>


      I get a similar response when I try to send a Flex Object (Associative Array) as a WebService argument. Any suggestions? Or is this a bug?

      Thanks.

      Eric.
        • 1. Re: Passing an Array Collection as a WebService Argument
          HaroonTyagi Level 1

          Hi ericbelair,

           

          This error occurs because of anyType. I have tested this, you need to change widgets type to 'xml' and soap request should be like this:

           

          <Widgets>

             <item xsi:type="xsd:anyType">

               <item>

                <NameTxt>Available Cash</NameTxt>

                <WidgetIdNmb>3</WidgetIdNmb>

               </item>

             </item>

            </Widgets>

           

          OR you can change widgets type to 'struct' then your soap request should be like this:

           

          <Widgets xsi:type="x-:Map" xmlns:x-="http://xml.apache.org/xml-soap">

                      <!--Zero or more repetitions:-->

                      <item xsi:type="x-:mapItem">

          <![CDATA[

                         <item>

                <NameTxt>Available Cash</NameTxt>

                <WidgetIdNmb>3</WidgetIdNmb>

               </item>

             

          ]]>

                      </item>

                   </Widgets>

           

          ericbelair if you are just making soap request then better you can just think either Widgets can be xml OR struct and can format your request accordingly.

           

          Please check and let me know if you want anything.