You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Linus Kamb <li...@iris.washington.edu> on 2005/07/18 23:55:31 UTC
NullPointer in org.apache.axis.utils.ArrayUtil.getArrayComponentPD(ArrayUtil.java:153)
Ok, I'm at a bit of a loss here. I've tried to reduce this to the most basic test, and I
still get the NPE down in axis.utils.
I am hoping somebody can give me a clue as to why this might be happening. It is likely
user-error, but I'm at a loss.
I have reinstalled 1.2.1. I have reinstalled tomcat 5.0.28 and axis. I've trimmed the
test down to a single method. It now happens all the time.
I generate the interface and client stubs using wsdl2java ant task. All seems well. The
server code completes fine, but an Exception is thrown and my client gets an empty response.
I have attached the wsdl, the ant build.xml, and server and client codes.
The exception trace is at the bottom.
Anyone?
Thanks,
Linus
various jars involved:
~/local/tomcat/current$ ll common/endorsed/
total 2224
-rw-r--r-- 1 linus linus 1010675 28 Aug 2004 xercesImpl.jar
-rw-r--r-- 1 linus linus 124724 28 Aug 2004 xml-apis.jar
~/local/tomcat/current$ ll common/lib/
total 4904
-rw-r--r-- 1 linus linus 8412 28 Aug 2004 ant-launcher.jar
-rw-r--r-- 1 linus linus 958858 28 Aug 2004 ant.jar
-rw-r--r-- 1 linus linus 559366 28 Aug 2004 commons-collections-3.1.jar
-rw-r--r-- 1 linus linus 107631 28 Aug 2004 commons-dbcp-1.2.1.jar
-rw-r--r-- 1 linus linus 112341 28 Aug 2004 commons-el.jar
-rw-r--r-- 1 linus linus 42492 28 Aug 2004 commons-pool-1.2.jar
-rw-r--r-- 1 linus linus 351903 28 Aug 2004 jasper-compiler.jar
-rw-r--r-- 1 linus linus 105502 28 Aug 2004 jasper-runtime.jar
-rw-r--r-- 1 linus linus 50491 28 Aug 2004 jsp-api.jar
-rw-r--r-- 1 linus linus 27968 28 Aug 2004 naming-common.jar
-rw-r--r-- 1 linus linus 14870 28 Aug 2004 naming-factory.jar
-rw-r--r-- 1 linus linus 2059 28 Aug 2004 naming-java.jar
-rw-r--r-- 1 linus linus 42308 28 Aug 2004 naming-resources.jar
-rw-r--r-- 1 linus linus 97689 28 Aug 2004 servlet-api.jar
~/local/tomcat/current$ ll webapps/axis/WEB-INF/lib/
total 10184
-rw-r--r-- 1 linus linus 54665 18 Jul 14:35 activation.jar
-rw-r--r-- 1 linus linus 33506 18 Jul 14:16 axis-ant.jar
-rw-r--r-- 1 linus linus 1604162 18 Jul 14:16 axis.jar
-rw-r--r-- 1 linus linus 30117 18 Jul 14:35 commons-cli-1.0.jar
-rw-r--r-- 1 linus linus 71442 18 Jul 14:16 commons-discovery-0.2.jar
-rw-r--r-- 1 linus linus 277722 18 Jul 14:35 commons-httpclient-3.0-rc2.jar
-rw-r--r-- 1 linus linus 38015 18 Jul 14:16 commons-logging-1.0.4.jar
-rw-r--r-- 1 linus linus 10407 18 Jul 14:35 dmc_utils.jar
-rw-r--r-- 1 linus linus 160967 18 Jul 14:35 jaxen-core.jar
-rw-r--r-- 1 linus linus 13707 18 Jul 14:35 jaxen-dom.jar
-rw-r--r-- 1 linus linus 32071 18 Jul 14:16 jaxrpc.jar
-rw-r--r-- 1 linus linus 121070 18 Jul 14:35 junit.jar
-rw-r--r-- 1 linus linus 352668 18 Jul 14:16 log4j-1.2.8.jar
-rw-r--r-- 1 linus linus 174777 18 Jul 14:35 mailapi_1_3_1.jar
-rw-r--r-- 1 linus linus 235712 18 Jul 14:35 mysql-connector-java-3.0.15-ga-bin.jar
-rw-r--r-- 1 linus linus 19427 18 Jul 14:16 saaj.jar
-rw-r--r-- 1 linus linus 23563 18 Jul 14:35 saxpath.jar
-rw-r--r-- 1 linus linus 8641 18 Jul 14:35 testServer.jar
-rw-r--r-- 1 linus linus 126771 18 Jul 14:16 wsdl4j-1.5.1.jar
-rw-r--r-- 1 linus linus 1781922 18 Jul 14:35 xalan.jar
Caused by: java.lang.NullPointerException
at org.apache.axis.utils.ArrayUtil.getArrayComponentPD(ArrayUtil.java:153)
at org.apache.axis.utils.ArrayUtil.internalIsConvertable(ArrayUtil.java:116)
at org.apache.axis.utils.ArrayUtil.isConvertable(ArrayUtil.java:96)
at org.apache.axis.encoding.TypeMappingImpl.getSerializer(TypeMappingImpl.java:334)
at
org.apache.axis.encoding.TypeMappingDelegate.getSerializer(TypeMappingDelegate.java:80)
at
org.apache.axis.encoding.TypeMappingDelegate.getSerializer(TypeMappingDelegate.java:83)
at
org.apache.axis.encoding.SerializationContext.getSerializer(SerializationContext.java:1507)
at
org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1390)
at org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:914)
at org.apache.axis.message.RPCParam.serialize(RPCParam.java:200)
at org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:433)
at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:139)
at org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:477)
at org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
Re: NullPointer in org.apache.axis.utils.ArrayUtil.getArrayComponentPD(ArrayUtil.java:153)
Posted by Davanum Srinivas <da...@gmail.com>.
Please open a bug report.
thanks,
dims
On 7/18/05, Linus Kamb <li...@iris.washington.edu> wrote:
> I'm sorry. Forgot to restate the problem:
>
> I get a NullPointerException in ArrayUtils when I try to return an array of
> org.w3.dom.Elements.
>
>
>
> Linus Kamb wrote:
> > Ok, I'm at a bit of a loss here. I've tried to reduce this to the most
> > basic test, and I still get the NPE down in axis.utils.
> >
> > I am hoping somebody can give me a clue as to why this might be
> > happening. It is likely user-error, but I'm at a loss.
> >
> > I have reinstalled 1.2.1. I have reinstalled tomcat 5.0.28 and axis.
> > I've trimmed the test down to a single method. It now happens all the
> > time.
> >
> > I generate the interface and client stubs using wsdl2java ant task. All
> > seems well. The server code completes fine, but an Exception is thrown
> > and my client gets an empty response.
> >
> > I have attached the wsdl, the ant build.xml, and server and client codes.
> >
> > The exception trace is at the bottom.
> >
> > Anyone?
> >
> > Thanks,
> > Linus
> >
> > various jars involved:
> > ~/local/tomcat/current$ ll common/endorsed/
> > total 2224
> > -rw-r--r-- 1 linus linus 1010675 28 Aug 2004 xercesImpl.jar
> > -rw-r--r-- 1 linus linus 124724 28 Aug 2004 xml-apis.jar
> >
> > ~/local/tomcat/current$ ll common/lib/
> > total 4904
> > -rw-r--r-- 1 linus linus 8412 28 Aug 2004 ant-launcher.jar
> > -rw-r--r-- 1 linus linus 958858 28 Aug 2004 ant.jar
> > -rw-r--r-- 1 linus linus 559366 28 Aug 2004 commons-collections-3.1.jar
> > -rw-r--r-- 1 linus linus 107631 28 Aug 2004 commons-dbcp-1.2.1.jar
> > -rw-r--r-- 1 linus linus 112341 28 Aug 2004 commons-el.jar
> > -rw-r--r-- 1 linus linus 42492 28 Aug 2004 commons-pool-1.2.jar
> > -rw-r--r-- 1 linus linus 351903 28 Aug 2004 jasper-compiler.jar
> > -rw-r--r-- 1 linus linus 105502 28 Aug 2004 jasper-runtime.jar
> > -rw-r--r-- 1 linus linus 50491 28 Aug 2004 jsp-api.jar
> > -rw-r--r-- 1 linus linus 27968 28 Aug 2004 naming-common.jar
> > -rw-r--r-- 1 linus linus 14870 28 Aug 2004 naming-factory.jar
> > -rw-r--r-- 1 linus linus 2059 28 Aug 2004 naming-java.jar
> > -rw-r--r-- 1 linus linus 42308 28 Aug 2004 naming-resources.jar
> > -rw-r--r-- 1 linus linus 97689 28 Aug 2004 servlet-api.jar
> >
> > ~/local/tomcat/current$ ll webapps/axis/WEB-INF/lib/
> > total 10184
> > -rw-r--r-- 1 linus linus 54665 18 Jul 14:35 activation.jar
> > -rw-r--r-- 1 linus linus 33506 18 Jul 14:16 axis-ant.jar
> > -rw-r--r-- 1 linus linus 1604162 18 Jul 14:16 axis.jar
> > -rw-r--r-- 1 linus linus 30117 18 Jul 14:35 commons-cli-1.0.jar
> > -rw-r--r-- 1 linus linus 71442 18 Jul 14:16 commons-discovery-0.2.jar
> > -rw-r--r-- 1 linus linus 277722 18 Jul 14:35
> > commons-httpclient-3.0-rc2.jar
> > -rw-r--r-- 1 linus linus 38015 18 Jul 14:16 commons-logging-1.0.4.jar
> > -rw-r--r-- 1 linus linus 10407 18 Jul 14:35 dmc_utils.jar
> > -rw-r--r-- 1 linus linus 160967 18 Jul 14:35 jaxen-core.jar
> > -rw-r--r-- 1 linus linus 13707 18 Jul 14:35 jaxen-dom.jar
> > -rw-r--r-- 1 linus linus 32071 18 Jul 14:16 jaxrpc.jar
> > -rw-r--r-- 1 linus linus 121070 18 Jul 14:35 junit.jar
> > -rw-r--r-- 1 linus linus 352668 18 Jul 14:16 log4j-1.2.8.jar
> > -rw-r--r-- 1 linus linus 174777 18 Jul 14:35 mailapi_1_3_1.jar
> > -rw-r--r-- 1 linus linus 235712 18 Jul 14:35
> > mysql-connector-java-3.0.15-ga-bin.jar
> > -rw-r--r-- 1 linus linus 19427 18 Jul 14:16 saaj.jar
> > -rw-r--r-- 1 linus linus 23563 18 Jul 14:35 saxpath.jar
> > -rw-r--r-- 1 linus linus 8641 18 Jul 14:35 testServer.jar
> > -rw-r--r-- 1 linus linus 126771 18 Jul 14:16 wsdl4j-1.5.1.jar
> > -rw-r--r-- 1 linus linus 1781922 18 Jul 14:35 xalan.jar
> >
> >
> > Caused by: java.lang.NullPointerException
> > at
> > org.apache.axis.utils.ArrayUtil.getArrayComponentPD(ArrayUtil.java:153)
> > at
> > org.apache.axis.utils.ArrayUtil.internalIsConvertable(ArrayUtil.java:116)
> > at org.apache.axis.utils.ArrayUtil.isConvertable(ArrayUtil.java:96)
> > at
> > org.apache.axis.encoding.TypeMappingImpl.getSerializer(TypeMappingImpl.java:334)
> >
> > at
> > org.apache.axis.encoding.TypeMappingDelegate.getSerializer(TypeMappingDelegate.java:80)
> >
> > at
> > org.apache.axis.encoding.TypeMappingDelegate.getSerializer(TypeMappingDelegate.java:83)
> >
> > at
> > org.apache.axis.encoding.SerializationContext.getSerializer(SerializationContext.java:1507)
> >
> > at
> > org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1390)
> >
> > at
> > org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:914)
> >
> > at org.apache.axis.message.RPCParam.serialize(RPCParam.java:200)
> > at org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:433)
> > at
> > org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
> > at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:139)
> > at
> > org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:477)
> > at
> > org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
> > at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
> >
> >
> > ------------------------------------------------------------------------
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <wsdl:definitions targetNamespace="http://www.iris.edu/test" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://www.iris.edu/test" xmlns:intf="http://www.iris.edu/test" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> > <!--WSDL created by Apache Axis version: 1.2.1
> > Built on Jun 14, 2005 (09:15:57 EDT)-->
> > <wsdl:types>
> > <schema elementFormDefault="qualified" targetNamespace="http://www.iris.edu/test" xmlns="http://www.w3.org/2001/XMLSchema">
> > <import namespace="http://xml.apache.org/xml-soap"/>
> > <element name="getProductsById">
> > <complexType>
> > <sequence>
> > <element maxOccurs="unbounded" name="in0" type="xsd:string"/>
> > </sequence>
> > </complexType>
> > </element>
> > <element name="getProductsByIdResponse">
> > <complexType>
> > <sequence>
> > <element maxOccurs="unbounded" name="getProductsByIdReturn" type="apachesoap:Element"/>
> > </sequence>
> > </complexType>
> > </element>
> > </schema>
> > </wsdl:types>
> >
> > <wsdl:message name="getProductsByIdRequest">
> >
> > <wsdl:part element="impl:getProductsById" name="parameters"/>
> >
> > </wsdl:message>
> >
> > <wsdl:message name="getProductsByIdResponse">
> >
> > <wsdl:part element="impl:getProductsByIdResponse" name="parameters"/>
> >
> > </wsdl:message>
> >
> > <wsdl:portType name="UPDS_Test">
> >
> > <wsdl:operation name="getProductsById">
> >
> > <wsdl:input message="impl:getProductsByIdRequest" name="getProductsByIdRequest"/>
> >
> > <wsdl:output message="impl:getProductsByIdResponse" name="getProductsByIdResponse"/>
> >
> > </wsdl:operation>
> >
> > </wsdl:portType>
> >
> > <wsdl:binding name="UPDS_TestServiceSoapBinding" type="impl:UPDS_Test">
> >
> > <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
> >
> > <wsdl:operation name="getProductsById">
> >
> > <wsdlsoap:operation soapAction=""/>
> >
> > <wsdl:input name="getProductsByIdRequest">
> >
> > <wsdlsoap:body use="literal"/>
> >
> > </wsdl:input>
> >
> > <wsdl:output name="getProductsByIdResponse">
> >
> > <wsdlsoap:body use="literal"/>
> >
> > </wsdl:output>
> >
> > </wsdl:operation>
> >
> > </wsdl:binding>
> >
> > <wsdl:service name="UPDS_TestService">
> >
> > <wsdl:port binding="impl:UPDS_TestServiceSoapBinding" name="UPDS_TestService">
> >
> > <wsdlsoap:address location="http://localhost:8080/axis/services/UPDS_TestService"/>
> >
> > </wsdl:port>
> >
> > </wsdl:service>
> >
> > </wsdl:definitions>
> >
> >
> > ------------------------------------------------------------------------
> >
> > <project name="test"
> > default="compile"
> > basedir="." >
> >
> > <property environment="env" />
> >
> > <property name="TOMCAT_ROOT" value="${env.CATALINA_HOME}" />
> > <property name="catalina-ant-jar"
> > value="${TOMCAT_ROOT}/server/lib/catalina-ant.jar" />
> > <property name="tomcat_mgr" value="buster" />
> > <property name="tomcat_mgr_passwd" value="tiddles" />
> > <property name="axis_lib_dir" value="${TOMCAT_ROOT}/webapps/axis/WEB-INF/lib" />
> >
> > <property name="jar_filename" value="dist/${ant.project.name}Server.jar" />
> >
> > <property name="lib_dir" value="../lib" />
> > <property name="src_dir" value="src" />
> > <property name="gen_dir" value="gen" />
> > <property name="build_dir" value="classes" />
> > <property name="dist_dir" value="dist" />
> > <property name="dist_filename" value="dist/${ant.project.name}Server.jar" />
> > <property name="WS_HOST" value="localhost:8080" />
> > <property name="WSDL_FILE" value="UTestService.wsdl" />
> > <property name="project_pkg" value="edu.iris.dmc.test" />
> > <property name="pkg_dir" value="edu/iris/dmc/test" />
> > <property name="SERVICE" value="ETest" />
> > <property name="SERVER" value="${project_pkg}.UPDS_TestServer" />
> > <property name="TARGET_NS" value="http://www.iris.edu/test" />
> > <property name="gen_deploy_file" value="${gen_dir}/${pkg_dir}/deploy.wsdd" />
> > <property name="gen_undeploy_file" value="${gen_dir}/${pkg_dir}/undeploy.wsdd" />
> > <property name="project_deploy_file"
> > value="${gen_dir}/${pkg_dir}/deploy_${ant.project.name}.wsdd" />
> > <property name="project_undeploy_file"
> > value="${gen_dir}/${pkg_dir}/undeploy_${ant.project.name}.wsdd" />
> >
> > <!--property file="../build.properties" /-->
> >
> > <path id="classpath" >
> > <pathelement path="${build_dir}"/>
> > <fileset dir="../lib">
> > <include name="**/*.jar"/>
> > </fileset>
> > <fileset dir="../lib_build">
> > <include name="**/*.jar"/>
> > </fileset>
> > <pathelement location="${server_common_jarfile}" />
> > <pathelement location="${TOMCAT_ROOT}/common/endorsed/xercesImpl.jar" />
> > <pathelement location="${TOMCAT_ROOT}/common/endorsed/xml-apis.jar" />
> > <!-- this changed in tomcat5 from servlet.jar to servlet-api.jar -->
> > <pathelement location="${TOMCAT_ROOT}/common/lib/servlet-api.jar" />
> > <pathelement location="${TOMCAT_ROOT}/common/lib/servlet.jar" />
> > </path>
> >
> >
> > <!-- task definitions -->
> >
> > <taskdef name="reload"
> > description="Reloads the specified web app into Tomcat."
> > classname="org.apache.catalina.ant.ReloadTask"
> > classpath="${catalina-ant-jar}"/>
> >
> > <taskdef name="remove"
> > description="Removes the specified web app from Tomcat."
> > classname="org.apache.catalina.ant.RemoveTask"
> > classpath="${catalina-ant-jar}"/>
> >
> > <taskdef resource="axis-tasks.properties"
> > classpathref="classpath" />
> >
> > <!-- targets -->
> >
> > <target name="init" >
> >
> > <tstamp/>
> >
> > <echo message="basedir: ${basedir}" />
> >
> > <mkdir dir="${gen_dir}/${pkg_dir}"/>
> >
> > <uptodate property="generatedFiles.NotUpToDate"
> > targetfile="${WSDL_FILE}">
> > <srcfiles dir="${gen_dir}/${pkg_dir}"
> > includes="*.java" />
> > </uptodate>
> > <echo message="generatedFiles.NotUpToDate: ${generatedFiles.NotUpToDate}" />
> >
> > </target>
> >
> > <target name="w2j" depends="init" if="generatedFiles.NotUpToDate" >
> > <delete >
> > <fileset dir="${gen_dir}/${pkg_dir}" />
> > </delete>
> > <axis-wsdl2java
> > output="${gen_dir}"
> > testcase="true"
> > verbose="true"
> > nowrapped="false"
> > serverside="true"
> > implementationClassName="${SERVER}"
> > url="${WSDL_FILE}" >
> > <mapping
> > namespace="${TARGET_NS}"
> > package="${project_pkg}" />
> > </axis-wsdl2java>
> > <move file="${gen_deploy_file}" tofile="${project_deploy_file}" />
> > <move file="${gen_undeploy_file}" tofile="${project_undeploy_file}" />
> > </target>
> >
> > <target name="j2w" >
> > <javac debug="${DEBUG}" srcdir="gen" destdir="classes"
> > includes="edu/iris/dmc/test/UPDS_Test.java" >
> > <classpath refid="classpath" />
> > </javac>
> > <axis-java2wsdl
> > classname="edu.iris.dmc.test.UPDS_Test"
> > output="test_gen.wsdl"
> > namespace="${TARGET_NS}"
> > location="http://${WS_HOST}/axis/services/UPDS_TestService"
> > style="${AXIS_STYLE}"
> > >
> > <classpath refid="classpath" />
> > </axis-java2wsdl>
> > </target>
> >
> > <target name="compile_gen" depends="w2j" >
> > <mkdir dir="${build_dir}" />
> > <javac debug="${DEBUG}" srcdir="${gen_dir}" destdir="${build_dir}"
> > excludes="edu/iris/dmc/test/*Server.java,
> > edu/iris/dmc/test/*TestCase.java"
> > verbose="no"
> > deprecation="yes" >
> > <classpath refid="classpath" />
> > </javac>
> > </target>
> >
> > <target name="compile" depends="compile_gen">
> > <!-- Create the local build directory structure used by compile -->
> > <mkdir dir="${build_dir}/${pkg_dir}" />
> >
> > <!-- Compile the java code from ${src} into ${build_dir} -->
> > <javac debug="${DEBUG}" srcdir="${src_dir}" destdir="${build_dir}"
> > verbose="no"
> > deprecation="yes" >
> > <classpath refid="classpath" />
> > </javac>
> > </target>
> >
> > <target name="jar" depends="compile"
> > description="This builds the deployable distribution jar." >
> > <jar jarfile="${jar_filename}" basedir="${build_dir}" />
> > </target>
> >
> > <target name="dist" depends="compile"
> > description="This builds the server_client common code jar." >
> > <mkdir dir="gen_build" />
> > <javac debug="${DEBUG}" destdir="gen_build"
> > verbose="no"
> > deprecation="yes" >
> > <src path="${gen_dir}" />
> > <exclude name="edu/iris/dmc/upds/*Server.java" />
> > <exclude name="edu/iris/dmc/upds/*TestCase.java" />
> > <classpath refid="classpath" />
> > </javac>
> > <jar jarfile="${dist_filename}"
> > basedir="gen_build" />
> > <!--delete dir="gen_build"/-->
> > </target>
> >
> > <target name="copyLibs">
> > <copy todir="${axis_lib_dir}"
> > flatten="true" >
> > <fileset dir="${lib_dir}" includes="**/*.jar"
> > excludes="xmlParserAPIs.jar
> > xercesImpl.jar" />
> > </copy>
> > </target>
> >
> > <target name="deploy" depends="jar, copyLibs" >
> > <copy file="${jar_filename}" todir="${axis_lib_dir}" />
> > <java classname="org.apache.axis.client.AdminClient" >
> > <classpath refid="classpath" />
> > <arg value="-lhttp://${WS_HOST}/axis/servlet/AxisServlet" />
> > <arg value="${basedir}/${project_deploy_file}" />
> > </java>
> > </target>
> >
> > <target name="undeploy" >
> > <java classname="org.apache.axis.client.AdminClient" >
> > <classpath refid="classpath" />
> > <arg value="-lhttp://${WS_HOST}/axis/servlet/AxisServlet" />
> > <arg value="${basedir}/${project_undeploy_file}" />
> > </java>
> > </target>
> >
> > <target name="clean" >
> > <delete>
> > <fileset dir="${build_dir}" includes="**/*.class" />
> > </delete>
> > </target>
> >
> > <target name="clean_gen" >
> > <delete>
> > <fileset dir="${gen_dir}" includes="**/*.java **/*.wsdd" />
> > </delete>
> > </target>
> >
> > <target name="clean_deploy" >
> > <delete file="${axis_lib_dir}/${jar_filename}" />
> > </target>
> >
> > <target name="realclean">
> > <delete>
> > <fileset dir="${build_dir}" />
> > </delete>
> > <delete >
> > <fileset dir="${gen_dir}" />
> > </delete>
> > <delete>
> > <fileset dir="${dist_dir}" />
> > </delete>
> > </target>
> >
> > <target name="reload" depends="deploy" >
> > <reload url="http://${WS_HOST}/manager"
> > username="${tomcat_mgr}"
> > password="${tomcat_mgr_passwd}"
> > path="/axis" />
> > </target>
> >
> > <target name="reload_axis" >
> > <reload url="http://${WS_HOST}/manager"
> > username="${tomcat_mgr}"
> > password="${tomcat_mgr_passwd}"
> > path="/axis" />
> > </target>
> >
> > <target name="client" depends="compile">
> > <java classname="edu.iris.dmc.test.ETestClient" classpathref="classpath"/>
> > </target>
> >
> > </project>
> >
> >
> > ------------------------------------------------------------------------
> >
> > /**
> > * UPDS_TestServer.java
> > *
> > * This file was auto-generated from WSDL
> > * by the Apache Axis 1.2.1 Jun 14, 2005 (09:15:57 EDT) WSDL2Java emitter.
> > */
> >
> > package edu.iris.dmc.test;
> >
> > import java.io.*;
> > import java.util.*;
> >
> > import org.w3c.dom.*;
> >
> > import edu.iris.dmc.utils.xml.*;
> >
> > import javax.xml.parsers.DocumentBuilder;
> > import javax.xml.parsers.DocumentBuilderFactory;
> >
> >
> > public class UPDS_TestServer implements edu.iris.dmc.test.UPDS_Test{
> >
> > private GenXer xer = new GenXer(System.out);
> >
> > private static DocumentBuilderFactory documentFactory = null;
> >
> > static
> > {
> > System.out.println("UPDS_TestServer class loaded.");
> > org.apache.log4j.PropertyConfigurator.configureAndWatch( "conf/debug_log4j.properties" );
> > }
> >
> > public static Document getDocument(File file)
> > throws Exception
> > {
> > DocumentBuilder builder = getDocumentFactory().newDocumentBuilder();
> > return builder.parse( file );
> > }
> >
> > private static DocumentBuilderFactory getDocumentFactory()
> > {
> > if ( documentFactory == null )
> > {
> > documentFactory = DocumentBuilderFactory.newInstance();
> > documentFactory.setValidating( false );
> > documentFactory.setNamespaceAware( true );
> > documentFactory.setIgnoringComments( false );
> > documentFactory.setIgnoringElementContentWhitespace( true );
> > }
> > return documentFactory;
> > }
> >
> > public String[] sendStuff(Element[] inputs)
> > throws java.rmi.RemoteException
> > {
> > System.out.println("inputs:" + inputs );
> > Element[] elems = inputs;
> > String[] returns = new String[elems.length];
> > for ( int i = 0; i< elems.length; i++ )
> > {
> > System.out.println("elem:" + elems[i]);
> > returns[i] = elems[i].getTagName();
> > }
> > return returns;
> > }
> >
> > /*
> > public edu.iris.dmc.test.SendStrings sendStuff(edu.iris.dmc.test.ArrayOfElement inputs)
> > throws java.rmi.RemoteException
> > {
> > System.out.println("inputs:" + inputs );
> > Element[] elems = inputs.getElement();
> > String[] returns = new String[elems.length];
> > for ( int i = 0; i< elems.length; i++ )
> > {
> > System.out.println("elem:" + elems[i]);
> > returns[i] = elems[i].getTagName();
> > }
> > return new SendStrings( returns );
> > }
> > */
> >
> > public org.w3c.dom.Element[] getProductsById(java.lang.String[] fnames) {
> > System.out.println("filenames:" + fnames );
> > Element[] elems = null;
> > try
> > {
> > Vector v = new Vector( fnames.length );
> > for ( int i = 0; i < fnames.length; i++ )
> > {
> > File file = new File( fnames[i] );
> > System.out.println("file:" + file.getCanonicalPath() + " exists: " + file.exists());
> > Document document = getDocument( file );
> > // xer.dump( document );
> > v.add( document.getDocumentElement()) ;
> > }
> > elems = (Element[])v.toArray(new Element[fnames.length]);
> > }
> > catch ( Exception ex )
> > {
> > ex.printStackTrace();
> > }
> > return elems;
> > }
> >
> > public java.lang.String[] sendXml(org.w3c.dom.Element[] sendElems) throws java.rmi.RemoteException
> > {
> > System.out.println("sendElems: " + sendElems );
> > String[] elemNames = new String[ sendElems.length ];
> > for ( int i = 0; i < sendElems.length; i++ )
> > {
> > xer.dump( sendElems[i] );
> > elemNames[i]=sendElems[i].getTagName();
> > }
> > return elemNames;
> > }
> >
> > }
> >
> >
> > ------------------------------------------------------------------------
> >
> > package edu.iris.dmc.test;
> >
> > import java.io.File;
> > import java.net.URL;
> >
> > import javax.xml.parsers.DocumentBuilder;
> > import javax.xml.parsers.DocumentBuilderFactory;
> >
> > import org.w3c.dom.*;
> >
> > public class ETestClient
> > {
> > private static DocumentBuilderFactory documentFactory = null;
> >
> > public static Document getDocument(File file)
> > throws Exception
> > {
> > DocumentBuilder builder = getDocumentFactory().newDocumentBuilder();
> > return builder.parse( file );
> > }
> >
> > private static DocumentBuilderFactory getDocumentFactory()
> > {
> > if ( documentFactory == null )
> > {
> > documentFactory = DocumentBuilderFactory.newInstance();
> > documentFactory.setValidating( false );
> > documentFactory.setNamespaceAware( true );
> > documentFactory.setIgnoringComments( false );
> > documentFactory.setIgnoringElementContentWhitespace( true );
> > }
> > return documentFactory;
> > }
> >
> >
> > /**
> > * @param args
> > */
> > public static void main(String[] args)
> > {
> > try
> > {
> > UPDS_Test server = new UPDS_TestServiceLocator()
> > .getUPDS_TestService( new URL( "http://localhost:8081/axis/services/UPDS_TestService"));
> >
> > /* System.out.println( "test1: Sending.");
> > Element[] sendElems = new Element[2];
> > sendElems[0] = getDocument( new File( "/Users/linus/workspace/upds/test/data/Event4.xml" )).getDocumentElement();
> > sendElems[1] = getDocument( new File( "/Users/linus/workspace/upds/test/data/cmt_122604a.xml" )).getDocumentElement();
> >
> > String[] elemTags = server.sendStuff( new ArrayOfElement( sendElems )).getString();
> > for ( int i = 0; i < elemTags.length; i++ )
> > System.out.println("elem: " + elemTags[i] );
> >
> > */
> > System.out.println( "test2: Retrieving.");
> > String[] filenames = new String[] {
> > "/Users/linus/workspace/upds/test/data/Event4.xml" ,
> > "/Users/linus/workspace/upds/test/data/event3.xml"
> > };
> >
> > Element[] elems = server.getProductsById( filenames );
> > System.out.println("elems: " + elems );
> > for ( int i = 0; i < elems.length; i++ )
> > {
> > System.out.println("elem:" + elems[i]);
> > }
> >
> > }
> > catch ( Exception ex )
> > {
> > ex.printStackTrace();
> > }
> >
> > }
> >
> > }
>
--
Davanum Srinivas -http://blogs.cocoondev.org/dims/
Re: NullPointer in org.apache.axis.utils.ArrayUtil.getArrayComponentPD(ArrayUtil.java:153)
Posted by Linus Kamb <li...@iris.washington.edu>.
I'm sorry. Forgot to restate the problem:
I get a NullPointerException in ArrayUtils when I try to return an array of
org.w3.dom.Elements.
Linus Kamb wrote:
> Ok, I'm at a bit of a loss here. I've tried to reduce this to the most
> basic test, and I still get the NPE down in axis.utils.
>
> I am hoping somebody can give me a clue as to why this might be
> happening. It is likely user-error, but I'm at a loss.
>
> I have reinstalled 1.2.1. I have reinstalled tomcat 5.0.28 and axis.
> I've trimmed the test down to a single method. It now happens all the
> time.
>
> I generate the interface and client stubs using wsdl2java ant task. All
> seems well. The server code completes fine, but an Exception is thrown
> and my client gets an empty response.
>
> I have attached the wsdl, the ant build.xml, and server and client codes.
>
> The exception trace is at the bottom.
>
> Anyone?
>
> Thanks,
> Linus
>
> various jars involved:
> ~/local/tomcat/current$ ll common/endorsed/
> total 2224
> -rw-r--r-- 1 linus linus 1010675 28 Aug 2004 xercesImpl.jar
> -rw-r--r-- 1 linus linus 124724 28 Aug 2004 xml-apis.jar
>
> ~/local/tomcat/current$ ll common/lib/
> total 4904
> -rw-r--r-- 1 linus linus 8412 28 Aug 2004 ant-launcher.jar
> -rw-r--r-- 1 linus linus 958858 28 Aug 2004 ant.jar
> -rw-r--r-- 1 linus linus 559366 28 Aug 2004 commons-collections-3.1.jar
> -rw-r--r-- 1 linus linus 107631 28 Aug 2004 commons-dbcp-1.2.1.jar
> -rw-r--r-- 1 linus linus 112341 28 Aug 2004 commons-el.jar
> -rw-r--r-- 1 linus linus 42492 28 Aug 2004 commons-pool-1.2.jar
> -rw-r--r-- 1 linus linus 351903 28 Aug 2004 jasper-compiler.jar
> -rw-r--r-- 1 linus linus 105502 28 Aug 2004 jasper-runtime.jar
> -rw-r--r-- 1 linus linus 50491 28 Aug 2004 jsp-api.jar
> -rw-r--r-- 1 linus linus 27968 28 Aug 2004 naming-common.jar
> -rw-r--r-- 1 linus linus 14870 28 Aug 2004 naming-factory.jar
> -rw-r--r-- 1 linus linus 2059 28 Aug 2004 naming-java.jar
> -rw-r--r-- 1 linus linus 42308 28 Aug 2004 naming-resources.jar
> -rw-r--r-- 1 linus linus 97689 28 Aug 2004 servlet-api.jar
>
> ~/local/tomcat/current$ ll webapps/axis/WEB-INF/lib/
> total 10184
> -rw-r--r-- 1 linus linus 54665 18 Jul 14:35 activation.jar
> -rw-r--r-- 1 linus linus 33506 18 Jul 14:16 axis-ant.jar
> -rw-r--r-- 1 linus linus 1604162 18 Jul 14:16 axis.jar
> -rw-r--r-- 1 linus linus 30117 18 Jul 14:35 commons-cli-1.0.jar
> -rw-r--r-- 1 linus linus 71442 18 Jul 14:16 commons-discovery-0.2.jar
> -rw-r--r-- 1 linus linus 277722 18 Jul 14:35
> commons-httpclient-3.0-rc2.jar
> -rw-r--r-- 1 linus linus 38015 18 Jul 14:16 commons-logging-1.0.4.jar
> -rw-r--r-- 1 linus linus 10407 18 Jul 14:35 dmc_utils.jar
> -rw-r--r-- 1 linus linus 160967 18 Jul 14:35 jaxen-core.jar
> -rw-r--r-- 1 linus linus 13707 18 Jul 14:35 jaxen-dom.jar
> -rw-r--r-- 1 linus linus 32071 18 Jul 14:16 jaxrpc.jar
> -rw-r--r-- 1 linus linus 121070 18 Jul 14:35 junit.jar
> -rw-r--r-- 1 linus linus 352668 18 Jul 14:16 log4j-1.2.8.jar
> -rw-r--r-- 1 linus linus 174777 18 Jul 14:35 mailapi_1_3_1.jar
> -rw-r--r-- 1 linus linus 235712 18 Jul 14:35
> mysql-connector-java-3.0.15-ga-bin.jar
> -rw-r--r-- 1 linus linus 19427 18 Jul 14:16 saaj.jar
> -rw-r--r-- 1 linus linus 23563 18 Jul 14:35 saxpath.jar
> -rw-r--r-- 1 linus linus 8641 18 Jul 14:35 testServer.jar
> -rw-r--r-- 1 linus linus 126771 18 Jul 14:16 wsdl4j-1.5.1.jar
> -rw-r--r-- 1 linus linus 1781922 18 Jul 14:35 xalan.jar
>
>
> Caused by: java.lang.NullPointerException
> at
> org.apache.axis.utils.ArrayUtil.getArrayComponentPD(ArrayUtil.java:153)
> at
> org.apache.axis.utils.ArrayUtil.internalIsConvertable(ArrayUtil.java:116)
> at org.apache.axis.utils.ArrayUtil.isConvertable(ArrayUtil.java:96)
> at
> org.apache.axis.encoding.TypeMappingImpl.getSerializer(TypeMappingImpl.java:334)
>
> at
> org.apache.axis.encoding.TypeMappingDelegate.getSerializer(TypeMappingDelegate.java:80)
>
> at
> org.apache.axis.encoding.TypeMappingDelegate.getSerializer(TypeMappingDelegate.java:83)
>
> at
> org.apache.axis.encoding.SerializationContext.getSerializer(SerializationContext.java:1507)
>
> at
> org.apache.axis.encoding.SerializationContext.serializeActual(SerializationContext.java:1390)
>
> at
> org.apache.axis.encoding.SerializationContext.serialize(SerializationContext.java:914)
>
> at org.apache.axis.message.RPCParam.serialize(RPCParam.java:200)
> at org.apache.axis.message.RPCElement.outputImpl(RPCElement.java:433)
> at
> org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
> at org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:139)
> at
> org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:477)
> at
> org.apache.axis.message.MessageElement.output(MessageElement.java:1208)
> at org.apache.axis.SOAPPart.writeTo(SOAPPart.java:315)
>
>
> ------------------------------------------------------------------------
>
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions targetNamespace="http://www.iris.edu/test" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://www.iris.edu/test" xmlns:intf="http://www.iris.edu/test" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <!--WSDL created by Apache Axis version: 1.2.1
> Built on Jun 14, 2005 (09:15:57 EDT)-->
> <wsdl:types>
> <schema elementFormDefault="qualified" targetNamespace="http://www.iris.edu/test" xmlns="http://www.w3.org/2001/XMLSchema">
> <import namespace="http://xml.apache.org/xml-soap"/>
> <element name="getProductsById">
> <complexType>
> <sequence>
> <element maxOccurs="unbounded" name="in0" type="xsd:string"/>
> </sequence>
> </complexType>
> </element>
> <element name="getProductsByIdResponse">
> <complexType>
> <sequence>
> <element maxOccurs="unbounded" name="getProductsByIdReturn" type="apachesoap:Element"/>
> </sequence>
> </complexType>
> </element>
> </schema>
> </wsdl:types>
>
> <wsdl:message name="getProductsByIdRequest">
>
> <wsdl:part element="impl:getProductsById" name="parameters"/>
>
> </wsdl:message>
>
> <wsdl:message name="getProductsByIdResponse">
>
> <wsdl:part element="impl:getProductsByIdResponse" name="parameters"/>
>
> </wsdl:message>
>
> <wsdl:portType name="UPDS_Test">
>
> <wsdl:operation name="getProductsById">
>
> <wsdl:input message="impl:getProductsByIdRequest" name="getProductsByIdRequest"/>
>
> <wsdl:output message="impl:getProductsByIdResponse" name="getProductsByIdResponse"/>
>
> </wsdl:operation>
>
> </wsdl:portType>
>
> <wsdl:binding name="UPDS_TestServiceSoapBinding" type="impl:UPDS_Test">
>
> <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
>
> <wsdl:operation name="getProductsById">
>
> <wsdlsoap:operation soapAction=""/>
>
> <wsdl:input name="getProductsByIdRequest">
>
> <wsdlsoap:body use="literal"/>
>
> </wsdl:input>
>
> <wsdl:output name="getProductsByIdResponse">
>
> <wsdlsoap:body use="literal"/>
>
> </wsdl:output>
>
> </wsdl:operation>
>
> </wsdl:binding>
>
> <wsdl:service name="UPDS_TestService">
>
> <wsdl:port binding="impl:UPDS_TestServiceSoapBinding" name="UPDS_TestService">
>
> <wsdlsoap:address location="http://localhost:8080/axis/services/UPDS_TestService"/>
>
> </wsdl:port>
>
> </wsdl:service>
>
> </wsdl:definitions>
>
>
> ------------------------------------------------------------------------
>
> <project name="test"
> default="compile"
> basedir="." >
>
> <property environment="env" />
>
> <property name="TOMCAT_ROOT" value="${env.CATALINA_HOME}" />
> <property name="catalina-ant-jar"
> value="${TOMCAT_ROOT}/server/lib/catalina-ant.jar" />
> <property name="tomcat_mgr" value="buster" />
> <property name="tomcat_mgr_passwd" value="tiddles" />
> <property name="axis_lib_dir" value="${TOMCAT_ROOT}/webapps/axis/WEB-INF/lib" />
>
> <property name="jar_filename" value="dist/${ant.project.name}Server.jar" />
>
> <property name="lib_dir" value="../lib" />
> <property name="src_dir" value="src" />
> <property name="gen_dir" value="gen" />
> <property name="build_dir" value="classes" />
> <property name="dist_dir" value="dist" />
> <property name="dist_filename" value="dist/${ant.project.name}Server.jar" />
> <property name="WS_HOST" value="localhost:8080" />
> <property name="WSDL_FILE" value="UTestService.wsdl" />
> <property name="project_pkg" value="edu.iris.dmc.test" />
> <property name="pkg_dir" value="edu/iris/dmc/test" />
> <property name="SERVICE" value="ETest" />
> <property name="SERVER" value="${project_pkg}.UPDS_TestServer" />
> <property name="TARGET_NS" value="http://www.iris.edu/test" />
> <property name="gen_deploy_file" value="${gen_dir}/${pkg_dir}/deploy.wsdd" />
> <property name="gen_undeploy_file" value="${gen_dir}/${pkg_dir}/undeploy.wsdd" />
> <property name="project_deploy_file"
> value="${gen_dir}/${pkg_dir}/deploy_${ant.project.name}.wsdd" />
> <property name="project_undeploy_file"
> value="${gen_dir}/${pkg_dir}/undeploy_${ant.project.name}.wsdd" />
>
> <!--property file="../build.properties" /-->
>
> <path id="classpath" >
> <pathelement path="${build_dir}"/>
> <fileset dir="../lib">
> <include name="**/*.jar"/>
> </fileset>
> <fileset dir="../lib_build">
> <include name="**/*.jar"/>
> </fileset>
> <pathelement location="${server_common_jarfile}" />
> <pathelement location="${TOMCAT_ROOT}/common/endorsed/xercesImpl.jar" />
> <pathelement location="${TOMCAT_ROOT}/common/endorsed/xml-apis.jar" />
> <!-- this changed in tomcat5 from servlet.jar to servlet-api.jar -->
> <pathelement location="${TOMCAT_ROOT}/common/lib/servlet-api.jar" />
> <pathelement location="${TOMCAT_ROOT}/common/lib/servlet.jar" />
> </path>
>
>
> <!-- task definitions -->
>
> <taskdef name="reload"
> description="Reloads the specified web app into Tomcat."
> classname="org.apache.catalina.ant.ReloadTask"
> classpath="${catalina-ant-jar}"/>
>
> <taskdef name="remove"
> description="Removes the specified web app from Tomcat."
> classname="org.apache.catalina.ant.RemoveTask"
> classpath="${catalina-ant-jar}"/>
>
> <taskdef resource="axis-tasks.properties"
> classpathref="classpath" />
>
> <!-- targets -->
>
> <target name="init" >
>
> <tstamp/>
>
> <echo message="basedir: ${basedir}" />
>
> <mkdir dir="${gen_dir}/${pkg_dir}"/>
>
> <uptodate property="generatedFiles.NotUpToDate"
> targetfile="${WSDL_FILE}">
> <srcfiles dir="${gen_dir}/${pkg_dir}"
> includes="*.java" />
> </uptodate>
> <echo message="generatedFiles.NotUpToDate: ${generatedFiles.NotUpToDate}" />
>
> </target>
>
> <target name="w2j" depends="init" if="generatedFiles.NotUpToDate" >
> <delete >
> <fileset dir="${gen_dir}/${pkg_dir}" />
> </delete>
> <axis-wsdl2java
> output="${gen_dir}"
> testcase="true"
> verbose="true"
> nowrapped="false"
> serverside="true"
> implementationClassName="${SERVER}"
> url="${WSDL_FILE}" >
> <mapping
> namespace="${TARGET_NS}"
> package="${project_pkg}" />
> </axis-wsdl2java>
> <move file="${gen_deploy_file}" tofile="${project_deploy_file}" />
> <move file="${gen_undeploy_file}" tofile="${project_undeploy_file}" />
> </target>
>
> <target name="j2w" >
> <javac debug="${DEBUG}" srcdir="gen" destdir="classes"
> includes="edu/iris/dmc/test/UPDS_Test.java" >
> <classpath refid="classpath" />
> </javac>
> <axis-java2wsdl
> classname="edu.iris.dmc.test.UPDS_Test"
> output="test_gen.wsdl"
> namespace="${TARGET_NS}"
> location="http://${WS_HOST}/axis/services/UPDS_TestService"
> style="${AXIS_STYLE}"
> >
> <classpath refid="classpath" />
> </axis-java2wsdl>
> </target>
>
> <target name="compile_gen" depends="w2j" >
> <mkdir dir="${build_dir}" />
> <javac debug="${DEBUG}" srcdir="${gen_dir}" destdir="${build_dir}"
> excludes="edu/iris/dmc/test/*Server.java,
> edu/iris/dmc/test/*TestCase.java"
> verbose="no"
> deprecation="yes" >
> <classpath refid="classpath" />
> </javac>
> </target>
>
> <target name="compile" depends="compile_gen">
> <!-- Create the local build directory structure used by compile -->
> <mkdir dir="${build_dir}/${pkg_dir}" />
>
> <!-- Compile the java code from ${src} into ${build_dir} -->
> <javac debug="${DEBUG}" srcdir="${src_dir}" destdir="${build_dir}"
> verbose="no"
> deprecation="yes" >
> <classpath refid="classpath" />
> </javac>
> </target>
>
> <target name="jar" depends="compile"
> description="This builds the deployable distribution jar." >
> <jar jarfile="${jar_filename}" basedir="${build_dir}" />
> </target>
>
> <target name="dist" depends="compile"
> description="This builds the server_client common code jar." >
> <mkdir dir="gen_build" />
> <javac debug="${DEBUG}" destdir="gen_build"
> verbose="no"
> deprecation="yes" >
> <src path="${gen_dir}" />
> <exclude name="edu/iris/dmc/upds/*Server.java" />
> <exclude name="edu/iris/dmc/upds/*TestCase.java" />
> <classpath refid="classpath" />
> </javac>
> <jar jarfile="${dist_filename}"
> basedir="gen_build" />
> <!--delete dir="gen_build"/-->
> </target>
>
> <target name="copyLibs">
> <copy todir="${axis_lib_dir}"
> flatten="true" >
> <fileset dir="${lib_dir}" includes="**/*.jar"
> excludes="xmlParserAPIs.jar
> xercesImpl.jar" />
> </copy>
> </target>
>
> <target name="deploy" depends="jar, copyLibs" >
> <copy file="${jar_filename}" todir="${axis_lib_dir}" />
> <java classname="org.apache.axis.client.AdminClient" >
> <classpath refid="classpath" />
> <arg value="-lhttp://${WS_HOST}/axis/servlet/AxisServlet" />
> <arg value="${basedir}/${project_deploy_file}" />
> </java>
> </target>
>
> <target name="undeploy" >
> <java classname="org.apache.axis.client.AdminClient" >
> <classpath refid="classpath" />
> <arg value="-lhttp://${WS_HOST}/axis/servlet/AxisServlet" />
> <arg value="${basedir}/${project_undeploy_file}" />
> </java>
> </target>
>
> <target name="clean" >
> <delete>
> <fileset dir="${build_dir}" includes="**/*.class" />
> </delete>
> </target>
>
> <target name="clean_gen" >
> <delete>
> <fileset dir="${gen_dir}" includes="**/*.java **/*.wsdd" />
> </delete>
> </target>
>
> <target name="clean_deploy" >
> <delete file="${axis_lib_dir}/${jar_filename}" />
> </target>
>
> <target name="realclean">
> <delete>
> <fileset dir="${build_dir}" />
> </delete>
> <delete >
> <fileset dir="${gen_dir}" />
> </delete>
> <delete>
> <fileset dir="${dist_dir}" />
> </delete>
> </target>
>
> <target name="reload" depends="deploy" >
> <reload url="http://${WS_HOST}/manager"
> username="${tomcat_mgr}"
> password="${tomcat_mgr_passwd}"
> path="/axis" />
> </target>
>
> <target name="reload_axis" >
> <reload url="http://${WS_HOST}/manager"
> username="${tomcat_mgr}"
> password="${tomcat_mgr_passwd}"
> path="/axis" />
> </target>
>
> <target name="client" depends="compile">
> <java classname="edu.iris.dmc.test.ETestClient" classpathref="classpath"/>
> </target>
>
> </project>
>
>
> ------------------------------------------------------------------------
>
> /**
> * UPDS_TestServer.java
> *
> * This file was auto-generated from WSDL
> * by the Apache Axis 1.2.1 Jun 14, 2005 (09:15:57 EDT) WSDL2Java emitter.
> */
>
> package edu.iris.dmc.test;
>
> import java.io.*;
> import java.util.*;
>
> import org.w3c.dom.*;
>
> import edu.iris.dmc.utils.xml.*;
>
> import javax.xml.parsers.DocumentBuilder;
> import javax.xml.parsers.DocumentBuilderFactory;
>
>
> public class UPDS_TestServer implements edu.iris.dmc.test.UPDS_Test{
>
> private GenXer xer = new GenXer(System.out);
>
> private static DocumentBuilderFactory documentFactory = null;
>
> static
> {
> System.out.println("UPDS_TestServer class loaded.");
> org.apache.log4j.PropertyConfigurator.configureAndWatch( "conf/debug_log4j.properties" );
> }
>
> public static Document getDocument(File file)
> throws Exception
> {
> DocumentBuilder builder = getDocumentFactory().newDocumentBuilder();
> return builder.parse( file );
> }
>
> private static DocumentBuilderFactory getDocumentFactory()
> {
> if ( documentFactory == null )
> {
> documentFactory = DocumentBuilderFactory.newInstance();
> documentFactory.setValidating( false );
> documentFactory.setNamespaceAware( true );
> documentFactory.setIgnoringComments( false );
> documentFactory.setIgnoringElementContentWhitespace( true );
> }
> return documentFactory;
> }
>
> public String[] sendStuff(Element[] inputs)
> throws java.rmi.RemoteException
> {
> System.out.println("inputs:" + inputs );
> Element[] elems = inputs;
> String[] returns = new String[elems.length];
> for ( int i = 0; i< elems.length; i++ )
> {
> System.out.println("elem:" + elems[i]);
> returns[i] = elems[i].getTagName();
> }
> return returns;
> }
>
> /*
> public edu.iris.dmc.test.SendStrings sendStuff(edu.iris.dmc.test.ArrayOfElement inputs)
> throws java.rmi.RemoteException
> {
> System.out.println("inputs:" + inputs );
> Element[] elems = inputs.getElement();
> String[] returns = new String[elems.length];
> for ( int i = 0; i< elems.length; i++ )
> {
> System.out.println("elem:" + elems[i]);
> returns[i] = elems[i].getTagName();
> }
> return new SendStrings( returns );
> }
> */
>
> public org.w3c.dom.Element[] getProductsById(java.lang.String[] fnames) {
> System.out.println("filenames:" + fnames );
> Element[] elems = null;
> try
> {
> Vector v = new Vector( fnames.length );
> for ( int i = 0; i < fnames.length; i++ )
> {
> File file = new File( fnames[i] );
> System.out.println("file:" + file.getCanonicalPath() + " exists: " + file.exists());
> Document document = getDocument( file );
> // xer.dump( document );
> v.add( document.getDocumentElement()) ;
> }
> elems = (Element[])v.toArray(new Element[fnames.length]);
> }
> catch ( Exception ex )
> {
> ex.printStackTrace();
> }
> return elems;
> }
>
> public java.lang.String[] sendXml(org.w3c.dom.Element[] sendElems) throws java.rmi.RemoteException
> {
> System.out.println("sendElems: " + sendElems );
> String[] elemNames = new String[ sendElems.length ];
> for ( int i = 0; i < sendElems.length; i++ )
> {
> xer.dump( sendElems[i] );
> elemNames[i]=sendElems[i].getTagName();
> }
> return elemNames;
> }
>
> }
>
>
> ------------------------------------------------------------------------
>
> package edu.iris.dmc.test;
>
> import java.io.File;
> import java.net.URL;
>
> import javax.xml.parsers.DocumentBuilder;
> import javax.xml.parsers.DocumentBuilderFactory;
>
> import org.w3c.dom.*;
>
> public class ETestClient
> {
> private static DocumentBuilderFactory documentFactory = null;
>
> public static Document getDocument(File file)
> throws Exception
> {
> DocumentBuilder builder = getDocumentFactory().newDocumentBuilder();
> return builder.parse( file );
> }
>
> private static DocumentBuilderFactory getDocumentFactory()
> {
> if ( documentFactory == null )
> {
> documentFactory = DocumentBuilderFactory.newInstance();
> documentFactory.setValidating( false );
> documentFactory.setNamespaceAware( true );
> documentFactory.setIgnoringComments( false );
> documentFactory.setIgnoringElementContentWhitespace( true );
> }
> return documentFactory;
> }
>
>
> /**
> * @param args
> */
> public static void main(String[] args)
> {
> try
> {
> UPDS_Test server = new UPDS_TestServiceLocator()
> .getUPDS_TestService( new URL( "http://localhost:8081/axis/services/UPDS_TestService"));
>
> /* System.out.println( "test1: Sending.");
> Element[] sendElems = new Element[2];
> sendElems[0] = getDocument( new File( "/Users/linus/workspace/upds/test/data/Event4.xml" )).getDocumentElement();
> sendElems[1] = getDocument( new File( "/Users/linus/workspace/upds/test/data/cmt_122604a.xml" )).getDocumentElement();
>
> String[] elemTags = server.sendStuff( new ArrayOfElement( sendElems )).getString();
> for ( int i = 0; i < elemTags.length; i++ )
> System.out.println("elem: " + elemTags[i] );
>
> */
> System.out.println( "test2: Retrieving.");
> String[] filenames = new String[] {
> "/Users/linus/workspace/upds/test/data/Event4.xml" ,
> "/Users/linus/workspace/upds/test/data/event3.xml"
> };
>
> Element[] elems = server.getProductsById( filenames );
> System.out.println("elems: " + elems );
> for ( int i = 0; i < elems.length; i++ )
> {
> System.out.println("elem:" + elems[i]);
> }
>
> }
> catch ( Exception ex )
> {
> ex.printStackTrace();
> }
>
> }
>
> }