[Top] [All Lists]

Re: Problem with SOAP call in CFMX

Subject: Re: Problem with SOAP call in CFMX
From: "ksmith"
Date: Mon, 2 Jul 2007 20:26:55 +0000 UTC
Newsgroups: macromedia.coldfusion.advanced_techniques
Hi Mathias,
 CFMX6.1 uses an older version of Axis and seems to be having problems with 
this webservice.  CF8 appears to work directly and I suspect CFMX7 would work 
also.  However, if you can handle a little java it appears this service can 
work with CFMX6.1.

 First, read the following on using WSDL2java.  
Run wsdl2java against the webservice like in the technote. But update the 
command using the -W (Nowrap) switch.  My command is:
 C:\>c:\j2sdk1.4.2_13\bin\java -cp C:/CFusionMX/lib/webservices.jar
 org.apache.axis.wsdl.WSDL2Java -o d:\rpcservicesWS -vW
 NOTE I added the -W where the technote only used a -v (verbose).

 However, do not immediately compile the stubs as in the last section of the 
technote. If you do you will see something like:
 C:\>c:\j2sdk1.4.2_13\bin\javac -classpath C:/CFusionMX/lib/webservices.j
 ar D:\rpcservicesWS\de\broadmail\api\*.java
 D:\rpcservicesWS\de\broadmail\api\ incompatible 
 found   : java.lang.Object
 required: java.lang.Throwable
         return cause;
 1 error

 This is much like the original error that is thrown inside CFMX6.1.  It 
indicates that wsdl2java and Axis are creating 'cause' as a class of 
java.lang.Object, but what is needed is 'cause' to be created as a class of 
java.lang.Throwable. We can make this update easily enough.  Open the file 
de\broadmail\api\ in a code editor.  We will need to 
change 4 lines:
 line 13: private java.lang.Object cause; 
 change to:
 private java.lang.Throwable cause;

 line 18:           java.lang.Object cause,
 change to:
            java.lang.Throwable cause,

 line24:     public java.lang.Object getCause() {
 change to
     public java.lang.Throwable getCause() {

 line 28:     public void setCause(java.lang.Object cause) {
 change to
     public void setCause(java.lang.Throwable cause) {

 Now save the file and compile just as indicated in the technote.

 If you then go to the output directory you used for the commands you can 
create a jar file with all the classes included.  My command was:
 jar -cvf rpcSession.jar .
 Note the space and period after rpcSession.jar.  You can open the file with 
winzip and you will see all the files and their paths "de\broadmail\api".

 Next include this jar in CFMX's classpath using the java and jvm page in the 
cfadmin.  Restart cfmx appserver as indicated.

 Now in order to use these stubs we need to update the code.  I prefer using 
CreateObject call inside cfscript to cfinvoke. My code is:

   locator = CreateObject("java", 
   sessObj = locator.getRpcSession();

   ret = sessObj.login(123, "username", "password");

<Prev in Thread] Current Thread [Next in Thread>