Skip to main content
Known Participant
September 10, 2010
Question

web service for inserting record

  • September 10, 2010
  • 2 replies
  • 1002 views

Anyone here has suggestion on how to insert data thru web service.  Basically, I am connecting to a wsdl and want able to insert data from a local database to wsdl (which is a third party database).  Any suggestions on how do I start or where to read and what to read?

Thanks.

    This topic has been closed for replies.

    2 replies

    September 11, 2010

    In general the web service is going to have methods defined for inserting data and you simply need to format the request correctly.  It depends on the webservice though.  It is the choice of the host and developer of the webservice regarding what functions are available and it's always possible that they have not exposed a way to insert/update data.  I would look for documentation on the Web Service API from the 3rd party and they may describe the available methods, required datatypes and formats.

    -Joe

    Known Participant
    September 13, 2010

    Thanks. I've read the 3rd party documentation.  What I need to able to read the xml header or the XS element to get the fields and match those fields with local fields to be able insert.  I need to be able to parse and read the element name below to get the fields, how would I able to read in CF?

    <?xml version="1.0" encoding="utf-8" ?>

    - <DataSet xmlns="http://domain.com">

    - <xs:schema id="1234Data" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">

    - <xs:element name="1234Data" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">

    - <xs:complexType>

    - <xs:choice minOccurs="0" maxOccurs="unbounded">

    - <xs:element name="Messages">

    - <xs:complexType>

    - <xs:sequence>

      <xs:element name="MsgText" type="xs:string" minOccurs="0" />

      <xs:element name="MsgLevel" type="xs:string" minOccurs="0" />

      </xs:sequence>

      </xs:complexType>

      </xs:element>

    - <xs:element name="PersonNewData">

    - <xs:complexType>

    - <xs:sequence>

      <xs:element name="ID" type="xs:string" minOccurs="0" />

      <xs:element name="FirstName" type="xs:string" minOccurs="0" />

      <xs:element name="LastName" type="xs:string" minOccurs="0" />

      <xs:element name="Company" type="xs:string" minOccurs="0" />

      <xs:element name="Email" type="xs:string" minOccurs="0" />

      </xs:sequence>

      </xs:complexType>

      </xs:element>

      </xs:choice>

      </xs:complexType>

      </xs:element>

      </xs:schema>

    Inspiring
    September 13, 2010

    You could use the XmlParse function to convert an XML string into a CF struct object.

    I'd review the CF documentation regarding XML.

    "XML functions"

    http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec1a60c-7ffc.html#WSc3ff6d0ea77859461172e0811cbec22c24-69fb

    "Using XML and WDDX"

    http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7fb3.html

    I’d also take a look at Ben Forta's books

    http://forta.com/books/0321679199/

    Inspiring
    September 10, 2010

    Can you clarify your question and describe the workflow you are trying to accomplish?  As a general answer you would use CFQUERY for database operations and CFOBJECT or CFINVOKE for working with a SOAP web service.  You might start by reading the "Using Web Services" section of the CF documentation.

    http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7fbf.html