ColdFusion 2021 Returns "object is not an instance of declaring class"

144 Views Asked by At

We are upgrading our ColdFusion server from version 2016 to 2021. The following code works in 2016, but gives "object is not an instance of declaring class" with the 2021 version:

Application.UserWebService = CreateObject("webservice", Application.Settings.ws_url & "Requests/UserService.asmx?WSDL", oWsdlArgs);
addSOAPRequestHeader(Application.UserWebService,"","",objSoapHeader,true);

Application.WhiteLabelService = CreateObject("webservice", Application.Settings.ws_url & "Requests/WhiteLabelService.asmx?WSDL", oWsdlArgs);
addSOAPRequestHeader(Application.WhiteLabelService,"","",objSoapHeader,true);

Application.EmailService = CreateObject("webservice", Application.Settings.ws_url & "Requests/EmailService.asmx?WSDL", oWsdlArgs);
addSOAPRequestHeader(Application.EmailService, "", "", objSoapHeader, true);

// This struct is to be added as the last parameter in all WebService calls which require a LanguageHeader
Application.LanguageHeader = structNew();
Application.LanguageHeader.locale = "en-CA";

// Get the .Net resources
Application.NetResources = Application.UserWebService.GetNetResources(Application.LanguageHeader); 

// Initialize resource manager
createObject("component", "#Application.GlobalComponentPath#ResourceManager").init(Application.Settings.defaultBaseCategory);

The error occurs at the call to GetNetResources().

When the calls are re-ordered, with the LanguageHeader being created and initialized first, the error goes away:

// This struct is to be added as the last parameter in all WebService calls which require a LanguageHeader
Application.LanguageHeader = structNew();
Application.LanguageHeader.locale = "en-CA";

Application.UserWebService = CreateObject("webservice", Application.Settings.ws_url & "Requests/UserService.asmx?WSDL", oWsdlArgs);
addSOAPRequestHeader(Application.UserWebService,"","",objSoapHeader,true);

// Get the .Net resources
Application.NetResources = Application.UserWebService.GetNetResources(Application.LanguageHeader); 

Application.EmailService = CreateObject("webservice", Application.Settings.ws_url & "Requests/EmailService.asmx?WSDL", oWsdlArgs);
addSOAPRequestHeader(Application.EmailService, "", "", objSoapHeader, true);

Application.WhiteLabelService = CreateObject("webservice", Application.Settings.ws_url & "Requests/WhiteLabelService.asmx?WSDL", oWsdlArgs);
addSOAPRequestHeader(Application.WhiteLabelService,"","",objSoapHeader,true);

// Initialize resource manager
createObject("component", "#Application.GlobalComponentPath#ResourceManager").init(Application.Settings.defaultBaseCategory);

We haven't been able to determine why this is happening. Has there been a change in the way that CF manages web services? Is there a setting that needs to be modified?

Thanks!

0

There are 0 best solutions below