I have started using CommandBox to run my local applications, and specifically using the CFConfig.json and server.json to set my datasources, mapping, IP, port, etc. I have a requirement to use a webservice for my application, and have not been able to find to set it in the CFConfig.json in the documentation or community forums. I have been able to set it in the administrator after the instance is running, but I was hoping to preempt that step.
Hi @Derek82, when you say “use a webservice”, do you mean a REST web service specifically using the inbuilt REST functionality provided by CF. Also, are you using Adobe ColdFusion or Lucee Server?
Support has been never added into CFConfig for REST mappings for either Adobe or Lucee, mostly because
There’s very little demand for it
The built-in REST sort of sucks (it’s very limited and inflexible)
Not a lot of people use it
You should really just use ColdBox MVC to make REST APIs
All that said, you also mentioned WSDL above so I’m not actually clear if you meant REST or something else. Either way, it’s probably not that hard to add support for whatever it is you’re trying to do-- whatever it is, I’ve just had no need for it myself. The three options here are:
Wait for me to get around to adding it in my free time (probably not happening any time soon)
Send a pull request to add support for it (This is probably the ideal option as a lot of CFConfig feature have been contributed from the community)
Sponsor the feature through Ortus’s professional support (Contact us to get an estimate)
So it really come down to whether you value your money or your time more I’ll gladly help you if you’d like to add support yourself in a pull request. CFConfig is all written in CFML and there’s a lot of examples in the code you can copy from.
Thank you for the reply. I wondered if there no demand for it, but wanted to check that I wasn’t missing something in the documentation.
To clarify in the instance of Adobe ColdFusion, under Data & Services > Web Services, you can register a web service so that you don’t specify the entire URL when invoking the web service, just the alias in the instance of a createObject(‘MyWSDLAlias’, ‘webservice’) for example. In my instance it is an old internal SOAP service on a non-CF platform I am trying to alias in the administrator so that I don’t have to swap the WSDL URL out in each environment for a legacy non-ColdBox application.
From what I can tell the values are stored under the new-xmlrps.xml file in the /cfusion/lib directory, at least for Adobe ColdFusion.
I’ll take a look at the CFConfig repo and see what I can get into.
Oh interesting so you didn’t mean REST. Wow, I almost forgot SOAP even existed, lol. So I’ve actually had a couple people ask about the REST mappings over the years, but you’re literally the first person who has ever asked about the SOAP webservices page. I’m a little confused though because, even though you can manually add SOAP endpoints, I actually thought that page was populated automatically. Ahh, but you can put the URL in the admin and then only use the alias-- I got it. It’s literally been like 10 years since I’ve had to use SOAP so I forgot about that!
So most CFConfig settings are just one-off simple values like request timeout, or default error page. Adding a new simple value is often time just 3 lines of code to get and that that value from the right XML file. Then there are what I call the “complex” settings, which are all a top level struct or array in the JSON. These are mail servers, datasources, caches, etc. These have a bit more pomp and circumstance around them than a “simple” value.
There is a set of 3 commands in the CLI module to save, delete, and list them.
There is a facade method in BaseConfig.cfc for adding a new “item”, which is used in the generic read operation as well as the CLI’s cfconfig xxx save command that helps verify all the correct keys are present
There is some looping logic when reading and writing the config, which often times includes massaging types, class names, custom settings between engines.
I actually don’t think bullet 3 will apply in this case. In fact, I’m not even sure if Lucee supports the same feature-- need to research that. The goal is to implement something that works for both engines where possible. You’ll need to do some testing and see what all bits of data are stored-- if it’s really just an alias name and a URL, that can probably be very simple