Java Reference
In-Depth Information
}
}
Here you simply invoke the service using a null parameter, which you know will generate the
fault for the
sayHello
operation. Recall that when getting the port stub in the client, you must
add the
AddressingFeature
.
This produces the following output, shown in a fragment:
---[HTTP response 500]---
<S:Header>
<To xmlns="http://www.w3.org/2005/08/addressing">
http://www.w3.org/2005/08/addressing/anonymous
</To>
<Action xmlns="http://www.w3.org/2005/08/addressing">
http://soacookbook.com/myFault
</Action>
//other WS-Addressing headers...
<S:Body>
<S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope">
<faultcode>S:Server</faultcode>
<faultstring>
Could not say hello: The name was null or empty.
</faultstring>
<detail>
<ns2:HelloException xmlns:ns2="http://soacookbook.com/">
<message>
Could not say hello: The name was null or empty.
</message>
</ns2:HelloException>
First, you get an HTTP 500 response code, which is in accordance with section 3.4.7 of the
Basic Profile 1.1.
Next, you see that the value of the
Action
element is the WS-Addressing address specified in
your
FaultAction
annotation in the service endpoint operation, which looks like this:
@Action(..., fault= {
@FaultAction(className=HelloException.class,
value="http://soacookbook.com/myFault")})