how to configure the fault elements in server-conf.wsdd file
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35232
7
posted
0
SOAP faults are not something you configure. The web service may generate faults, and those faults need to be declared in the WSDL that describes the service, so that the client can handle them appropriately.
Did you take a look at that article?
vijay kumar
Ranch Hand
Joined: Nov 05, 2005
Posts: 58
posted
0
but my wsdl generated automatically by axis according
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35232
7
posted
0
In that case you can't take advantage of the automatic mapping between Java exception and SOAP faults. But you can still generate the faults on the server; it's just that the client then needs to specifically check for SOAP faults. You can write a client-side handler that uses the handleFault method to implement this. This page has various bits and pieces of information how to write that method.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35232
7
posted
0
You can also take a look at the "faults" sample code that comes with Axis. It shows how to write and deploy your code in a way that SOAPFaults are used, and the WSDL is automatically generated correctly, including the wsdl:fault information.
com.mc.MyException at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221) at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128) at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087) at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(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.XML11Configuration.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:375) at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227) at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696) at org.apache.axis.Message.getSOAPEnvelope(Message.java:424) at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62) at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206) at org.apache.axis.client.Call.invokeEngine(Call.java:2765) at org.apache.axis.client.Call.invoke(Call.java:2748) at org.apache.axis.client.Call.invoke(Call.java:2424) at org.apache.axis.client.Call.invoke(Call.java:2347) at org.apache.axis.client.Call.invoke(Call.java:1804) at org.apache.axis.client.AxisClientProxy.invoke(AxisClientProxy.java:163)
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35232
7
posted
0
If SOAPFaultException is thrown, you can add a client-side handler that examines the body of the response for faults, and acts accordingly. You still need to catch the exception in your client code, though.