Copy link to clipboard
Copied
I appreciate any clarification provided.
Copy link to clipboard
Copied
Balddog4 wrote:
- I'm trying to understand when I would use cfinvoke vs cfhttp to consume a web service. Is it just two ways to skin a cat?
Yes, they are just two of the ways to consume a web service. Which tag you choose will depend on its qualities, its set of attributes and its arguments. For example, cfhttp is known to use relatively much CPU resources. Nevertheless, cfhttpparam arguments are suitable for making SOAP requests.
2. Does the extension ?wsdl have to be added to the url, or can it be left off? I consume some remote CF services that work without it. Would the wsdl only be used with a remote component if it is to be registered as a component in cfadmin?
3. Do I only need to register web services in cf admin when I don't want to use the full url in the call to the web service?
Note that the WSDL is not yet the web service. It is an interface, analogous to a product catalogue, that gives the web service consumer information about the methods, input parameters and return values of the web service.
The notation someComponent.cfc?wsdl at the end of a URL is a Coldfusion convention. The URL represents the location of the WSDL file that Coldfusion generates from someComponent.cfc. The CFC is the container of the web service proper. It contains the operations which the consumer requests, and which deliver the business service.
Suppose then that you open the file http://my.domain.com/someComponent.cfc?wsdl, and save the WSDL content as the file myWebService, in the same directory as the CFC. Then you could parse the WSDL of the web service by means of the URL http://my.domain.com/myWebService, which has no wsdl extension
Registering a web service in the Administrator is simply a means of giving its WSDL a short name. Suppose you give http://my.domain.com/someComponent.cfc?wsdl the name 'myWS'. It will enable you to write code such as <cfset wsObj = createObject("webservice", "myWS")>, in place of <cfset wsObj = createObject("webservice", "http://my.domain.com/someComponent.cfc?wsdl")>.