Skip to main content
Participant
September 18, 2023
Question

Webservice call not working any more in CF 2016

  • September 18, 2023
  • 1 reply
  • 373 views

I have been migrating some old ColdFusion MX 7 applications to CF2016. I am currently stuck on a code which is calling a webservice. It works without any error in MX7 but fails to find the Web service operation in CF2016.

Below is how the code is written in MX7:

<cfscript>
//Printer validation
printername = structNew() ;
printername.pid = "1221";
//printername.command = "PRINTERS"&#url.branch_loc#;
printername.command ="PRINTERS185";
//printername.command = "PRINTERSALL";
 
printername.locale = "en-CA";
 
Application.UserWebService = CreateObject("webservice","http://weburl:9115/wsdl/WWS001.wsdl");
 
printerdtls  = Application.UserWebService.WWS001Operation(printername);
printerdtlsreq  = printerdtls.TABLEOUT;
 
isprntrvalid="no";
for(i=1;i LTE ArrayLen(printerdtlsreq);i=i+1)
{
tempprntrData = UCase(printerdtlsreq[i].TNAME);
//writeOutput(tempprntrData & "<bR />");
 
}
writeoutput(#ArrayLen(printerdtlsreq)#);
END;
</cfscript>
I get list of Printers like : PRTDEL
 
However while running the same code in CF2016 I get the following error:
Cannot perform web service invocation WWS001Operation.
 
While calling using cfinvoke I get the error:
 
Web service operation WWS001Operation with parameters {wws001request.command={PRINTERS185},wws001request.pid={1221}} cannot be found.
 
Not able to find any work around for this.
    This topic has been closed for replies.

    1 reply

    Charlie Arehart
    Community Expert
    Community Expert
    September 18, 2023

    Sachin, that's of course a big leap (7-16, and yet short of the supported versions 21 and 23). That may explain why you're not readily finding help.

     

    There can be a couple of possible issues. I'll start with my guess of the most likely. 

     

    First, you may be running into the change in cf10 (from 2012) when Adobe switched cf to use an updated version of webservices (wsdl and soap specifications). More important it defaults to that updated version (2), and your issue may be that the web service you're calling is still using the old capabilites. As such, you'd want to change cf to tell it to call out using version 1.

     

    You can do that either of 3 ways:

    1. in the cf admin on the web services page (setting the default for all web service processing in that Cf instance, both calling/consuming and serving/publishing them),
    2. at the application level, controlling the default level for either consuming or publishing web services in that app
    3. At the code level, whether in consuming/invoking a web service with cfobject/CreateObject, or in defining a CFC to be published as a webservice.

     

    If this is indeed your problem, then a simple solution would be to add the wsversion on your createobject, as in

    CreateObject("webservice","http://weburl:9115/wsdl/WWS001.wsdl",{wsversion=1});

    There is ample documentation from Adobe on this and the other two options above, and I have additional resources with more if needed).

     

    Second, if somehow that's not it, note that sometimes what causes unexpected problems is that the new cf version will often have a far newer Java version underlying it. And sometimes there's a need to change something about that, whether addressing the change (to revert or accommodate it) or sometimes even updating the jvm still further (since the one that comes with a given cf installer will be an older update to that given jvm version). But let's not elaborate further.

     

    Let us know if the first option above gets you going. You may also want to explain why you stopped at cf2016 on such a recent upgrade. That last got updates (including very important security fixes) in 2021. And cf2018 stopped getting them this July. There was a critical security improvement in August that Adobe added only to those currently supported versions, cf2023 and cf2021. 

    /Charlie (troubleshooter, carehart. org)
    SachinKCAuthor
    Participant
    September 19, 2023

    Thanks Charlie for your reply.

     

    I tried setting WS Version to 1 in CF Admin and as well as in the code. But it did not seem to work.

     

    As for being stuck on CF2016, we received the environment from the client. They currently have no intention to move newwer supported version. But I will try arguing with them. Do let me know is any benefit with license cost are provided if they move from exisitng older version to new version.

     

    Ill try find more details of the error being thrown in logs.

    Charlie Arehart
    Community Expert
    Community Expert
    September 19, 2023

    Bummer that my first guess didn't work out. Still plenty more to consider. And while your check of the logs may not offer much, I propose a couple of diagnostics that may really help. I just didn't want to overwhelm you/others in my first reply. 

     

    1) As for my second proposed possible explanation (possible Java version issues), you didn't address that. If you visit the cf admin "settings summary" page what Java version is reported?

     

    2) But here's another important diagnostic you can gather: take that url that you name for getting the wsdl and put it in a cfhttp call instead. Then do a cfdump/writedump of the cfhttp variable (a struct that is returned). What does it show, especially for the filecontent key? The latter SHOULD be xml (and you may need to do a "view source" in your browser in order to see that xml). If it's not, that could be why the createobject/cfinvoke attempts fail. It expects ONLY xml, and perhaps you're getting html (with some message) in response. 

     

    3)  Still further, is the cf2016 instance implemented on a machine separate from where cf7 had been? I assume they are at least both in the same network, both having access this "web url" you name and it's 9115 port. The cfhttp above may better spot if it's complaining of that.

     

    4) If instead IT DOES show xml being returned, then did this cf2016 EVER call this web service in the past, before your failed attempts? If that's possible, the problem could be with the resulting "java stub" that cf creates (and saves). It may be that the web service and its methods or properties have changes dld since then.

     

    If that is the case, you need to tell cf to "refresh" that stub based on the "new" wsdl (which may have changed AFTER cf2016 originally called it, whether days, weeks, months, or years ago). You can also do THAT either in the cf admin or in the code calling the web service.

     

    In the cf admin, see the web services page. Does it list this wsdl url? If so, click the refresh button next to it. Or in code, add a refreshwsdl="true" either as an attribute of the cfinvoke or as a different (or comma-separated additional) argument in that 3rd arg (struct) of the CreateObject above. Again, if you Google the terms: coldfusion refreshwsdl, you'll find ample resources on this, including past blog posts from me.

     

    5) Before answering your question about updating, I will add that if somehow none of this is still enough to get you going, you need not suffer through days of back and forth here. I could help directly, remotely, and quickly via my consulting services. More on my rates, approach, satisfaction guarantee, online calendar, and more at carehart.org/consulting. But I realize some can't or won't pay for help. As you can see, I'm not holding your problem hostage. And I have still more ideas and details as may be needed, depending on what you may say in response to the diagnostics above.

     

    6) Finally, you ask about the benefits of versions greater than cf2016. They're too many to list. Instead, see the "hidden gems" talks I've done on each release, where I also show briefly the major new features in addition to uncovering the less heralded--but sometimes more important--changes in each release. Those are at carehart.org/presentations. (I also have one on migrating to cf2021, covering changes from each of the past several releases). 

     

    But really the strongest motivator should be what I said before: that cf2016 stopped getting important security updates in 2021. Companies that ignore that over "the cost of paying for a new license" are gambling in Russian roulette. And to be clear, Adobe is not unusual in dropping support for a product after 5 years.

     

    7) Indeed, some would want to point out that you could /should consider the free cf alternative called Lucee, but to this last point they do also stop supporting/updating older versions after some years. So keeping things updated (including the jvm underlying either) is all just part of good hygiene that must be practiced when running especially web-facing software.

     

    But I get it: some are in situations where they feel (or feel forced) to do nothing but "keep the lights on", touching as little as possible, and being "unafraid of ghosts".  Again, as you can see, I'm trying to help you whatever way may work for you.

     

    I really hope your solution is in my points 2, 3, or 4 above. I know it's been a lot to read. Especially with my last point, I write not just for you but as well for others who find this in the future, facing a similar situation.  🙂 

    /Charlie (troubleshooter, carehart. org)