Skip to main content
June 2, 2009
Question

ColdFusion call to .NET webservice gives org.xml.sax.SAXException

  • June 2, 2009
  • 1 reply
  • 4876 views

We are a small team with one ASP.NET web developer and one ColdFusion developer. Neither of us knows the other's environment. I wrote an ASMX webservice using Visual Studio 2005 and a web application project in Visual Studio 2008 that successfully consumes the web service. But now we are trying to have my ColdFusion colleague consume the webservice and we are getting results we cannot interpret (except to surmise that the target webservice is not even being reached but that some "system layer" used by ColdFusion is failing.

EDIT - update: 02 June 2009:

Top most part of the error message seen by CF developer:

"Could not generate stub objects for web service invocation"

Here is the stack trace seen by the CF client:

org.xml.sax.SAXException: Fatal Error: URI=null Line=11: The element type "META" must be terminated by the matching end-tag "</META>".
    at org
.apache.axis.utils.XMLUtils$ParserErrorHandler.fatalError(XMLUtils.java:723)
    at org
.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
    at org
.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org
.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org
.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
    at org
.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
    at org
.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org
.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org
.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org
.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org
.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org
.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org
.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at org
.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:369)
    at org
.apache.axis.utils.XMLUtils.newDocument(XMLUtils.java:388)
    at coldfusion
.xml.rpc.XmlRpcServiceImpl.retrieveWSDL(XmlRpcServiceImpl.java:647)
    at coldfusion
.xml.rpc.XmlRpcServiceImpl.access$000(XmlRpcServiceImpl.java:51)
    at coldfusion
.xml.rpc.XmlRpcServiceImpl$1.run(XmlRpcServiceImpl.java:208)
    at java
.security.AccessController.doPrivileged(Native Method)
    at coldfusion
.xml.rpc.XmlRpcServiceImpl.registerWebService(XmlRpcServiceImpl.java:201)
    at coldfusion
.xml.rpc.XmlRpcServiceImpl.getWebService(XmlRpcServiceImpl.java:475)
    at coldfusion
.xml.rpc.XmlRpcServiceImpl.getWebServiceProxy(XmlRpcServiceImpl.java:430)
    at coldfusion
.tagext.lang.InvokeTag.doEndTag(InvokeTag.java:381)
    at cfuploadfileSimple2ecfm1056043715
.runPage(D😕😕AMTSTEST\webservice\uploadfileSimple.cfm:68)
    at coldfusion
.runtime.CfJspPage.invoke(CfJspPage.java:152)
    at coldfusion
.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:349)
    at coldfusion
.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
    at coldfusion
.filter.ApplicationFilter.invoke(ApplicationFilter.java:225)
    at coldfusion
.filter.PathFilter.invoke(PathFilter.java:86)
    at coldfusion
.filter.ExceptionFilter.invoke(ExceptionFilter.java:69)
    at coldfusion
.filter.BrowserDebugFilter.invoke(BrowserDebugFilter.java:52)
    at coldfusion
.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28)
    at coldfusion
.filter.BrowserFilter.invoke(BrowserFilter.java:38)
    at coldfusion
.filter.GlobalsFilter.invoke(GlobalsFilter.java:38)
    at coldfusion
.filter.DatasourceFilter.invoke(DatasourceFilter.java:22)
    at coldfusion
.filter.RequestThrottleFilter.invoke(RequestThrottleFilter.java:115)
    at coldfusion
.CfmServlet.service(CfmServlet.java:107)
    at coldfusion
.bootstrap.BootstrapServlet.service(BootstrapServlet.java:78)
    at jrun
.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at jrun
.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at jrun
.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:257)
    at jrun
.servlet.ServletEngineService.dispatch(ServletEngineService.java:541)
    at jrun
.servlet.jrpp.JRunProxyService.invokeRunnable(JRunProxyService.java:204)
    at jrunx
.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:318)
    at jrunx
.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:426)
    at jrunx
.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:264)
    at jrunx
.scheduler.WorkerThread.run(WorkerThread.java:66)

Here is the signature of the webmethod we are attempting to call:

[WebMethod]
   
public string UploadFileBasic(string trimURL
       
, byte[] incomingArray
       
, string FileName
       
, string TrimRecordTypeName)

We are quite confused about how to proceed. Tomorrow I could post the CF source code if that would be useful but from what I've seen it is very straightforward and most of the arguments in the CF invoke of the service are constants (strings) at this point in our unit testing.

Any help or suggestions of appropriate CF forums would be appreciated. Thanks.

EDIT-update 02 June 2009:

Here is the CFML code:

<!--- read test.txt file into a binary variable --->
<cffile action="readBinary"   file="#FileName#" variable="objBinaryData">
<!--- convert the binary variable to Base64 ---> 
<cfset b64file = #toBase64(objBinaryData)#>
<!--- invoke .net web service --->
<cfinvoke webservice =  "http://trim/trimbroker/fileservice.asmx?wsdl"
         
method = "UploadFileBasic"     
         
returnVariable = "recordNumber">
   
<cfinvokeargument name="trimURL" value="trim/trimWSdev/trim.asmx" />
   
<cfinvokeargument name="incomingArray" value="#b64file#" />
   
<cfinvokeargument name="FileName" value="#form.FILENAME#" />
   
<cfinvokeargument name="TrimRecordTypeName" value="Document" />
</cfinvoke>

