Jul 17
Manually configuring a ColdFusion webservice endpoint URL
Posted by James Netherton | Tuesday 17 July 2007 12:07 PM | In ColdFusion
I came across a interesting ColdFusion webservice gotcha today. I have a web server that uses Apache to reverse proxy certain requests from port 80 to IIS which is running off of port 8080.
When you view the WSDL generated by ColdFusion on a component that has remote methods, CF will detect the port that it’s running under and will append this to the endpoint URL for each service.
For example, for a service running under port 8080, the endpoint definition might look like the following:
<wsdlsoap:address location="http://www.somewebsite.com:8080/someWebService.cfc"/>
For the service call to work correctly, I’d have to explicitly invoke the service via port 8080. Because I was reverse proxying requests from port 80, I couldn’t do this. I needed some way of changing the endpoint URL so that it doesn’t obey the :8080 bit on the wsdlsoap:address declaration. Here’s how to do it:
<cfscript>
ws = createObject("webservice"," http://www.somewebsite.com/someWebService.cfc?wsdl");
ws._setProperty("javax.xml.rpc.service.endpoint.address","http://www.somewebsite.com/someWebService.cfc");
</cfscript>
Credits go to an old post from Tom Jordahl for helping me figure this out.