lempertv
asked on
Coldfusion SOAP Web Service Requests issue
Hi there!
I have a ColdFusion 9 server. I need to make a SOAP Web Service request using Coldfusion but it does not work. The way it should work: coldfusion page sends a filtered SOAP service request to a remote (non coldfusion) server and the returned page needs to be saved to a DB. I tried to follow Ben Nadel samples (http://www.bennadel.com/blog/1809-making-soap-web-service-requests-with-coldfusion-and-cfhttp.htm) but I'm getting a BLANK page in return.
Here is my request page:
<cfsavecontent variable="soapBody">
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<sch:GetClient>
<!--Optional:-->
<sch:request>
<sch:RequestHeader>
<!--Optional:-->
<sch:ClientVersion>1001</s ch:ClientV ersion>
<!--Optional:-->
<sch:CustomerKey>123456789 </sch:Cust omerKey>
<!--Optional:-->
<sch:Password>MyPassword</ sch:Passwo rd>
<!--Optional:-->
<sch:User>user@MyDomain.co m</sch:Use r>
</sch:RequestHeader>
<!--Optional:-->
<sch:Filter>
<!--Optional:-->
<sch:ClientID>456</sch:Cli entID>
</sch:Filter>
</sch:request>
</sch:GetClient>
</soapenv:Body>
</soapenv:Envelope>
</cfsavecontent>
<cfhttp url="https://webservice.domain.com/services/soap/2.1/Services.svc?wsdl" method="post" result="httpResponse">
<cfhttpparam type="header" name="SOAPAction" value="https://webservice.domain.com/services/soap/2.1/GetClient"/>
<cfhttpparam type="header" name="accept-encoding" value="no-compression"/>
<cfhttpparam type="xml" value="#trim( soapBody )#"/>
</cfhttp>
<cfif find( "200", httpResponse.statusCode )>
<cfset soapResponse = xmlParse( httpResponse.fileContent ) />
<cfset responseNodes = xmlSearch(
soapResponse,
"//*[ local-name() = 'GetClient' ]"
) />
<cfoutput>
Code: #responseNodes[ 1 ].Code.xmlText#
<br />
Success: #responseNodes[ 1 ].Message.xmlText#
</cfoutput>
</cfif>
I dont know why it does not work.
Thanks for your help!
I have a ColdFusion 9 server. I need to make a SOAP Web Service request using Coldfusion but it does not work. The way it should work: coldfusion page sends a filtered SOAP service request to a remote (non coldfusion) server and the returned page needs to be saved to a DB. I tried to follow Ben Nadel samples (http://www.bennadel.com/blog/1809-making-soap-web-service-requests-with-coldfusion-and-cfhttp.htm) but I'm getting a BLANK page in return.
Here is my request page:
<cfsavecontent variable="soapBody">
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<sch:GetClient>
<!--Optional:-->
<sch:request>
<sch:RequestHeader>
<!--Optional:-->
<sch:ClientVersion>1001</s
<!--Optional:-->
<sch:CustomerKey>123456789
<!--Optional:-->
<sch:Password>MyPassword</
<!--Optional:-->
<sch:User>user@MyDomain.co
</sch:RequestHeader>
<!--Optional:-->
<sch:Filter>
<!--Optional:-->
<sch:ClientID>456</sch:Cli
</sch:Filter>
</sch:request>
</sch:GetClient>
</soapenv:Body>
</soapenv:Envelope>
</cfsavecontent>
<cfhttp url="https://webservice.domain.com/services/soap/2.1/Services.svc?wsdl" method="post" result="httpResponse">
<cfhttpparam type="header" name="SOAPAction" value="https://webservice.domain.com/services/soap/2.1/GetClient"/>
<cfhttpparam type="header" name="accept-encoding" value="no-compression"/>
<cfhttpparam type="xml" value="#trim( soapBody )#"/>
</cfhttp>
<cfif find( "200", httpResponse.statusCode )>
<cfset soapResponse = xmlParse( httpResponse.fileContent ) />
<cfset responseNodes = xmlSearch(
soapResponse,
"//*[ local-name() = 'GetClient' ]"
) />
<cfoutput>
Code: #responseNodes[ 1 ].Code.xmlText#
<br />
Success: #responseNodes[ 1 ].Message.xmlText#
</cfoutput>
</cfif>
I dont know why it does not work.
Thanks for your help!
Are you still looking to resolve this issue?
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.