ich habe ein Problem mit der Verwendung von user defined exceptions in einem WS. Ich verwende axis2 mit den WTP unter eclipse.
Der Webservice besteht aus einer einzigen Methode, die ein direkt von java.lang.exception abgeleitet Exception werfen kann. Über WTP erzeuge ich den WS und deploy ihn im Tomcat5.5.
public class TestService {
public String sayHello() throws TestException {
return "Hello";
}
}
public class TestException extends Exception {
}
Der Service deployed ohne Probleme und kann angesprochen werden, WSDL am Ende der Mail.
Wenn ich nun über WTP einen Client erzeugen möchte, erhalte ich immer die Fehlermeldung
IWAB0399E Error in generating Java from WSDL: java.io.IOException: ERROR: Missing <soap:fault> element inFault "TestException" in operation "TestException", in binding sayHello
java.io.IOException: ERROR: Missing <soap:fault> element inFault "TestException" in operation "TestException", in binding sayHello
at org.apache.axis.wsdl.symbolTable.SymbolTable.faultsFromSOAPFault(SymbolTable.java:2858)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populateBindings(SymbolTable.java:2549)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:744)
at org.apache.axis.wsdl.symbolTable.SymbolTable.add(SymbolTable.java:543)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:518)
at org.apache.axis.wsdl.symbolTable.SymbolTable.populate(SymbolTable.java:495)
at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:361)
at java.lang.Thread.run(Thread.java:619)
Jede Menge googlen hat mich leider nicht auf die vielleicht einfach Lösung gebracht.
Kann mir einer von Euch helfen?
Viele Grüße und Danke.
Thorsten
------------------ WSDL
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://soap.sandbox.tviel.de" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ax21="http://soap.sandbox.tviel.de/xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://soap.sandbox.tviel.de">
<wsdl:documentation>
Please Type your service description here
</wsdl:documentation>
<wsdl:types>
<xs:schema xmlns:ax22="http://soap.sandbox.tviel.de" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://soap.sandbox.tviel.de/xsd">
<xs:import namespace="http://soap.sandbox.tviel.de"/>
<xs:complexType name="TestException">
<xs:complexContent>
<xs:extension base="ax22:Exception">
<xs:sequence/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
<xs:schema xmlns:ax23="http://soap.sandbox.tviel.de/xsd" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://soap.sandbox.tviel.de">
<xs:import namespace="http://soap.sandbox.tviel.de/xsd"/>
<xs:complexType name="Exception">
<xs:sequence>
<xs:element minOccurs="0" name="Exception" nillable="true" type="xs:anyType"/>
</xs:sequence>
</xs:complexType>
<xs:element name="TestException">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="TestException" nillable="true" type="ax21:TestException"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="sayHelloResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
<wsdl:message name="sayHelloRequest"/>
<wsdl:message name="sayHelloResponse">
<wsdl:part name="parameters" element="ns:sayHelloResponse"/>
</wsdl:message>
<wsdl:message name="TestException">
<wsdl:part name="parameters" element="ns:TestException"/>
</wsdl:message>
<wsdl:portType name="TestServicePortType">
<wsdl:operation name="sayHello">
<wsdl:input message="ns:sayHelloRequest" wsaw:Action="urn:sayHello"/>
<wsdl:output message="ns:sayHelloResponse" wsaw:Action="urn:sayHelloResponse"/>
<wsdl:fault message="ns:TestException" name="TestException" wsaw:Action="urn:sayHelloTestException"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TestServiceSoap11Binding" type="ns:TestServicePortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="sayHello">
<soap:operation soapAction="urn:sayHello" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="TestException">
<soap:fault use="literal" name="TestException"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="TestServiceSoap12Binding" type="ns:TestServicePortType">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<wsdl:operation name="sayHello">
<soap12:operation soapAction="urn:sayHello" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
<wsdl:fault name="TestException">
<soap12:fault use="literal" name="TestException"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="TestServiceHttpBinding" type="ns:TestServicePortType">
<http:binding verb="POST"/>
<wsdl:operation name="sayHello">
<http:operation location="TestService/sayHello"/>
<wsdl:input>
<mime:content type="text/xml" part="sayHello"/>
</wsdl:input>
<wsdl:output>
<mime:content type="text/xml" part="sayHello"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TestService">
<wsdl:port name="TestServiceHttpSoap11Endpoint" binding="ns:TestServiceSoap11Binding">
<soap:address location="http://192.168.178.43:8080/SOAPTest/services/TestService.TestServiceHttpSoap11Endpoint/"/>
</wsdl:port>
<wsdl:port name="TestServiceHttpSoap12Endpoint" binding="ns:TestServiceSoap12Binding">
<soap12:address location="http://192.168.178.43:8080/SOAPTest/services/TestService.TestServiceHttpSoap12Endpoint/"/>
</wsdl:port>
<wsdl:port name="TestServiceHttpEndpoint" binding="ns:TestServiceHttpBinding">
<http:address location="http://192.168.178.43:8080/SOAPTest/services/TestService.TestServiceHttpEndpoint/"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>