3 Replies Latest reply on May 31, 2007 1:10 PM by insuractive

    Broken webservice behavior in CF 7.0.2?

    insuractive Level 3
      I've managed to consume a webservice that uses a complex data type as one of its input parameters on my DEVELOPMENT machine (WinXP, CF Dev 7,0,0,91690). I get the following error when I move the code up to our STAGING server (Win2003, CF Standard 7,0,2,142559):

      Error converting CFML arguments to Java classes for web service invocation.
      Unable to create web service argument class [Ljava.lang.String;. Error: java.lang.InstantiationException: [Ljava.lang.String;. Often this is because the web service defines an abstract complexType as an input to an operation. You must create an actual instance of this type in Java.

      It looks like my development server is creating the propper stub objects for the complex types (i.e. class files in the C:\CfusionMX7\stubs\ directory) , but the staging server is not. I'm hiting the same WSDL from both servers and the complex type is clearly defined in the wsdl, so I don't know why one server would interpret it correctly and the other can not. Is this a bug in CF webservice implementation?

      Can anyone tell me:
      1) How I can get my staging server (Win2003, CF Standard 7,0,2,142559) to generate the propper stubs


      2) A work around? I know I CAN use wsdl2java.exe to generate the stubs manually, I'm just having a hard time with the HOW:
      - I've executed wsdl2java.exe [url-of-wsdl] to create the java files
      - From what I've read on the forums, I think I should be able to use the code below to compile the java objects into stubs, but it doesn't seem to work:
      • I can generate the class file for the specific missing stub, then move it to the correct directory in cfusionmx7/stubs, but I still get the same error[/li]
      • If i try to generate stubs for all the java files, I get errors.[/li]

        The code I use to compile the java files is listed below:

        javac -source 1.4 -deprecation -classpath C:/CFusionMX7/lib/axis.jar;C:/CFusionMX7/lib/xml-apis.jar;C:/CFusionMX7/lib/saaj.jar;C:/C FusionMX7/lib/jaxrpc.jar;. C:/CFusionMX7/runtime/bin/com/mycompany/mypackage/util/*.java

        Anyone have any ideas? Of course, to make matters worse, the reference I normally use to deal with complex data types in CF has gone all 404: http://hcc.musc.edu/research/shared_resources/xml_complex_types_to_cf_structure_notes.cfm. If anyone knows of a good reference for this material, I'd love to see it.

        Thanks all,
        • 1. Re: Broken webservice behavior in CF 7.0.2?
          insuractive Level 3
          I've included some sample code below for the complex type (WSDL) and how I'm calling it:

          • 2. Re: Broken webservice behavior in CF 7.0.2?
            insuractive Level 3
            OK, so maybe some progress, maybe not. I've managed to retrieve the .java files from the WSDL using C:\CFUSIONMX7\Runtime\Bin\wsdl2java.exe. This gave me a directory tree that looked something like this:


            I used my Java IDE to compile the java files into class files (required the appropriate jars:

            I then placed my compiled classes (directory structure and all) in my CFUSIONMX7/Lib directory and restarted the server.

            I can now instantiate the custom Java class for the problem Web Service parameter. Again, it works fine on my machine, but when I try to instantiate / call the webservice on my STAGING server, I get the following error:

            Could not instantiate stub objects for web service invocation.
            The rootcause was that: java.lang.reflect.InvocationTargetException

            Any Ideas?
            • 3. Re: Broken webservice behavior in CF 7.0.2?
              insuractive Level 3
              Well, after about a day and a half of troubleshooting, I finally figured out how to get it to work. It seemed as if my last error had to do with the fact that I had class files for the webservice objects scattered around my computer and CF has having problems (name collisions, maybe?) creating the stub files it needed for the web service invocation.

              This, however, worked:

              1) Update my machine to CF 7.0.2. so I don't have to keep uploading to the staging server to test

              2) After doing some more research in the following articles, it seemed as if my initial approach (recreating complex object in CF structure/array) should have worked:
              http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/web services6.htm

              3) After playing around with syntax, I FINALLY found a solution that worked. It wound up being as simple as:

              stArgs.ihatethisfield= arrCodes;
              (see my code above)

              Now why the previous code worked in 7.0.0 and this syntax works in 7.0.2, I have no idea.

              But it works now, and that's all that matters.