I am having the same problem... If you find the way to do that, please, let me know...
Right now I am catching the Java exception, creating my AxisFault from the Java Exception by myself, and throwing it again... I don't like it a lot, then if you find something else let me know... Thanks in advance Ransel L�pez, Web Services Developer Time Industrial, Inc. An Outsourced Contractor Time and Cost Tracking Service. ----------------------------------------------------------------------------------------- tel: 780.413.1521 fax: 780.413.0474 http://www.TimeIndustrial.com ----------------------------------------------------------------------------------------- This message and attached files, if any, is (are) intended only for the addressee(s) and may contain privileged or confidential information. Any unauthorized disclosure is strictly prohibited. If destined to our legal counsel, this transmission is privileged communication as between an attorney and its client. If you have received this message in error, please notify us immediately so that we may correct our internal records. Please then delete the original message. Thank you. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Heitzeg, Bill Sent: Thursday, January 15, 2004 11:23 AM To: [EMAIL PROTECTED] Subject: Mapping exceptions to faults using Doc Literal I'm am trying to map a java exception to a SOAP fault using a Doc Literal structure. I'm generating the WSDL from my Java Code. I'm having a very easy time with complex data types, but I can't figure out what I need to do to map an exception to a fault. I think I've listed all the relevant information below, but let me know if there is something missing. thanks, Bill Heitzeg My WebService Class looks like: package com.sabre.cruise.webservices.prototype; /** The <code>ClassName</code> class is used @author <a href="mailto: [EMAIL PROTECTED]">Bill Heitzeg</a> @version 1.0 */ public class BillWebService { public ReallyComplexDataType HelloWorld( ComplexDataType myComplexDataType) throws BillWebServiceFault { String inputString = myComplexDataType.getString(); if ( inputString.compareTo("XXXX")==0) throw new BillWebServiceFault("A Sample Exception"); ComplexDataType nestedDataType = new ComplexDataType(); nestedDataType.setString("Nested Data Type String"); ReallyComplexDataType reallyComplexDataType = new ReallyComplexDataType(); reallyComplexDataType.setReturnMessage("Hello " + myComplexDataType.getString() + " welcome to Complex Data Types!"); reallyComplexDataType.setNestedDataType( nestedDataType ); return reallyComplexDataType; } } My Exception class looks like: package com.sabre.cruise.webservices.prototype; /** * @author sg910604 * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ public class BillWebServiceFault extends Exception { /** * */ public BillWebServiceFault() { super(); // TODO Auto-generated constructor stub } /** * @param message */ public BillWebServiceFault(String message) { super(message); // TODO Auto-generated constructor stub } /** * @param message * @param cause */ public BillWebServiceFault(String message, Throwable cause) { super(message, cause); // TODO Auto-generated constructor stub } /** * @param cause */ public BillWebServiceFault(Throwable cause) { super(cause); // TODO Auto-generated constructor stub } Here's my service description in the .wsdd <service name="BillWebService" provider="java:RPC" style="wrapped" use="literal"> <responseFlow> <handler type="SOAPMessageLogging"/> </responseFlow> <parameter name="allowedMethods" value="*"/> <parameter name="className" value="com.sabre.cruise.webservices.prototype.BillWebService"/> <wsdlFile>/BillWebService.wsdl</wsdlFile> <beanMapping languageSpecificType="java:com.sabre.cruise.webservices.prototype.ComplexDataType"/> <beanMapping languageSpecificType="java:com.sabre.cruise.webservices.prototype.ReallyComplexDataType"/> </service> Finally, here's the javatowsdl Ant task: <!-- 3) Generate the WSDL (This can be done automatically by Axis, but we've chosen to do it ahead of time) --> <target name="generateWSDL" depends="createJar"> <axis-java2wsdl classname="com.sabre.cruise.webservices.prototype.BillWebService" methods="HelloWorld" output="wsdl/BillWebService.wsdl" location="http://localhost:8080/Calculate_axis/services/BillWebService" namespace="http://localhost:8080/Calculate_axis/services/BillWebService" namespaceImpl="http://localhost:8080/Calculate_axis/services/BillWebService" style="WRAPPED" > <classpath path="lib/Calculate.jar" /> </axis-java2wsdl> </target> Bill Heitzeg 1-734-995-9131 Bill Heitzeg 1-734-995-9131
