I have the same problem many times, I have it now on webMethods IS 6.1.
I have found that instead of create custom SOAP Processor, is easier to create small Java service with our own implementation of SOAPException, and throw this exception from the service invoked as a Web Service.
In private static String getFaultFormat() in SOAP-ENC:Fault you can write whathever you want, but according to WSDL you implementing.
service:
throw new MySOAPException();
imports:
com.wm.app.b2b.server.SOAPException
source:
static class MySOAPException extends SOAPException {
/**
Values are not very important.
*/
static String faultcode="1";
static String faultstring="fault";
static String faultactor="23";
static String faultdetail="55555";
static Object[] subs = new Object[3];
static Throwable e = new ServiceException("OK?");
static IData other = IDataFactory.create();
public MySOAPException() {
super(faultcode, faultstring, faultactor, faultdetail, subs, e, other);
}
/**
Default body to replace with a proper one with serialization of the exception object thrown as the fault.
*/
private static String getFaultFormat() {
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<SOAP-ENV:Envelope \n"
+ " xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"\n"
+ " xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\"\n"
+ " xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\">\n"
+ " <SOAP-ENV:Body>\n"
+ " <SOAP-ENV:Fault>\n"
+ " <faultcode>SOAP-ENV:{0}</faultcode>\n"
+ " <faultstring>{1}</faultstring>\n"
+ " <faultactor>{2}</faultactor>\n"
+ "{3}{4}"
+ " </SOAP-ENV:Fault>\n"
+ " </SOAP-ENV:Body>\n"
+ "</SOAP-ENV:Envelope>\n";
}
}
#API-Management#webMethods#soa