Skip to main content
Participant
March 23, 2012
Question

web service wsdl problem

  • March 23, 2012
  • 1 reply
  • 2143 views

I have a very simple web service cfc file that uses another cfc component in the returntype. Both cfc files are on the same directory in the server. It fails to register (wsdl) on the CF server. If I change the returntype of the web service call to "any" it would work. Anyone has any idea? Below is the code:

----------

authentication_wsapi.cfc

    <cfcomponent>

      <cffunction name="getManagers"

              access="remote"

              returntype="User"

              output="no">

            <cfobject component="User" name="ret">

            <cfreturn ret>

      </cffunction>

    </cfcomponent>

-----------

User.cfc

    <cfcomponent>

      <cfproperty name="loginName" type="string">

    </cfcomponent>

-----------

url to test:

http://wsapi.my.com/authentication_wsapi.cfc?wsdl

-----------

Error I got:

AXIS error

Sorry, something seems to have gone wrong... here are the details:

Exception - java.lang.NoClassDefFoundError: user

java.lang.NoClassDefFoundError: user

    at java.lang.Class.getDeclaredMethods0(Native Method)

    at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)

    at java.lang.Class.getDeclaredMethod(Class.java:1935)

    at org.apache.axis.description.JavaServiceDesc.loadServiceDescByIntrospection(JavaServiceDesc.java:863)

-------------

If I modify authentication_wsapi.cfc as below (only difference is the returntype) it will work:

        <cfcomponent>

      <cffunction name="getManagers"

              access="remote"

              returntype="any"                        <----- changed from "User" to "any"

              output="no">

            <cfobject component="User" name="ret">

            <cfreturn ret>

      </cffunction>

    </cfcomponent>

----------------------

It seems authentication_wsapi.cfc can not see the User.cfc on the same dir. BUT the "cfobject" call to create the User component is not complaining though. Any help will be apprecriated!

This topic has been closed for replies.

1 reply

BKBK
Community Expert
Community Expert
March 23, 2012

It could be because the function definition doesn't yet know what the type User is (given that this is defined later within the function). Does this do any better:

<cfcomponent>

     <cfobject component="User" name="ret">

      <cffunction name="getManagers"

              access="remote"

              returntype="User"

              output="no">       

            <cfreturn ret>

      </cffunction>

    </cfcomponent>

guosamAuthor
Participant
March 23, 2012

Hi BKBK, I tried it and it didn't work. Same error.

Also I would like it to create the object only when the function is called (there will be many other functions in the file) so I prefer it to be inside the function - if it ever works

BKBK
Community Expert
Community Expert
March 23, 2012

Your CF version?

Added update: I ask because I know for sure that ColdFusion versions since MX 6.1 may use the attribute returntype="component_name" in the cffunction tag.