Hi all,

I too am having trouble with exceptions.  I can't even get past 
compilation now.  I added a simple method to my interface 
definition:
Family.java:

     public void testException() throws Exception;


Here's the implementation:
FamilyImpl.java:

     public void testException() throws Exception 
     {
       throw new Exception("Well take that!");
     }


I did:
$ java org.apache.axis.wsdl.Java2WSDL -o family.wsdl \
  --implClass disney.dis.family.FamilyImpl \
  -l"http://localhost:8080/axis/services/familyAccounts"; \
  -p"disney.dis.family" urn:familyAccounts \
  disney.dis.family.Family

to generate the family.wsdl file.  Then I did:

$ java org.apache.axis.wsdl.WSDL2Java -o . -d Session -s \
  -p disney.dis.family family.wsdl


When I compile, I get these errors:

FamilyAccountsSoapBindingImpl.java:123: testException() in
disney.dis.family.FamilyAccountsSoapBindingImpl cannot implement
testException() in disney.dis.family.Family; overridden method does not
throw java.lang.Exception
  public void testException() throws java.lang.Exception
              ^
FamilyImpl.java:1105: testException() in disney.dis.family.FamilyImpl
cannot implement testException() in disney.dis.family.Family; overridden
method does not throw java.lang.Exception
  public void testException() throws Exception


Apparently the compiler thinks that my method prototype in the 
Family.java interface definition doesn't throw Exception.  But it
does (above).  

More strangely, here is the prototype from the _generated_
 Family.java file:

    public void testException() throws java.rmi.RemoteException;

WSDL2Java added "throws java.rmi.RemoteException" but not 
"throws Exception". 

Why is WSDL2Java not adding the "throws Exception" to the
method prototype in the generated Family.java interface file? 

I followed a few threads the past several days about "tweaking
the wsdl file to get exception handling correct."  I admit I
didn't quite follow.  

Is there something I need to do after generating the wsdl file,
before running the WSDL2Java command, to get exceptions to work?  

Here is excerpt from the generated WSDL below:

   <wsdl:message name="testExceptionResponse">

   </wsdl:message>

  <wsdl:message name="testExceptionRequest">

   </wsdl:message>

   <wsdl:operation name="testException">

      <wsdl:input message="impl:testExceptionRequest"
name="testExceptionRequest"/>

      <wsdl:output message="impl:testExceptionResponse"
name="testExceptionResponse"/>

   </wsdl:operation>

     <wsdl:operation name="testException">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="testExceptionRequest">

            <wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
namespace="urn:familyAccounts" use="encoded"/>

         </wsdl:input>

         <wsdl:output name="testExceptionResponse">

            <wsdlsoap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
namespace="urn:familyAccounts" use="encoded"/>

         </wsdl:output>

      </wsdl:operation>



Thanks,

Vartan





__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to