function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ShamsShams 

ERROR Invalid XML When try to call the web service query/update

I am getting an error as given below when I try to call the method query.

 

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Client</faultcode><faultstring>content-type of the request should be text/xml</faultstring></soapenv:Fault></soapenv:Body></soapenv:Envelope>

 

Statuscode       500 Internal Server Error

 

The Code is given below.

 

<cfset arratest = ArrayNew(1)>

<cfset arratest[1] = 1>

<cfset arratest[2] = 2>

 

<cfinvoke webservice="http://shamseer/projects/Test/Sf/partner.wsdl" method="login" returnvariable="LoginResult">

     <cfinvokeargument value="xxxxxxxxxxxxxxxxxxx">

    <cfinvokeargument value="xxxxxxxxxxxxx">

</cfinvoke>

 

<cfset Url12 = LoginResult.getServerUrl()>

 

<cfhttp url="#Url12#" method="post">

      <cfhttpparam name="queryString" value="SELECT Id, Name FROM Account WHERE Name = 'S'">

      <cfhttpparam name="SOAPAction" value="query">

      <cfhttpparam name="sessionid" value="#LoginResult.getsessionid()#">

</cfhttp>

<cfdump var="#cfhttp#">

 

After this I have given another try with XML as given below.

 

<cfinvoke webservice="http://shamseer/projects/Test/Sf/partner.wsdl" method="login" returnvariable="LoginResult">

     <cfinvokeargument value="xxxxxxxxxxxxxxxxxxx">

    <cfinvokeargument value="xxxxxxxxxxxxxxxxxxx">

</cfinvoke>

 

<cfset Url12 = LoginResult.getServerUrl()>

 

<cfoutput>

<cfsavecontent variable = "querySOAP"><?xml version="1.0" encoding="UTF-8"?>

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">

  <S:Header>

    <ns2:SessionHeader xmlns="urn:fault.partner.soap.sforce.com" xmlns:ns2="urn:partner.soap.sforce.com" xmlns:ns3="urn:sobject.partner.soap.sforce.com">

      <ns2:sessionId><![CDATA[#LoginResult.getsessionid()#]]></ns2:sessionId>

    </ns2:SessionHeader>

    <ns2:CallOptions xmlns="urn:fault.partner.soap.sforce.com" xmlns:ns2="urn:partner.soap.sforce.com" xmlns:ns3="urn:sobject.partner.soap.sforce.com">

      <ns2:client><![CDATA[MIIESzCCA7SgAwIBAgIQe……]]></ns2:client>

      <ns2:defaultNamespace xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>

    </ns2:CallOptions>

  </S:Header>

  <S:Body>

    <ns2:update xmlns="urn:fault.partner.soap.sforce.com" xmlns:ns2="urn:partner.soap.sforce.com" xmlns:ns3="urn:sobject.partner.soap.sforce.com">

      <ns2:sObjects>

        <ns3:type><![CDATA[Opportunity]]></ns3:type>

        <ns3:Id><![CDATA[0064000000Ak5PMAAZ]]></ns3:Id>

        <Name xmlns:ns4="urn:fault.partner.soap.sforce.com" xmlns=""><![CDATA[Invalid-Sale one]]></Name>

      </ns2:sObjects>

    </ns2:update>

  </S:Body>

</S:Envelope></cfsavecontent>

</cfoutput>

 

<cfhttp url="#Url12#" method="post">

    <cfheader value="text/xml; charset=utf-8" />

    <cfhttpparam value="#querySOAP#" />

    <cfhttpparam name="SOAPAction" value="update">

</cfhttp>

 

This shows an error as given below. When I take it in 'Chrome browser'. IE and FF shows similar error saying that invalid XML.

 

This page contains the following errors:

error on line 114 at column 2: StartTag: invalid element name

Below is a rendering of the page up to the first error.

 

Help pls...

 

Thanks in advance...

seekerbillycoxseekerbillycox

Responding to at least part of the question...

 

Cfinvoke requires a name-value pair. (see example)

  

<cfinvoke webservice="SFintegration" method="login" returnvariable="LoginResult">
 <cfinvokeargument name="username" value="your SF username"/>
 <cfinvokeargument name="password" value="your SF password"/>
</cfinvoke>
<cfoutput>LoginResult = #LoginResult#</cfoutput>

 

'SFIntegration' is the name of a webservice that I created using CF Administrator.

The URL for this webservice points to a copy of the Enterprise WSDL file on my server.