1 package org.codehaus.xfire.client; 2 3 import javax.xml.stream.XMLStreamException; 4 import javax.xml.stream.XMLStreamReader; 5 import javax.xml.stream.XMLStreamWriter; 6 7 import org.codehaus.xfire.attachments.Attachments; 8 import org.codehaus.xfire.fault.XFireFault; 9 10 /*** 11 * <p> 12 * A ClientHandler creates the necessary requestion and response objects 13 * from the XML streams. If this is a SOAP invocation, there will be a 14 * handler for the header and for the body. 15 * </p> 16 * 17 * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a> 18 * @since Oct 26, 2004 19 */ 20 public interface ClientHandler 21 { 22 /*** 23 * @return Whether or not there is a request to write. 24 */ 25 boolean hasRequest(); 26 27 /*** 28 * Write the request to the XMLStreamWriter. 29 * 30 * @param writer 31 * @throws XMLStreamException 32 */ 33 void writeRequest( XMLStreamWriter writer ) 34 throws XMLStreamException; 35 36 /*** 37 * Handle the response. 38 * @param reader 39 * @throws XMLStreamException 40 * @throws XFireFault The ClientHandler must create an XFireFault 41 * and throw it if a fault occurs. 42 */ 43 void handleResponse( XMLStreamReader reader ) 44 throws XMLStreamException, XFireFault; 45 46 /*** 47 * Get the attachments to send with the request. 48 * 49 * @return Return <code>null</code> if there are no attachments. 50 */ 51 Attachments getAttachments(); 52 }