Java Reference
In-Depth Information
Addressing Faults
Problem
You want your declared faults (exceptions), and not just your operation inputs and outputs, to
participate in Addressing.
Solution
Use the WS-Addressing @Action annotation's fault attribute. It accepts a @FaultAction an-
notation for each exception your method throws.
Discussion
Most of the work is handled for you in the annotations. All you have to do is declare the fault
action above the method that throws the exception you want to map with WS-Addressing. It
accepts a Class instance indicating the exception you're mapping, along with the URI you
want to give as the address of the exception. The complete solution is shown in Examples
12-2 and 12-3 .
Example12-2.The web service that uses addressing on faults
package com.soacookbook;
import javax.jws.*;
import javax.xml.ws.Action;
import javax.xml.ws.FaultAction;
import javax.xml.ws.soap.Addressing;
/**
* Shows a class that uses WS-Addressing, including
* a Fault that is Addressing enabled.
*/
@WebService
@Addressing(required=true)
public class HelloAddressingFaultsWS {
@WebMethod
@Action(
input="http://soacookbook.com/name",
output="http://soacookbook.com/greeting",
fault={
Search WWH ::




Custom Search