If you want to simulate delay/loss at the receiver then you can do so by writing message handler at the service end. In the handleResponse() for receiver side message handler, you can introduce some delay by sleeping the handler for sometime at random intervals or simply throw a JAXRPCException causing a faultcode=soap:Server to be returned to the client.
On the server side a JAXRPC Exception always results in a
SOAP fault being generated and sent back to the client (assuming Request/Response messaging). The SOAP fault message has a fault code of "soap:Server" to indicate that the problem is not related to the SOAP message itself, that it results from some server-side error.
Also to simulate the condition when the arrived soap message at the receiver end is corrupt you can throw a SOAPFaultException at random intervals in your handleRequest() method of the message handler on server side. A SOAPFaultException can be thrown only by the handleRequest() methods of a handler chain on the server side, when a message handler encounters a problem with the SOAP message itself. This will result in a SOAP fault of faultcode=soap:Client.
So message handler can be used to simulate
- a faulty soap message arriving at the receiver and
- a delayed response received at the sender.
To read about how to work with message handlers read
this and
this.
Also you may be interested in reading
this which talks about how to make the webservice's idempotent and then implement sender retries in case when a soap fault is received from the receiver.