I was trying to subclassing Axis Fault so that i can customise my fault description,
but it returned me an blank soap message. Can somebody tell me how and why?
your help is appreciated.
 
belows are the server-side code, which basically check if it's not a SOAP 1.2 then return a Fault:
 
import org.w3c.dom.*;
import org.w3c.dom.Text;
import org.apache.axis.message.*;
import org.apache.axis.*;
import javax.xml.soap.Name;
import org.apache.axis.AxisFault;
import java.io.Serializable;
 
public void Envelope(SOAPEnvelope reqenv, SOAPEnvelope resenv) throws MyFault{
 
 private Node rootNode;
 private Element rootElement;
 private String envPrefix;
 private NodeList headerList;
 private NodeList bodyList;
 private static final String NS_ENV = "http://www.w3.org/2003/05/soap-envelope";
  try{
 
   this.rootElement = reqenv.getAsDOM();
   Node rootNode = rootElement;
 
   Node envNode = rootNode.getParentNode();
   this.envPrefix = envNode.getFirstChild().getPrefix();
   String env = envNode.getFirstChild().getLocalName();
 
   if (rootElement.getAttribute("xmlns" + ":" + envPrefix).compareTo(NS_ENV) != 0 ){
 
    MyFault fault = new MyFault();
    throw fault;
   }
class MyFault extends AxisFault implements Serializable{
 
 public MyFault(){
      this.setFaultString("wrong");
      //this.setFaultCodeAsString("WrongVersion");
      //this.setFaultRole("http://sss.com");
      //this.setFaultReason("YouHaveAWrongCode");
      //this.setFaultDetailString("YouAreStupid");
 }
}

Reply via email to