Please note we have simplified this considerably trying to get things working. Arguments 1 and 4 above are simply string constants. Argument 2 is our attempt at the byte array expected by .Net. We believe we are NOT being rejected by the .Net web service; rather, it appears from the stack trace that it is falling into the SAX exception before the message is even being sent across the network. The .Net webservice does NOT log anything to the application log or system log of the server on which it runs.

The ColdFusion release is: ColdFusion MX 7.

This topic has been closed for replies.

1 reply

Participating Frequently
June 2, 2009

The error message suggest that you're getting plain HTML instead of

WSDL and when CF tries to parse that it fails (and it complains about

the META tag not being closed).

See what you're getting for this URL in a browser:

"http://trim/trimbroker/fileservice.asmx?wsdl" . You should get a XML

document (the description of the web service in xml).

Mack

June 2, 2009

Here is what is in "View Page Source" when that URI is viewed from a browser:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://cbmiweb.com/TrimBroker/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://cbmiweb.com/TrimBroker/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://cbmiweb.com/TrimBroker/">
      <s:element name="UploadFile">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="trimURL" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="incomingArray" type="s:base64Binary" />
            <s:element minOccurs="0" maxOccurs="1" name="FileName" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="TrimRecordTypeName" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="metaDataArray" type="tns:ArrayOfMetaData" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:complexType name="ArrayOfMetaData">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="unbounded" name="MetaData" nillable="true" type="tns:MetaData" />
        </s:sequence>
      </s:complexType>
      <s:complexType name="MetaData">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" name="Name" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="Value" type="s:string" />
        </s:sequence>
      </s:complexType>
      <s:element name="UploadFileResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="UploadFileResult" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="UploadFileBasic">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="trimURL" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="incomingArray" type="s:base64Binary" />
            <s:element minOccurs="0" maxOccurs="1" name="FileName" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="TrimRecordTypeName" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="UploadFileBasicResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="UploadFileBasicResult" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="DownloadFile">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="recNumString" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="DownloadFileResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="1" maxOccurs="1" name="DownloadFileResult" type="s:boolean" />
            <s:element minOccurs="0" maxOccurs="1" name="docContents" type="s:base64Binary" />
            <s:element minOccurs="0" maxOccurs="1" name="returnFiletype" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
    </s:schema>
  </wsdl:types>
  <wsdl:message name="UploadFileSoapIn">
    <wsdl:part name="parameters" element="tns:UploadFile" />
  </wsdl:message>
  <wsdl:message name="UploadFileSoapOut">
    <wsdl:part name="parameters" element="tns:UploadFileResponse" />
  </wsdl:message>
  <wsdl:message name="UploadFileBasicSoapIn">
    <wsdl:part name="parameters" element="tns:UploadFileBasic" />
  </wsdl:message>
  <wsdl:message name="UploadFileBasicSoapOut">
    <wsdl:part name="parameters" element="tns:UploadFileBasicResponse" />
  </wsdl:message>
  <wsdl:message name="DownloadFileSoapIn">
    <wsdl:part name="parameters" element="tns:DownloadFile" />
  </wsdl:message>
  <wsdl:message name="DownloadFileSoapOut">
    <wsdl:part name="parameters" element="tns:DownloadFileResponse" />
  </wsdl:message>
  <wsdl:portType name="FileServiceSoap">
    <wsdl:operation name="UploadFile">
      <wsdl:input message="tns:UploadFileSoapIn" />
      <wsdl:output message="tns:UploadFileSoapOut" />
    </wsdl:operation>
    <wsdl:operation name="UploadFileBasic">
      <wsdl:input message="tns:UploadFileBasicSoapIn" />
      <wsdl:output message="tns:UploadFileBasicSoapOut" />
    </wsdl:operation>
    <wsdl:operation name="DownloadFile">
      <wsdl:input message="tns:DownloadFileSoapIn" />
      <wsdl:output message="tns:DownloadFileSoapOut" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="FileServiceSoap" type="tns:FileServiceSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="UploadFile">
      <soap:operation soapAction="http://cbmiweb.com/TrimBroker/UploadFile" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="UploadFileBasic">
      <soap:operation soapAction="http://cbmiweb.com/TrimBroker/UploadFileBasic" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="DownloadFile">
      <soap:operation soapAction="http://cbmiweb.com/TrimBroker/DownloadFile" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="FileServiceSoap12" type="tns:FileServiceSoap">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="UploadFile">
      <soap12:operation soapAction="http://cbmiweb.com/TrimBroker/UploadFile" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="UploadFileBasic">
      <soap12:operation soapAction="http://cbmiweb.com/TrimBroker/UploadFileBasic" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="DownloadFile">
      <soap12:operation soapAction="http://cbmiweb.com/TrimBroker/DownloadFile" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="FileService">
    <wsdl:port name="FileServiceSoap" binding="tns:FileServiceSoap">
      <soap:address location="http://trim/trimbroker/fileservice.asmx" />
    </wsdl:port>
    <wsdl:port name="FileServiceSoap12" binding="tns:FileServiceSoap12">
      <soap12:address location="http://trim/trimbroker/fileservice.asmx" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

The CF people are trying to call the webmethod called FileUploadBasic in the WSDL above which takes 4 arguments. How can we (should we?) verify that proper maintenance (hotfixes, servicepacks, etc.) have been applied to our version of ColdFusion MX 7 part of which is this xerces parser which seems to be involved (see stack trace)?

Participating Frequently
June 3, 2009

The error message makes me believe that you're not pointing the

webservice attribute of the cfinvoke tag to the wsdl location but to a

HTML page (the error refers to a meta tag which does not exist in the

wsdl). Check that the CF code really points to the wsdl url.

Mack