Philippe, One other question...
What's the difference between using "soap:fault" and "wsdl:fault" ? Also, I forgot to say... yes you are correct. My implementation class is not touched by the WSDL2Java command. Each time I change my interface (my "portType"), for example to add a new method or change a method prototype, I have to make the corresponding change in my implementation class by hand. v --- philippe ventrillon <[EMAIL PROTECTED]> wrote: > Hi > > I think if you are going from wsdl file you are supposed to > Declare a message for the fault > put somehting like that in your porttype > <operation name='getCurrentLanguageCursorPage'> > <input message='tns:getCurrentLanguageCursorPageIn'/> > <output message='tns:getCurrentLanguageCursorPageOut'/> > <fault name='soapapiFault' message='tns:soapapiFault'/> > </operation> > > Put something like that in the portBinding > <fault name="soapapiFault"> > <soap:fault name='soapapiFault' use='literal' /> > </fault> > > I imagine that when you invoke wsdl2Java it regenerates the service > (with no > throws clause) but not the impl class > > > --- > Philippe > > -----Original Message----- > From: Rhimbo [mailto:[EMAIL PROTECTED] > Sent: jeudi 6 avril 2006 02:49 > To: Axis users > Subject: Can't compile web service with exception > > 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 > > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com