I am trying to figure out a way to consume a WCF service I have (wsdl) from Coldfusion. I need to pass values in the request header. I can't seem to find any good examples anywhere. Anyone?
A:
In ColdFusion you can consume webservices using cfinvoke
<cfinvoke
webservice="http://www.somewebservice.com/WebService.wsdl"
method="getWebServiceMethod"
returnvariable="webServiceResult">
<cfinvokeargument name="arg1" value="Arg1"/>
<cfinvokeargument name="arg2" value="Arg2"/>
</cfinvoke>
<cfoutput>The Result is #webServiceResult#</cfoutput>
or CreateObject
<cfscript>
ws = CreateObject("webservice",
"http://www.somewebservice.com/WebService.wsdl");
webServiceResult = ws.getWebServiceMethod("Arg1","Arg2");
writeoutput(webServiceResult);
</cfscript>
Andreas Schuldhaus
2010-04-20 15:13:09
The key part was the "request headers". I need to send a couple values in the request header.
Brian David Berman
2010-04-20 15:20:48
What kind of headers? Could you call the service via cfhttp and send headers with cfhttpparam type="header"? There is also a addSOAPRequestHeader Function but never tried it with a WCF Service.
Andreas Schuldhaus
2010-04-20 16:15:10
+3
A:
I think the functions you want is
AddSOAPRequestHeader(webservice, namespace, name, value [, mustunderstand])
AddSOAPResponseHeader(namespace, name, value[, mustunderstand])
These let you add XML to the request and response headers of your webservice.
Ben Doom
2010-04-20 16:18:43
Edward M Smith
2010-04-20 17:27:32