Skip to main content
Known Participant
June 29, 2009
Answered

Need Web Service Consumption Assistance

  • June 29, 2009
  • 2 replies
  • 2849 views

I am dipping my toe into the web service world and have a web service from Oracle that I am trying to consume. It is not working as I thought, so any pointers are appreciated.

Here is the cfinvoke code...

<cfinvoke
webservice="http://erpintsrv1-dc-aus:7777/arWs/arWsSoapHttpPort?WSDL"
method="customerXML"
returnvariable="a_customerXMLResponseElement">
    <cfinvokeargument name="parameters" value="123456" />
</cfinvoke>

<cfdump var="#a_customerXMLResponseElement#">

Here is the result...

Here is the result from the Oracle interface...

<env:Envelope
  xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:ns0="http://xxas/integration/arws/ArWs.wsdl/types/">
<env:Body>
  <ns0:customerXMLResponseElement>
   <result>
    <ROWSET>
     <ROW
       num="1">
      <CUSTOMER_NUMBER>123456</CUSTOMER_NUMBER>
      <CUSTOMER>MOUNTAIN BUILDING  SUPPLY, INC #8228</CUSTOMER>
      <PLATFORM>500</PLATFORM>
     </ROW>
    </ROWSET>
   </result>
  </ns0:customerXMLResponseElement>
</env:Body>
</env:Envelope>

My thought was once I invoked the web service and dumped it to the page, I would see the above info (customer name, platform, etc.)  Instead, I seem to get java class names, methods, etc. Thoughts?

This topic has been closed for replies.
Correct answer JR__Bob__Dobbs-qSBHQ2

Here is the XML that is returned...

<result>

     <ROWSET>

          <ROW num="1">

               <CUSTOMER_NUMBER>019889</CUSTOMER_NUMBER>

               <CUSTOMER>MOUNTAIN BUILDING SUPPLY, INC #8228</CUSTOMER>

               <PLATFORM>500</PLATFORM>

          </ROW>

     </ROWSET>

</result>

What do you recommend?


I'd use Xpath via CF's XMLSearch function to search the result document and pull out the data you need.  See a basic sample below.  If this sample doesn't fit your needs please let me know.

For an overview of Xpath see http://msdn.microsoft.com/en-us/library/ms256115.aspx

<!--- sample data --->
<cfsavecontent variable="serviceResult">
    <result>
         <ROWSET>
              <ROW num="1">
                   <CUSTOMER_NUMBER>019889</CUSTOMER_NUMBER>
                   <CUSTOMER>MOUNTAIN BUILDING SUPPLY, INC #8228</CUSTOMER>
                   <PLATFORM>500</PLATFORM>
              </ROW>
         </ROWSET>
    </result>
</cfsavecontent>

<!--- use XML functions to parse and search serivceResult data  --->

<!--- we expect the results from the service to be XML, but its always good to check --->
<cfif IsXml(serviceResult)>
   
    <!--- create an XML object that CF's XML functions can use --->
    <cfset xmlResult=XmlParse(serviceResult, true) />

    <!--- check for a customer number of 019889, will return an array of matching objects
    Note that second parameter for XmlSearch function is an Xpath expresssion
     --->
    <cfset customerSearch=XmlSearch(xmlResult, '/result/ROWSET/ROW/CUSTOMER_NUMBER[.="019889"]') />
    <cfif ArrayLen(customerSearch) gt 0>
        Customer found
    <cfelse>
        Customer not found
    </cfif>
</cfif>

2 replies

Inspiring
June 30, 2009

Warning: this is a shot in the dark.

Does a cfdump of a_customerXMLResponseElement.get_any() return an XML document or CF struct?  This Oracle service's "get_any()" method in your cfdump looks similar to how CF interprets .NET datasets returned from a web service.  In a .NET web service the SOAP type "any" is used when the results are to be sent as XML without a specific schema.

Can you post the WSDL for this web service?

fs22Author
Known Participant
July 1, 2009

Here is the dump of getAny()...

