I tried the modified samples fault code (in the samples.fault package)
from Richard Hanson at
http://www.mail-archive.com/[EMAIL PROTECTED]/msg03552.html.
This code includes a case where an AxisFault is thrown when the
getEmployees() operation is called. I made no modifications to the
source, deployed the webservice with the AdminClient, and invoked it
from the EmployeeClient.
Again, when I request a valid employee "#001" - I get a SOAP response
for Bill Gates. (Viewable in SOAPMonitor)
When I call the getEmployees operation - I do not get a SOAP Response.
The AxisFault is NOT returned in the form of SOAP.
In my EmployeeClient I/O, I get:
===========================================================
Get Employees -
Fault =====================================================
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.Client
faultSubcode:
faultString: Operation is not yet implemented.
faultActor:
faultNode:
faultDetail:
{}string:getEmployees()
{}string:Not Implemented
===========================================================
So am AxisFault is thrown and caught(as expected in the code), but it
isn't sent back as SOAP.
public Employee[] getEmployees() throws AxisFault {
AxisFault fault = new AxisFault();
fault.setFaultCode(new
QName("http://schemas.xmlsoap.org/soap/envelope/", "Server.Client"));
fault.setFaultString("Operation is not yet implemented.");
fault.addFaultDetailString("getEmployees()");
fault.addFaultDetailString("Not Implemented");
throw fault;
}
I don't understand ... very very confused. Since the AXIS API states "An
exception which maps cleanly to a SOAP fault. This is a base class for
exceptions which are mapped to faults."
Are there any configuration options that I need to turn on in Axis?
Perhaps in the server-config.wsdd?
Thank you,
Ann
[EMAIL PROTECTED] wrote:
>
> from memory the nosuchemployee extends remote exception (as opposed to
> extending axis fault) hence you see an exception client side. the
> recommended way is to use faults as opposed to exceptions for interop. the
> fault sample included in axis1.1 isnt especially good in my opinion -
>
> Richard Hanson posted some useful notes at
> http://www.mail-archive.com/[EMAIL PROTECTED]/msg03552.html
>
> also look at
> http://www-106.ibm.com/developerworks/xml/library/ws-tip-jaxrpc.html
>
> /t
>
> > I tried the samples.fault web service included in Axis 1.1 Release. I
> > made no modifications to the source, deployed the webservice with the
> > AdminClient, and invoked it from the EmployeeClient.
> >
> > When I request a valid employee "#001" - I get a SOAP response for Bill
> > Gates. When I request an invalid employee "1" - I do not get a SOAP
> > Response. I get the stack dump in the EmployeeClient I/O window (see
> > below).
> >
> > I have no idea why the NoSuchEmployee exception is NOT returned in the
> > form of a SOAP Fault. I am using SOAP Monitor to view the
> > request/responses.
> >
> > Could you please tell me what I am doing wrong or if I am taking the
> > wrong approach? This is my first experimentation with SOAP Faults. I am
> > using Axis Final Version 1.1
> >
> > Thank you,
> > Ann
> >
> > Stack Dump:
> > samples.faults.NoSuchEmployeeFault
> > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> > Method)
> > at
> > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> > at
> > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> > at
> > java.lang.reflect.Constructor.newInstance(Constructor.java:274)
> > at java.lang.Class.newInstance0(Class.java:308)
> > at java.lang.Class.newInstance(Class.java:261)
> > at
> > org.apache.axis.encoding.ser.BeanDeserializer.<init>(BeanDeserializer.java:125)
> > at
> > org.apache.axis.encoding.ser.BeanDeserializerFactory.getGeneralPurpose(BeanDeserializerFactory.java:127)
> > at
> > org.apache.axis.encoding.ser.BaseDeserializerFactory.getDeserializerAs(BaseDeserializerFactory.java:125)
> > at
> > org.apache.axis.encoding.DeserializationContextImpl.getDeserializer(DeserializationContextImpl.java:481)
> > at
> > org.apache.axis.encoding.DeserializationContextImpl.getDeserializerForType(DeserializationContextImpl.java:554)
> > at
> > org.apache.axis.message.SOAPFaultDetailsBuilder.onStartChild(SOAPFaultDetailsBuilder.java:177)
> > at
> > org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1040)
> > at
> > org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
> > at
> > org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
> > Source)
> > at
> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
> > Source)
> > at
> > org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
> > Source)
> > at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
> > Source)
> > at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown
> > Source)
> > at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> > at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
> > Source)
> > at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
> > at
> > org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:257)
> > at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:582)
> > at org.apache.axis.Message.getSOAPEnvelope(Message.java:447)
> > at org.apache.axis.client.Call.invokeEngine(Call.java:2702)
> > at org.apache.axis.client.Call.invoke(Call.java:2665)
> > at org.apache.axis.client.Call.invoke(Call.java:2355)
> > at org.apache.axis.client.Call.invoke(Call.java:2278)
> > at org.apache.axis.client.Call.invoke(Call.java:1772)
> > at samples.faults.EmployeeClient.main(EmployeeClient.java:48)
> > Exception in thread "main"
> >