You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/11/02 19:36:41 UTC
svn commit: r330310 - in /webservices/axis/trunk/java/test/wsdl/faults2: ./
FaultService.wsdl FaultServiceSoapBindingImpl.java
FaultServiceTestCase.java build.xml
Author: dims
Date: Wed Nov 2 10:36:39 2005
New Revision: 330310
URL: http://svn.apache.org/viewcvs?rev=330310&view=rev
Log:
Test case for AXIS-2013 from Hans ("Deserialization of Exception fails")
Added:
webservices/axis/trunk/java/test/wsdl/faults2/
webservices/axis/trunk/java/test/wsdl/faults2/FaultService.wsdl
webservices/axis/trunk/java/test/wsdl/faults2/FaultServiceSoapBindingImpl.java
webservices/axis/trunk/java/test/wsdl/faults2/FaultServiceTestCase.java
webservices/axis/trunk/java/test/wsdl/faults2/build.xml
Added: webservices/axis/trunk/java/test/wsdl/faults2/FaultService.wsdl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/test/wsdl/faults2/FaultService.wsdl?rev=330310&view=auto
==============================================================================
--- webservices/axis/trunk/java/test/wsdl/faults2/FaultService.wsdl (added)
+++ webservices/axis/trunk/java/test/wsdl/faults2/FaultService.wsdl Wed Nov 2 10:36:39 2005
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<definitions targetNamespace="http://test.com/wsdl/faults"
+ xmlns:tns="http://test.com/wsdl/faults"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:serviceNS="http://test.com/wsdl/faults"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns="http://schemas.xmlsoap.org/wsdl/">
+
+ <types>
+ <xsd:schema
+ targetNamespace="http://test.com/wsdl/faults">
+
+ <xsd:element name="throwFaultResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="return" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="throwFault">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="p1" type="xsd:string"/>
+ <xsd:element name="p2" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:complexType name="TestFault">
+ <xsd:sequence>
+ <xsd:element name="a" type="xsd:string"/>
+ <xsd:element name="b" type="xsd:int"/>
+ <xsd:element name="c" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ </xsd:schema>
+ </types>
+
+ <message name="throwFaultResponseMessage">
+ <part name="responseParams" element="tns:throwFaultResponse"/>
+ </message>
+ <message name="throwFaultRequestMessage">
+ <part name="requestParams" element="tns:throwFault"/>
+<!--type="xsd:string"
+ <part name="p2" type="xsd:string"/-->
+ </message>
+ <message name="throwFaultFault">
+ <part name="msg" type="tns:TestFault" />
+ </message>
+
+ <portType name="FaultServicePortType">
+ <operation name="throwFault" parameterOrder="">
+ <input name="throwFaultRequest" message="serviceNS:throwFaultRequestMessage"/>
+ <output name="throwFaultResponse" message="serviceNS:throwFaultResponseMessage"/>
+ <fault name="throwFaultFault" message="serviceNS:throwFaultFault"/>
+ </operation>
+ </portType>
+ <binding name="FaultServiceSoapBinding" type="serviceNS:FaultServicePortType">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="throwFault">
+ <soap:operation soapAction="" style="document"/>
+ <input name="throwFaultRequest">
+ <soap:body use="literal"/>
+ </input>
+ <output name="throwFaultResponse">
+ <soap:body use="literal"/>
+ </output>
+ <fault name="throwFaultFault">
+ <soap:fault name="throwFaultFault" use="literal"/>
+ </fault>
+ </operation>
+ </binding>
+ <service name="FaultService">
+ <port name="FaultService" binding="serviceNS:FaultServiceSoapBinding">
+ <soap:address location="http://localhost:8080/axis/services/FaultService"/>
+ </port>
+ </service>
+</definitions>
Added: webservices/axis/trunk/java/test/wsdl/faults2/FaultServiceSoapBindingImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/test/wsdl/faults2/FaultServiceSoapBindingImpl.java?rev=330310&view=auto
==============================================================================
--- webservices/axis/trunk/java/test/wsdl/faults2/FaultServiceSoapBindingImpl.java (added)
+++ webservices/axis/trunk/java/test/wsdl/faults2/FaultServiceSoapBindingImpl.java Wed Nov 2 10:36:39 2005
@@ -0,0 +1,14 @@
+package test.wsdl.faults2;
+
+import org.apache.axis.message.MessageElement;
+import org.apache.axis.utils.XMLUtils;
+
+public class FaultServiceSoapBindingImpl implements test.wsdl.faults2.FaultServicePortType {
+
+ public String throwFault(java.lang.String p1, java.lang.String p2) throws java.rmi.RemoteException, test.wsdl.faults2.TestFault {
+ if (p1.equals("throw") || p2.equals("throw")) {
+ throw new TestFault(p1,0,p2);
+ }
+ return p2 + " " + p1;
+ }
+}
Added: webservices/axis/trunk/java/test/wsdl/faults2/FaultServiceTestCase.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/test/wsdl/faults2/FaultServiceTestCase.java?rev=330310&view=auto
==============================================================================
--- webservices/axis/trunk/java/test/wsdl/faults2/FaultServiceTestCase.java (added)
+++ webservices/axis/trunk/java/test/wsdl/faults2/FaultServiceTestCase.java Wed Nov 2 10:36:39 2005
@@ -0,0 +1,50 @@
+/**
+ * FaultServiceTestCase.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.2.1 Oct 12, 2005 (05:12:52 CEST) WSDL2Java emitter.
+ */
+
+package test.wsdl.faults2;
+
+public class FaultServiceTestCase extends junit.framework.TestCase {
+ public FaultServiceTestCase(java.lang.String name) {
+ super(name);
+ }
+
+ public void testFaultServiceWSDL() throws Exception {
+ javax.xml.rpc.ServiceFactory serviceFactory = javax.xml.rpc.ServiceFactory.newInstance();
+ java.net.URL url = new java.net.URL(new test.wsdl.faults2.FaultServiceLocator().getFaultServiceAddress() + "?WSDL");
+ javax.xml.rpc.Service service = serviceFactory.createService(url, new test.wsdl.faults2.FaultServiceLocator().getServiceName());
+ assertTrue(service != null);
+ }
+
+ public void test1FaultServiceThrowFault() throws Exception {
+ test.wsdl.faults2.FaultServiceSoapBindingStub binding;
+ try {
+ binding = (test.wsdl.faults2.FaultServiceSoapBindingStub)
+ new test.wsdl.faults2.FaultServiceLocator().getFaultService();
+ }
+ catch (javax.xml.rpc.ServiceException jre) {
+ if(jre.getLinkedCause()!=null)
+ jre.getLinkedCause().printStackTrace();
+ throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught: " + jre);
+ }
+ assertNotNull("binding is null", binding);
+
+ // Time out after a minute
+ binding.setTimeout(60000);
+
+ // Test operation
+ try {
+ java.lang.String value = null;
+ value = binding.throwFault("throw","throw");
+ }
+ catch (test.wsdl.faults2.TestFault e1) {
+ System.out.println("TESTFAULT EXCEPTION THROWN");
+ //throw new junit.framework.AssertionFailedError("throwFaultFault Exception caught: " + e1);
+ }
+ // TBD - validate results
+ }
+
+}
Added: webservices/axis/trunk/java/test/wsdl/faults2/build.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/test/wsdl/faults2/build.xml?rev=330310&view=auto
==============================================================================
--- webservices/axis/trunk/java/test/wsdl/faults2/build.xml (added)
+++ webservices/axis/trunk/java/test/wsdl/faults2/build.xml Wed Nov 2 10:36:39 2005
@@ -0,0 +1,103 @@
+<?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 mseibert@us.ibm.com
+
+Copyright:
+ Copyright (c) 2002-2003 Apache Software Foundation.
+</description>
+==================================================================== -->
+
+<project default="compile">
+
+<property name="axis.home" location="../../.." />
+<property name="componentName" value="test/wsdl/faults2" />
+ &properties;
+ &paths;
+ &taskdefs;
+ &taskdefs_post_compile;
+ &targets;
+
+<target name="clean">
+ <echo message="Removing ${build.dir}/classes/${componentName} and ${build.dir}/work/${componentName}" />
+ <delete dir="${build.dir}/classes/${componentName}"/>
+ <delete dir="${build.dir}/work/${componentName}"/>
+</target>
+
+<target name="copy" depends="setenv"/>
+
+<target name="addGlobalConfigWsdd">
+ <replace file="${build.dir}/work/${componentName}/deploy.wsdd"
+ token="<!-- Services from FaultService WSDL service -->"
+ value="<globalConfiguration><parameter name='sendMultiRefs' value='false'/></globalConfiguration>">
+ </replace>
+</target>
+
+<target name="enableSendMultiRefs">
+ <echo message="setting 'sendMultiRefs=true' in deploy.wsdd..."/>
+ <replace file="${build.dir}/work/${componentName}/deploy.wsdd"
+ token="parameter name='sendMultiRefs' value='false'"
+ value="parameter name='sendMultiRefs' value='true'">
+ </replace>
+</target>
+
+<target name="compile" depends="copy">
+ <echo message="Compiling test.wsdl.faults2"/>
+ <!-- WSDL fault generation test -->
+ <wsdl2java url="${axis.home}/test/wsdl/faults2/FaultService.wsdl"
+ output="${axis.home}/build/work"
+ testcase="yes"
+ deployscope="Application"
+ serverSide="yes"
+ verbose="no"
+ noimports="no">
+ <mapping namespace="http://test.com/wsdl/faults" package="test.wsdl.faults2"/>
+ </wsdl2java>
+
+ <echo message="adding 'sendMultiRefs=false' to deploy.wsdd..."/>
+ <antcall target="addGlobalConfigWsdd"/>
+
+ <copy todir="${build.dir}/work/test/wsdl/faults2" overwrite="yes">
+ <fileset dir="${axis.home}/test/wsdl/faults2">
+ <include name="*.java"/>
+ </fileset>
+ </copy>
+
+ <javac srcdir="${build.dir}/work" destdir="${build.dest}" nowarn="${nowarn}" source="${source}" fork="${javac.fork}"
+ debug="${debug}">
+ <classpath refid="classpath" />
+ <include name="test/wsdl/faults2/*.java" />
+ </javac>
+</target>
+
+<target name="run" >
+ <antcall target="execute-Component" />
+ <antcall target="enableSendMultiRefs" />
+ <antcall target="execute-Component" />
+</target>
+
+</project>