array
1
object of  org.apache.axis.message.MessageElement
Class Nameorg.apache.axis.message.MessageElement
Methods
Method Return Type
addAttribute(java.lang.String, java.lang.String,  javax.xml.namespace.QName)void
addAttribute(java.lang.String, java.lang.String,  java.lang.String, java.lang.String)void
addAttribute(java.lang.String, java.lang.String,  java.lang.String)void
addAttribute(javax.xml.soap.Name,  java.lang.String)javax.xml.soap.SOAPElement
addChild(org.apache.axis.message.MessageElement)void
addChildElement(java.lang.String)javax.xml.soap.SOAPElement
addChildElement(javax.xml.soap.SOAPElement)javax.xml.soap.SOAPElement
addChildElement(java.lang.String,  java.lang.String, java.lang.String)javax.xml.soap.SOAPElement
addChildElement(javax.xml.soap.Name)javax.xml.soap.SOAPElement
addChildElement(java.lang.String,  java.lang.String)javax.xml.soap.SOAPElement
addMapping(org.apache.axis.utils.Mapping)void
addNamespaceDeclaration(java.lang.String,  java.lang.String)javax.xml.soap.SOAPElement
addTextNode(java.lang.String)javax.xml.soap.SOAPElement
cloneNode(boolean)org.w3c.dom.Node
detachAllChildren()void
equals(java.lang.Object)boolean
getAllAttributes()java.util.Iterator
getAsDOM()org.w3c.dom.Element
getAsDocument()org.w3c.dom.Document
getAsString()java.lang.String
getAttribute(java.lang.String)java.lang.String
getAttributeNS(java.lang.String,  java.lang.String)java.lang.String
getAttributeNode(java.lang.String)org.w3c.dom.Attr
getAttributeNodeNS(java.lang.String,  java.lang.String)org.w3c.dom.Attr
getAttributeValue(java.lang.String)java.lang.String
getAttributeValue(javax.xml.soap.Name)java.lang.String
getAttributesEx()org.xml.sax.Attributes
getChildElement(javax.xml.namespace.QName)org.apache.axis.message.MessageElement
getChildElements(javax.xml.soap.Name)java.util.Iterator
getChildElements(javax.xml.namespace.QName)java.util.Iterator
getChildElements()java.util.Iterator
getChildren()java.util.List
getCompleteAttributes()org.xml.sax.Attributes
getDeserializationContext()org.apache.axis.encoding.DeserializationContext
getElementName()javax.xml.soap.Name
getElementsByTagName(java.lang.String)org.w3c.dom.NodeList
getElementsByTagNameNS(java.lang.String,  java.lang.String)org.w3c.dom.NodeList
getEncodingStyle()java.lang.String
getEnvelope()org.apache.axis.message.SOAPEnvelope
getFixupDeserializer()org.apache.axis.encoding.Deserializer
getHref()java.lang.String
getID()java.lang.String
getLength()int
getName()java.lang.String
getNamespacePrefixes()java.util.Iterator
getNamespaceURI(java.lang.String)java.lang.String
getObjectValue(java.lang.Class)java.lang.Object
getObjectValue()java.lang.Object
getOwnerDocument()org.w3c.dom.Document
getPrefix(java.lang.String)java.lang.String
getQName()javax.xml.namespace.QName
getRealElement()org.apache.axis.message.MessageElement
getRecorder()org.apache.axis.message.SAX2EventRecorder
getTagName()java.lang.String
getType()javax.xml.namespace.QName
getValue()java.lang.String
getValueAsType(javax.xml.namespace.QName)java.lang.Object
getValueAsType(javax.xml.namespace.QName,  java.lang.Class)java.lang.Object
getVisibleNamespacePrefixes()java.util.Iterator
hasAttribute(java.lang.String)boolean
hasAttributeNS(java.lang.String,  java.lang.String)boolean
isRoot()boolean
item(int)org.w3c.dom.Node
output(org.apache.axis.encoding.SerializationContext)void
publishContents(org.xml.sax.ContentHandler)void
publishToHandler(org.xml.sax.ContentHandler)void
removeAttribute(java.lang.String)void
removeAttribute(javax.xml.soap.Name)boolean
removeAttributeNS(java.lang.String,  java.lang.String)void
removeAttributeNode(org.w3c.dom.Attr)org.w3c.dom.Attr
removeContents()void
removeNamespaceDeclaration(java.lang.String)boolean
setAllAttributes(org.xml.sax.Attributes)void
setAttribute(java.lang.String, java.lang.String,  java.lang.String)void
setAttribute(java.lang.String,  java.lang.String)void
setAttributeNS(java.lang.String,  java.lang.String, java.lang.String)void
setAttributeNode(org.w3c.dom.Attr)org.w3c.dom.Attr
setAttributeNodeNS(org.w3c.dom.Attr)org.w3c.dom.Attr
setContentsIndex(int)void
setEncodingStyle(java.lang.String)void
setEndIndex(int)void
setEnvelope(org.apache.axis.message.SOAPEnvelope)void
setFixupDeserializer(org.apache.axis.encoding.Deserializer)void
setNSMappings(java.util.ArrayList)void
setName(java.lang.String)void
setNamespaceURI(java.lang.String)void
setObjectValue(java.lang.Object)void
setQName(javax.xml.namespace.QName)void
setRecorder(org.apache.axis.message.SAX2EventRecorder)void
setType(javax.xml.namespace.QName)void
setValue(java.lang.String)void
toString()java.lang.String
Fields
Field Value
short ATTRIBUTE_NODE2
short CDATA_SECTION_NODE4
short COMMENT_NODE8
short DOCUMENT_FRAGMENT_NODE11
short DOCUMENT_NODE9
short DOCUMENT_POSITION_CONTAINED_BY16
short DOCUMENT_POSITION_CONTAINS8
short DOCUMENT_POSITION_DISCONNECTED1
short DOCUMENT_POSITION_FOLLOWING4
short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC32
short DOCUMENT_POSITION_PRECEDING2
short DOCUMENT_TYPE_NODE10
short ELEMENT_NODE1
short ENTITY_NODE6
short ENTITY_REFERENCE_NODE5
short NOTATION_NODE12
short PROCESSING_INSTRUCTION_NODE7
short TEXT_NODE3
java.util.ArrayList namespaces[undefined value]
Parent Class
object  org.apache.axis.message.NodeImpl
Class Nameorg.apache.axis.message.NodeImpl
Methods
Method Return Type
appendChild(org.w3c.dom.Node)org.w3c.dom.Node
cloneNode(boolean)org.w3c.dom.Node
detachNode()void
getAttributes()org.w3c.dom.NamedNodeMap
getChildNodes()org.w3c.dom.NodeList
getFirstChild()org.w3c.dom.Node
getLastChild()org.w3c.dom.Node
getLocalName()java.lang.String
getNamespaceURI()java.lang.String
getNextSibling()org.w3c.dom.Node
getNodeName()java.lang.String
getNodeType()short
getNodeValue()java.lang.String
getOwnerDocument()org.w3c.dom.Document
getParentElement()javax.xml.soap.SOAPElement
getParentNode()org.w3c.dom.Node
getPrefix()java.lang.String
getPreviousSibling()org.w3c.dom.Node
getValue()java.lang.String
hasAttributes()boolean
hasChildNodes()boolean
insertBefore(org.w3c.dom.Node,  org.w3c.dom.Node)org.w3c.dom.Node
isDirty()boolean
isSupported(java.lang.String,  java.lang.String)boolean
normalize()void
output(org.apache.axis.encoding.SerializationContext)void
recycleNode()void
removeChild(org.w3c.dom.Node)org.w3c.dom.Node
replaceChild(org.w3c.dom.Node,  org.w3c.dom.Node)org.w3c.dom.Node
setDirty(boolean)void
setNodeValue(java.lang.String)void
setOwnerDocument(org.w3c.dom.Document)void
setParentElement(javax.xml.soap.SOAPElement)void
setPrefix(java.lang.String)void
setValue(java.lang.String)void

