DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15733>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15733 ClassCastException -- (SOAPElement) .... Summary: ClassCastException -- (SOAPElement) .... Product: Axis Version: 1.1beta Platform: PC OS/Version: Other Status: NEW Severity: Blocker Priority: Other Component: Samples AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Hello, Here's the program that gives ClassCastException .... client-side ... ( the server-side is samples/message/MessageService ). GetXML.java - Axis client-side ============================== /** * GetXML */ package samples.message; import org.apache.axis.client.Service; import org.apache.axis.client.Call; import org.apache.axis.message.SOAPBodyElement; import org.apache.axis.utils.Options; import org.apache.axis.utils.XMLUtils; import org.w3c.dom.Element; import org.w3c.dom.Document; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilder; import java.net.URL; import java.util.Vector; import java.io.*; /** * GetXML - Simple test driver for our message service. */ public class GetXML { /** * doit() */ public String doit(String[] args) throws Exception { Options opts = new Options(args); opts.setDefaultURL ("http://localhost:8080/axis/services/MessageService"); Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress( new URL(opts.getURL()) ); SOAPBodyElement[] input = new SOAPBodyElement[1]; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse("testPORequest.xml"); System.out.println(doc.getDocumentElement()); input[0] = (SOAPBodyElement) doc.getDocumentElement(); Vector elems = (Vector) call.invoke( input ); SOAPBodyElement elem = null ; Element e = null ; elem = (SOAPBodyElement) elems.get(0); e = elem.getAsDOM(); String str = "Res elem[0]=" + XMLUtils.ElementToString(e); return ( str ); } /** * main() */ public static void main(String[] args) throws Exception { String res = (new GetXML()).doit(args); System.out.println(res); } } ============ Ant Script: ============== <?xml version="1.0" ?> <!DOCTYPE project [ <!ENTITY properties SYSTEM "file:../../xmls/properties.xml"> <!ENTITY paths SYSTEM "file:../../xmls/path_refs.xml"> <!ENTITY taskdefs SYSTEM "file:../../xmls/taskdefs.xml"> <!ENTITY taskdefs_post_compile SYSTEM "file:../../xmls/taskdefs_post_compile.xml"> <!ENTITY targets SYSTEM "file:../../xmls/targets.xml"> ]> <!-- =================================================================== <description> Test/Sample Component file for Axis Notes: This is a build file for use with the Jakarta Ant build tool. Prerequisites: jakarta-ant from http://jakarta.apache.org Build Instructions: To compile ant compile To execute ant run Author: Matt Seibert [EMAIL PROTECTED] Copyright: Copyright (c) 2002-2003 Apache Software Foundation. </description> ==================================================================== --> <project default="compile"> <property name="axis.home" location="../.." /> <property name="componentName" value="samples/message" /> &properties; &paths; &taskdefs; &taskdefs_post_compile; &targets; <target name="clean"/> <target name="copy" depends="setenv"/> <target name="compile" depends="copy"> <javac srcdir="${axis.home}" destdir="${build.dest}" debug="${debug}" fork="${javac.fork}"> <classpath> <path refid="classpath"/> </classpath> <include name="samples/message/**/*.java"/> <exclude name="samples/**/*SMTP*.java" unless="smtp.present" /> <exclude name="**/old/**/*.java" /> </javac> </target> <target name="deploy"> <java classname="org.apache.axis.client.AdminClient" fork="yes"> <classpath> <pathelement location="../../lib/axis.jar"/> <pathelement location="../../lib/saaj.jar"/> <pathelement location="../../lib/jaxrpc.jar"/> <pathelement location="../../lib/commons-logging.jar"/> <pathelement location="../../lib/commons-discovery.jar"/> <pathelement location="../../lib/xmlParserAPIs.jar"/> <pathelement location="../../lib/xercesImpl.jar"/> </classpath> <arg value="-p9999"/> <arg value="deploy.wsdd"/> </java> </target> <target name="run" depends="compile"> <java classname="samples.message.GetXML" fork="yes" failonerror="true"> <classpath> <pathelement location="../../build/classes"/> <pathelement location="../../lib/axis.jar"/> <pathelement location="../../lib/saaj.jar"/> <pathelement location="../../lib/commons-logging.jar"/> <pathelement location="../../lib/commons-discovery.jar"/> <pathelement location="../../lib/jaxrpc.jar"/> <pathelement location="../../lib/xmlParserAPIs.jar"/> <pathelement location="../../lib/xercesImpl.jar"/> </classpath> <arg value="-p9999"/> </java> </target> <target name="undeploy"/> </project> =================== Runtime =================== /cygdrive/c/jakarta-tomcat-4.1.18/bin> ./catalina.sh run Using CATALINA_BASE: c:\jakarta-tomcat-4.1.18 Using CATALINA_HOME: c:\jakarta-tomcat-4.1.18 Using CATALINA_TMPDIR: c:\jakarta-tomcat-4.1.18\temp Using JAVA_HOME: c:\jdk131 "/cygdrive/c/jdk131/bin/java" -Djava.endorsed.dirs="/cygdrive/c/jakarta-tomcat-4 .1.18/bin:/cygdrive/c/jakarta-tomcat-4.1.18/common/endorsed" -classpath "c:\jdk1 31\lib\tools.jar;c:\jakarta-tomcat-4.1.18\bin\bootstrap.jar;d:/src/timogen/lib/c lasses12.zip" -Dcatalina.base="c:\jakarta-tomcat-4.1.18" -Dcatalina.home="c:\jak arta-tomcat-4.1.18" -Djava.io.tmpdir="c:\jakarta-tomcat-4.1.18\temp" -DTMGHOME=" d:/src/timogen" org.apache.catalina.startup.Bootstrap start [INFO] Registry - -Loading registry information [INFO] Registry - -Creating new Registry instance [INFO] Registry - -Creating MBeanServer [INFO] Http11Protocol - -Initializing Coyote HTTP/1.1 on port 9999 Starting service Tomcat-Standalone Apache Tomcat/4.1.18 [INFO] Http11Protocol - -Starting Coyote HTTP/1.1 on port 9999 [INFO] ChannelSocket - -JK2: ajp13 listening on 0.0.0.0/0.0.0.0:8009 [INFO] JkMain - -Jk running ID=0 time=20/50 config=c:\jakarta-tomcat-4.1.18\con f\jk2.properties ....... and ..... /cygdrive/c/axis-1_1beta/samples/message> ant deploy Buildfile: build.xml deploy: [java] [INFO] AdminClient - -Processing file deploy.wsdd [java] [INFO] AdminClient - -<Admin>Done processing</Admin> BUILD SUCCESSFUL Total time: 8 seconds /cygdrive/c/axis-1_1beta/samples/message> cat deploy.wsdd <deployment name="test" xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"> <!-- note that either style="message" OR provider="java:MSG" both work --> <service name="MessageService" provider="java:MSG"> <parameter name="className" value="samples.message.MessageService" /> <parameter name="allowedMethods" value="echoElements" /> </service> </deployment> /cygdrive/c/axis-1_1beta/samples/message> ........... /cygdrive/c/axis-1_1beta/samples/message> ant run Buildfile: build.xml setenv: copy: compile: run: [java] [Pip3A4PurchaseOrderRequest: null] [java] java.lang.ClassCastException: org.apache.xerces.dom.DeferredElementI mpl [java] at samples.message.GetXML.doit(GetXML.java:47) [java] at samples.message.GetXML.main(GetXML.java:66) [java] Exception in thread "main" BUILD FAILED file:c:/axis-1_1beta/samples/message/build.xml:77: Java returned: 1 Total time: 5 seconds /cygdrive/c/axis-1_1beta/samples/message> Please help.