• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Broken webservice behavior in CF 7.0.2?

Advocate ,
May 29, 2007 May 29, 2007

Copy link to clipboard

Copied

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

or

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:/CFusionMX7/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,
TOPICS
Advanced techniques

Views

939

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , May 31, 2007 May 31, 2007
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...

Votes

Translate

Translate
Advocate ,
May 29, 2007 May 29, 2007

Copy link to clipboard

Copied

I've included some sample code below for the complex type (WSDL) and how I'm calling it:

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
May 30, 2007 May 30, 2007

Copy link to clipboard

Copied

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:

com/companyName/division/domain
com/companyName/division/util

I used my Java IDE to compile the java files into class files (required the appropriate jars:
C:/CFusionMX7/lib/axis.jar
C:/CFusionMX7/lib/xml-apis.jar
C:/CFusionMX7/lib/saaj.jar
C:/CFusionMX7/lib/jaxrpc.jar

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
May 31, 2007 May 31, 2007

Copy link to clipboard

Copied

LATEST
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://phillhowson.com/blog/index.cfm/2006/9/1/ColdFusion-and-Web-Services
http://cfdj.sys-con.com/read/86131.htm
http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/webservices6....

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation