Skip to main content
Participant
October 22, 2018
Answered

Upgrading Standard to Enterprise breaks .NET object method execution

  • October 22, 2018
  • 1 reply
  • 452 views

We just upgraded our CF 10 Standard to CF 13 Enterprise over the weekend and are trying to hammer out some strange bugs.

One example is where we are hitting a .NET web service which returns an object. When we try to execute the .getString() method on this object the value returned is "undefined":

<cfset var recInfo = structnew()>

<cfset var schemaName = "">

<cfset var theArray = arraynew(1)>    

<cfinvoke webservice="#this.JobTicketWS#" method="GetSchemasNames" returnVariable="result" wsversion="1">

     <cfinvokeargument name="inUsername" value="#this.inUserName#">

     <cfinvokeargument name="inPassword" value="#this.inPassword#">

     <cfinvokeargument name="inTicketID" value="#arguments.jobTicketID#">

</cfinvoke>

<cfif result.getString() neq "">

     <cfset theArray = result.getString()>

     <cfset schemaName = theArray[1]><!--- if it's not empty it will always be 1 --->

</cfif>

What the value I am expecting is a single-dimension array of a string.

The error is "theArray is undefined" - when I explicitly dump #result.getString() I get "undefined"

I can execute another function on this very same object that returns a string and it works just fine. Only the methods that return an array that are breaking.

We're on Windows Server 2012 and apparently Java 10 after the upgrade. (we were on Java 😎 with a single CF node.

Any ideas are appreciated.

    This topic has been closed for replies.
    Correct answer carmenj17747405

    FYI, somehow this one little change fixed the problem:

    WAS:

    <cfif result.getString() neq "">

         <cfset theArray = result.getString()>

         <cfset schemaName = theArray[1]><!--- if it's not empty it will always be 1 --->

    </cfif>

    NOW:

    <cfif len(result.getString()) neq 0>

         <cfset theArray = result.getString()>

         <cfset schemaName = theArray[1]>

    </cfif>    

    Somehow, CF sees a difference between an empty string and string of length 0.

    Moving on...and thanks.

    1 reply

    Charlie Arehart
    Community Expert
    Community Expert
    October 22, 2018

    Carmen, what do you see if you just cf dump result. Getstring(), right after the cfinvoke? And then what about that, if anything, is shown in a dump of result itself? 

    /Charlie (troubleshooter, carehart. org)
    Participant
    October 22, 2018

    If I dump the result from the webservice call, I see object:

    getSchemaNames result - object of XMPieWSAPI.ArrayOfString
    Class NameXMPieWSAPI.ArrayOfString
    Methods
    Method Return Type
    equals(java.lang.Object)boolean
    getDeserializer(java.lang.String, java.lang.Class, javax.xml.namespace.QName)org.apache.axis.encoding.Deserializer
    getSerializer(java.lang.String, java.lang.Class, javax.xml.namespace.QName)org.apache.axis.encoding.Serializer
    getString()java.lang.String[]
    getString(int)java.lang.String
    getTypeDesc()org.apache.axis.description.TypeDesc
    hashCode()int
    setString(java.lang.String[])void
    setString(int, java.lang.String)void

    Immediately after the call I am dumping this:

    <cfdump var="#result#" label="getschemanames result">

    <cfif isArray(result.getString())>

         <p>an array!</p> <!--- this, of course, never hits --->

    </cfif>

    <cfoutput>

         <p>result.getTypeDesc() = #result.getTypeDesc()#</p>

    </cfoutput>

    <p>result.getString() = <cfdump var="#result.getString()#" label="result.getString()"></p><cfabort>

    Which results in this output:

    result.getTypeDesc() = org.apache.axis.description.TypeDesc@37fe0266

    result.getString() = undefined

    carmenj17747405AuthorCorrect answer
    Participant
    October 26, 2018

    FYI, somehow this one little change fixed the problem:

    WAS:

    <cfif result.getString() neq "">

         <cfset theArray = result.getString()>

         <cfset schemaName = theArray[1]><!--- if it's not empty it will always be 1 --->

    </cfif>

    NOW:

    <cfif len(result.getString()) neq 0>

         <cfset theArray = result.getString()>

         <cfset schemaName = theArray[1]>

    </cfif>    

    Somehow, CF sees a difference between an empty string and string of length 0.

    Moving on...and thanks.