10.17.3. Fault Handling


An implementation may throw a SOAPFaultException
public void throwSoapFaultException()
{
   SOAPFactory factory = SOAPFactory.newInstance();
   SOAPFault fault = factory.createFault("this is a fault string!", new QName("http://foo", "FooCode"));
   fault.setFaultActor("mr.actor");
   fault.addDetail().addChildElement("test");
   throw new SOAPFaultException(fault);
}
Copy to Clipboard Toggle word wrap
or an application specific user exception
public void throwApplicationException() throws UserException
{
   throw new UserException("validation", 123, "Some validation error");
}
Copy to Clipboard Toggle word wrap

Note

In case of the latter JBossWS generates the required fault wrapper beans at runtime if they are not part of the deployment
Back to top
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2025 Red Hat