User Guide

Table Of Contents
Publishing web services 905
output = "no"
access = "remote">
<cfargument name="empid" required="yes" type="numeric">
<cfset var fullname = "">
<cfquery name="empinfo" datasource="cfdocexamples">
SELECT emp_id, firstname, lastname
FROM employee
WHERE emp_id = <cfqueryparam cfsqltype="cf_sql_integer"
value="#arguments.empid#">
</cfquery>
<cfif empinfo.recordcount gt 0>
<cfset fullname = empinfo.lastname & ", " & empinfo.firstname>
<cfelse>
<cfset fullname = "not found">
</cfif>
<cfreturn #fullname#>
</cffunction>
</cfcomponent>
The cfcomponent tag includes optional attributes that you can use to control the WSDL that
ColdFusion generates. You can use these attributes to create meaningful WSDL attribute names,
as the following example shows:
<cfcomponent style="document"
namespace = "http://www.mycompany.com/"
serviceportname = "RestrictedEmpInfo"
porttypename = "RestrictedEmpInfo"
bindingname = "myns:RestrictedEmpInfo"
displayname = "RestrictedEmpInfo"
hint = "RestrictedEmpInfo">
Tip: For complete control of the WSDL, advanced users can specify the
cfcomponent wsdlFile
attribute to use a predefined WSDL file.
Securing your web services
You can restrict access to your published web services to control the users allowed to invoke them.
You can use your web server to control access to the directories containing your web services, or
you can use ColdFusion security in the same way that you would to control access to any
ColdFusion page.
Controlling access to component CFC files
To browse the HTML description of a CFC file, you request the file by specifying a URL to the
file in your browser. By default, ColdFusion secures access to all URLs that directly reference a
CFC file, and prompts you to enter a password upon the request. Use the ColdFusion RDS
password to view the file.
To disable security on CFC file browsing, use the ColdFusion MX Administrator to disable the
RDS password.
For more information, see Chapter 10, “Building and Using ColdFusion Components, on
page 201.