4 Replies Latest reply on Jul 7, 2008 6:57 AM by davidsimms

    .NET Web Service

      I created a web service using VB.net that is used to access a handful of .dbf files. The VB.net code works, the files are read and data is returned. I want to be able to access the web service using CF so I can manipulate the data and move it to SQL Server to be accessed via a web application. However, when I try to access the web service I get the following:

      Cannot perform web service invocation GetData.
      The fault returned when invoking the web service operation is:

      faultCode: { http://schemas.xmlsoap.org/soap/envelope/}Server.userException
      faultString: org.xml.sax.SAXException: Deserializing parameter 'GetDataResult': could not find deserializer for type { http://www.w3.org/2001/XMLSchema}anyType
      { http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: Deserializing parameter 'GetDataResult': could not find deserializer for type { http://www.w3.org/2001/XMLSchema}anyType
      at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:277)
      at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java: 1035)
      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.client.Call.invo... ''

      The data is being returned from the web service as xml. The web service converts the DataSet to xml and then returns it to the calling cfc.

      I have racked my mind and scoured the internet looking for information. Any help is greatly appreciated.

        • 1. Re: .NET Web Service
          Can you get the web service to work when it returns a simple data type?

          If so, then Axis may not understand a DataSet. That is one of the issues with .NET web services, is that DataSets are only consumable by other .NET web services.

          You may need to convert the DataSet to XML yourself and send the XML as a string.
          • 2. Re: .NET Web Service
            JR "Bob" Dobbs-qSBHQ2 Level 3
            If your problem is consuming the .NET DataSet from CF take a look at chapter 25 of "Advanced Macromedia ColdFusion MX 7 Application Development" by Ben Forta. The chapter includes a sample converting a .NET DataSet to a ColdFusion struct.

            I would recommend against using the .NET DataSet as the return type for your web services. Only a .NET consumer will understand how to handle DataSets out of the box without needing additional coding. Instead create a class for each type of object you wish to return. If you are new to .NET I can provide a basic sample if you would like one.
            • 3. Re: .NET Web Service
              benjaminAce Level 1
              Thanks for the help.

              I can consume the web service if it returns a simple data type. I will check out the chapter in Ben Forta's book.

              Thanks again.
              • 4. Re: .NET Web Service
                davidsimms Level 1

                I'll share a similar situation which may help you get through yours. I published a web service using CF. One of the parameters passed into this web service was a ColdFusion structure. In fact, it was simply the entire FORM scope (which CF can treat as a structure). It worked fine--when consumed by CF. My challenge was to ensure that it would also be consumable by .NET (or any other language). To do this, I established an XML schema that can be used to represent the entire FORM scope. This permitted .NET consumers to perform some processing against their FORM scope and build what amounts to a string of plain text, marked up with XML, which contains all the name/value pairs submitted through the FORM. When this string is passed into the CF web service, I use CF's isStruct() function to see if it's a CF structure. If yes, processing continues. If not, I use CF's isXML() function to see if it's a string of XML. If so, I use the XMLParse() function to create an XML object out of it which can then be processed and converted into a CF structure--a structure identical to what would have been passed into the web service had it been consumed by a CF to begin with. Works beautifully. Hope that helps.