fs22Author
Known Participant
July 1, 2009

Here is the WSDL...

<?xml  version="1.0" encoding="UTF-8" ?>
- <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://xxas/integration/arws/ArWs.wsdl/types/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://xxas/integration/arws/ArWs.wsdl" name="arWs" targetNamespace="http://xxas/integration/arws/ArWs.wsdl">
- <types>
- <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://xxas/integration/arws/ArWs.wsdl/types/" targetNamespace="http://xxas/integration/arws/ArWs.wsdl/types/" elementFormDefault="qualified">
<element name="contactXMLElement" type="string" nillable="true" />
- <element name="contactXMLResponseElement" nillable="true">
- <complexType>
- <sequence>
<any />
</sequence>
</complexType>
</element>
<element name="contactXMLRowSetElement" type="string" nillable="true" />
- <element name="contactXMLRowSetResponseElement" nillable="true">
- <complexType>
- <sequence>
<any />
</sequence>
</complexType>
</element>
<element name="customerBillToXMLElement" type="string" nillable="true" />
- <element name="customerBillToXMLResponseElement" nillable="true">
- <complexType>
- <sequence>
<any />
</sequence>
</complexType>
</element>
<element name="customerBillToXMLRowSetElement" type="string" nillable="true" />
- <element name="customerBillToXMLRowSetResponseElement" nillable="true">
- <complexType>
- <sequence>
<any />
</sequence>
</complexType>
</element>
<element name="customerShipToXMLElement" type="string" nillable="true" />
- <element name="customerShipToXMLResponseElement" nillable="true">
- <complexType>
- <sequence>
<any />
</sequence>
</complexType>
</element>
<element name="customerShipToXMLRowSetElement" type="string" nillable="true" />
- <element name="customerShipToXMLRowSetResponseElement" nillable="true">
- <complexType>
- <sequence>
<any />
</sequence>
</complexType>
</element>
<element name="customerXMLElement" type="string" nillable="true" />
- <element name="customerXMLResponseElement" nillable="true">
- <complexType>
- <sequence>
<any />
</sequence>
</complexType>
</element>
<element name="customerXMLRowSetElement" type="string" nillable="true" />
- <element name="customerXMLRowSetResponseElement" nillable="true">
- <complexType>
- <sequence>
<any />
</sequence>
</complexType>
</element>
<element name="salesrepXMLElement" type="string" nillable="true" />
- <element name="salesrepXMLResponseElement" nillable="true">
- <complexType>
- <sequence>
<any />
</sequence>
</complexType>
</element>
<element name="salesrepXMLRowSetElement" type="string" nillable="true" />
- <element name="salesrepXMLRowSetResponseElement" nillable="true">
- <complexType>
- <sequence>
<any />
</sequence>
</complexType>
</element>
</schema>
</types>
- <message name="ArWs_contactXML">
<part name="parameters" element="ns1:contactXMLElement" />
</message>
- <message name="ArWs_contactXMLResponse">
<part name="result" element="ns1:contactXMLResponseElement" />
</message>
- <message name="ArWs_contactXMLRowSet">
<part name="parameters" element="ns1:contactXMLRowSetElement" />
</message>
- <message name="ArWs_contactXMLRowSetResponse">
<part name="result" element="ns1:contactXMLRowSetResponseElement" />
</message>
- <message name="ArWs_customerBillToXML">
<part name="parameters" element="ns1:customerBillToXMLElement" />
</message>
- <message name="ArWs_customerBillToXMLResponse">
<part name="result" element="ns1:customerBillToXMLResponseElement" />
</message>
- <message name="ArWs_customerBillToXMLRowSet">
<part name="parameters" element="ns1:customerBillToXMLRowSetElement" />
</message>
- <message name="ArWs_customerBillToXMLRowSetResponse">
<part name="result" element="ns1:customerBillToXMLRowSetResponseElement" />
</message>
- <message name="ArWs_customerShipToXML">
<part name="parameters" element="ns1:customerShipToXMLElement" />
</message>
- <message name="ArWs_customerShipToXMLResponse">
<part name="result" element="ns1:customerShipToXMLResponseElement" />
</message>
- <message name="ArWs_customerShipToXMLRowSet">
<part name="parameters" element="ns1:customerShipToXMLRowSetElement" />
</message>
- <message name="ArWs_customerShipToXMLRowSetResponse">
<part name="result" element="ns1:customerShipToXMLRowSetResponseElement" />
</message>
- <message name="ArWs_customerXML">
<part name="parameters" element="ns1:customerXMLElement" />
</message>
- <message name="ArWs_customerXMLResponse">
<part name="result" element="ns1:customerXMLResponseElement" />
</message>
- <message name="ArWs_customerXMLRowSet">
<part name="parameters" element="ns1:customerXMLRowSetElement" />
</message>
- <message name="ArWs_customerXMLRowSetResponse">
<part name="result" element="ns1:customerXMLRowSetResponseElement" />
</message>
- <message name="ArWs_salesrepXML">
<part name="parameters" element="ns1:salesrepXMLElement" />
</message>
- <message name="ArWs_salesrepXMLResponse">
<part name="result" element="ns1:salesrepXMLResponseElement" />
</message>
- <message name="ArWs_salesrepXMLRowSet">
<part name="parameters" element="ns1:salesrepXMLRowSetElement" />
</message>
- <message name="ArWs_salesrepXMLRowSetResponse">
<part name="result" element="ns1:salesrepXMLRowSetResponseElement" />
</message>
- <portType name="arWs">
- <operation name="contactXML">
<input message="tns:ArWs_contactXML" />
<output message="tns:ArWs_contactXMLResponse" />
</operation>
- <operation name="contactXMLRowSet">
<input message="tns:ArWs_contactXMLRowSet" />
<output message="tns:ArWs_contactXMLRowSetResponse" />
</operation>
- <operation name="customerBillToXML">
<input message="tns:ArWs_customerBillToXML" />
<output message="tns:ArWs_customerBillToXMLResponse" />
</operation>
- <operation name="customerBillToXMLRowSet">
<input message="tns:ArWs_customerBillToXMLRowSet" />
<output message="tns:ArWs_customerBillToXMLRowSetResponse" />
</operation>
- <operation name="customerShipToXML">
<input message="tns:ArWs_customerShipToXML" />
<output message="tns:ArWs_customerShipToXMLResponse" />
</operation>
- <operation name="customerShipToXMLRowSet">
<input message="tns:ArWs_customerShipToXMLRowSet" />
<output message="tns:ArWs_customerShipToXMLRowSetResponse" />
</operation>
- <operation name="customerXML">
<input message="tns:ArWs_customerXML" />
<output message="tns:ArWs_customerXMLResponse" />
</operation>
- <operation name="customerXMLRowSet">
<input message="tns:ArWs_customerXMLRowSet" />
<output message="tns:ArWs_customerXMLRowSetResponse" />
</operation>
- <operation name="salesrepXML">
<input message="tns:ArWs_salesrepXML" />
<output message="tns:ArWs_salesrepXMLResponse" />
</operation>
- <operation name="salesrepXMLRowSet">
<input message="tns:ArWs_salesrepXMLRowSet" />
<output message="tns:ArWs_salesrepXMLRowSetResponse" />
</operation>
</portType>
- <binding name="arWsSoapHttp" type="tns:arWs">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <operation name="contactXML">
<soap:operation soapAction="http://xxas/integration/arws/ArWs.wsdl/contactXML" />
- <input>
<soap:body use="literal" />
</input>
- <output>
<soap:body use="literal" parts="result" />
</output>
</operation>
- <operation name="contactXMLRowSet">
<soap:operation soapAction="http://xxas/integration/arws/ArWs.wsdl/contactXMLRowSet" />
- <input>
<soap:body use="literal" />
</input>
- <output>
<soap:body use="literal" parts="result" />
</output>
</operation>
- <operation name="customerBillToXML">
<soap:operation soapAction="http://xxas/integration/arws/ArWs.wsdl/customerBillToXML" />
- <input>
<soap:body use="literal" />
</input>
- <output>
<soap:body use="literal" parts="result" />
</output>
</operation>
- <operation name="customerBillToXMLRowSet">
<soap:operation soapAction="http://xxas/integration/arws/ArWs.wsdl/customerBillToXMLRowSet" />
- <input>
<soap:body use="literal" />
</input>
- <output>
<soap:body use="literal" parts="result" />
</output>
</operation>
- <operation name="customerShipToXML">
<soap:operation soapAction="http://xxas/integration/arws/ArWs.wsdl/customerShipToXML" />
- <input>
<soap:body use="literal" />
</input>
- <output>
<soap:body use="literal" parts="result" />
</output>
</operation>
- <operation name="customerShipToXMLRowSet">
<soap:operation soapAction="http://xxas/integration/arws/ArWs.wsdl/customerShipToXMLRowSet" />
- <input>
<soap:body use="literal" />
</input>
- <output>
<soap:body use="literal" parts="result" />
</output>
</operation>
- <operation name="customerXML">
<soap:operation soapAction="http://xxas/integration/arws/ArWs.wsdl/customerXML" />
- <input>
<soap:body use="literal" />
</input>
- <output>
<soap:body use="literal" parts="result" />
</output>
</operation>
- <operation name="customerXMLRowSet">
<soap:operation soapAction="http://xxas/integration/arws/ArWs.wsdl/customerXMLRowSet" />
- <input>
<soap:body use="literal" />
</input>
- <output>
<soap:body use="literal" parts="result" />
</output>
</operation>
- <operation name="salesrepXML">
<soap:operation soapAction="http://xxas/integration/arws/ArWs.wsdl/salesrepXML" />
- <input>
<soap:body use="literal" />
</input>
- <output>
<soap:body use="literal" parts="result" />
</output>
</operation>
- <operation name="salesrepXMLRowSet">
<soap:operation soapAction="http://xxas/integration/arws/ArWs.wsdl/salesrepXMLRowSet" />
- <input>
<soap:body use="literal" />
</input>
- <output>
<soap:body use="literal" parts="result" />
</output>
</operation>
</binding>
- <service name="arWs">
- <port name="arWsSoapHttpPort" binding="tns:arWsSoapHttp">
<soap:address location="http://erpintsrv1-dc-aus:7777/arWs/arWsSoapHttpPort" />
</port>
</service>
</definitions>

fs22Author
Known Participant
June 30, 2009

Anyone out there have any thoughts on this?