Webservice Providing with XML Type Argument

Posted on 2006-03-22
Last Modified: 2013-12-24
I'm working on writing a Webservice in MX 7. I have an argument defined as input type XML.  If I use the function isXML, isXMLDoc, or any of the other isXML functions on the argument, they return false. If I use isObject, it returns true. Any idea on how to process the passed argument as an XML object?

Right now, for testing, I'm using
<cfset xmObj = getSOAPRequest()>
<cfset xmarg = xmobj.xmlroot..xmlChildren[1].xmlChildren[1].xmlChildren[1]>

To get down to the level that I want to start processing.
I'd like to not do that and just have the argument BE and xml object. Any ideas?
Question by:RCorfman
    LVL 18

    Accepted Solution


    Pass it in as type string, use XmlParse to get it to an XML object.

    LVL 16

    Author Comment

    No can do. I'm getting a complex document object from another system integrating with us. I have to accept an XML Object.  String wants to translate all those < and > symbols and won't work.  I have it working using getSoapRequest, but it seems strange.
    Why, when I declare the argument as an XML Type, and I'm receiving an XML Type, isn't it defined as and xmltype with isXMLDoc or isXMLElement?
    It does return true with isObject, but what the heck type of Object is it?
    LVL 18

    Expert Comment

    I think that you will find that the XML attribute type is XML text not XML object.

    Have you tried not specifying a type and seeing what it comes through as.
    LVL 16

    Author Comment

    If I output the #argname#, the value is:
    [#document: null]
    LVL 16

    Author Comment

    Maybe I misunderstood. I need the wsdl file to show something for the argument. It is bad enough with the xml type argument, as it shows an as
    <wsdl:message name="myServiceRequest">
      <wsdl:part name="argname" type="apachesoap:Document" />

    If I don't specify a type at all, then it uses the default... string
    LVL 16

    Author Comment

    I should have CFDumped it to start with.
    <CFDUMP var="#argname#">
    Turns out it is an object
    object of org.apache.xerces.dom.DeferredDocumentImpl
    It has a ton of methods, which you can see with CFDUMP.
    I think it is probably somewhat of a waste of resources to turn around and store it in a CF XMLtype since it appears to be a Java XML Type, but I don't know that I want to mix up java 'stuff' in with my CF Page since I don't really know java, at least not well.
    I'll at least post how to get it into a CM XML variable once I get to that point for posterity.
    LVL 16

    Author Comment

    <CFSET xmlString = argname.getNodeObject(1)>
    <cfdump var="#xmlString#">
    <CFSET xmlStringName = xmlString.getNodeName()>
    <cfdump var="#xmlStringName#">

    I was able to get the xmlStringName to be a normal string in cf that had my root element name of the passed in document, but I decided I don't know enough about that java class, org.apache.xerces.dom.DeferredDocumentImpl  to be able to dump it int a CF Xml object. I'm going to keep playing with the soapEnvelope, but this seems like a hard way to go. I'm still not overjoyed that XML webservice input type doesn't actually give a coldfusion xml object. It maybe that there really are efficiencies with using a DeferredDocumentImpl Java object, but it is beyond me for now.
    LVL 16

    Author Comment

    In the end, this was a more serious problem. Turns out coldfusion is not resolving the multiRef that websphere was passing to the webservice. CF7, at least in this initial version that we are using is broken in my opinion. type="xml" with a cfargument is broken, broken, broken. Not only does it not pass in a coldfusion xml variable (instead that java object), it also doesn't resolve the multiRef if it is utilized. I poked around with the DOM for the document using the Java object and found enough to know that I can't use it. I'd have to resort to using the entire envelope and I don't want to have to code the code to decode all those multiRef's websphere is passing... they are valid, but it is ugly.

    In the end, we've mad the determiniation that both systems will go with the string object and I'll parse it from there.  The entire reason for upgrading from mx7 from 6 was to enable using the xml type and I can't anyway... go figure. I guess upgrading isn't a bad thing, but still frustrating.  Thanks for the help Plucka.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
    Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now