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

Compiling *.java for cfinvoke

Explorer ,
Feb 26, 2007 Feb 26, 2007

Copy link to clipboard

Copied

I'm trying to connect to a web service that uses complex-within-complex data types for its parameter.

I am constantly getting errors trying to invoke the web service and it has been recommended by someone on this list (Mr. Andreyev) that I do the following:

1. Use wsdl2java tool (CF_HOME/runtime/bin) supplying URL to webservice WSDL to create java code.
2. Create java classes by compiling java code created in step 1
3. Create jar file(s) from classes in step 2
4. Put jar file in CF classpath or just copy it to CF_HOME/lib directory
5. Using <cfscript> create required objects, arrays and other arguments and supply them to web service method call.

This is not as simple as it sounds (well, not to someone who's only interaction with java is in a cup).

1. Use wsdl2java tool (CF_HOME/runtime/bin) tsupplying URL to webservice WSDL to create java code.

This has been done. The tool created a series of subfolders under C:\CFusionMX7\runtime\bin which ends in a folder called schema

Inside schema are six other folders that each contain 1 and 111 .java files

[EDIT] I think I have part of the problem worked out.

2. Create java classes by compiling java code created in step 1

This has not been done.

My command line in javac is: javac @filename -verbose -source 1.4

I get a total of 100 errors and 33 warnings

All the errors are on this theme:

C:\CFusionMX7\runtime\bin\...\AccommodationRoomT
ype.java:10: package org.apache.axis.encoding does not exist
public class AccommodationRoomType implements java.io.Serializable, org.apache.
axis.encoding.SimpleType {

The common theme in the error messages is:

package org.apache.axis.something does not exist

Am I not using javac correctly or is it just battling to compile the code generated by wsdl2java?

Thanks
Neal

Views

461

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

Deleted User
Feb 26, 2007 Feb 26, 2007
Neal,

Here is the command that you need to use to compile java classes. I should have mentioned that before as you need to include few jar's in the command itself

javac -deprecation -classpath C:/CFusionMX7/lib/axis.jar;C:/CFusionMX7/lib/xml-apis.jar;C:/CFusionMX7/lib/saaj.jar;C:/CFusionMX7//lib/jaxrpc.jar;. [path_to_java_folder]/*.java

So, in details, you need to specify -deprecation parameter and then classpath and include 3 libraries separated by semicolons(;). At the end you have to pot ...

Votes

Translate

Translate
Guest
Feb 26, 2007 Feb 26, 2007

Copy link to clipboard

Copied

Neal,

Here is the command that you need to use to compile java classes. I should have mentioned that before as you need to include few jar's in the command itself

javac -deprecation -classpath C:/CFusionMX7/lib/axis.jar;C:/CFusionMX7/lib/xml-apis.jar;C:/CFusionMX7/lib/saaj.jar;C:/CFusionMX7//lib/jaxrpc.jar;. [path_to_java_folder]/*.java

So, in details, you need to specify -deprecation parameter and then classpath and include 3 libraries separated by semicolons(;). At the end you have to pot dot (.) and then provide path to your java files. You have to repeat this for all your folders that have been created in step 1. As you can see, among included jars there is axis.jar file, so that should solve all your errors.

Let me know how it goes.

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
Explorer ,
Feb 27, 2007 Feb 27, 2007

Copy link to clipboard

Copied

LATEST
Hi there Mr. Andreyev

[EDIT]. You are a prince amongst men, sir. All .class files have been created
This version of your line worked
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/au/com/qantas/www/schema/allfiles.txt

It threw warnings, not errors. I was reading them as the same thing.

Thank you for your kind assistance. On to step 3!
[END EDIT]
Using the command line as you suggested threw up a new set of errors but I think I know what is causing them.

The first time I tried your script I modified it as follows:

javac -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/au/com/qantas/www/schema/aCalypsoV1/*.java

Note that there is a space between the period (.) and the start of the path to the java files.

On running this i received back many many error messages pointing out that
"as of release 5, 'enum' is a keyword, and may not be used as an identifier (use -source 1.4 or lower to use 'enum' as an identifier)"

I then modified your line as follows
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/au/com/qantas/www/schema/aCalypsoV1/*.java

This also gave me a bunch of errors in the vein of:

"C:\CFusionMX7\runtime\bin\au\com\qantas\www\schema\aCalypsoV1\ContactDetails.jav
a:38: package au.com.qantas.www.schema.CustomersV1 does not exist
public void setEmailAddress(au.com.qantas.www.schema.CustomersV1.EmailAddres
s emailAddress) {"

The .java files that were created by wsdl2java were grouped into six folders under /www/schema
Every error message references one of these other folders. It looks like the compiler is trying to reference them.

I have these folders:
www/schema/aCalypsoV1
www/schema/AmadeusBookingsV1
www/schema/ChannelsV1
www/schema/CustomersV1
www/schema/FinancialsV1
www/schema/ReferenceV1

I tried creating a text file with an absolute path to every single .java file in those six files in it (naming it www/schema/allfiles.txt) and modifying your script as follows:

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/au/com/qantas/www/schema/allfiles.txt

This threw a set of errors in this theme

C:\CFusionMX7\runtime\bin\au\com\qantas\www\schema\ChannelsV1\Channel.java:32: w
arning: as of release 5, 'enum' is a keyword, and may not be used as an identifi
er
(use -source 5 or higher to use 'enum' as a keyword)

Using -source 1.4 throws errors saying use source 5 or higher
Using -source 5 or leaving it out altogether says use source 1.4

I am stuck.

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