1 package org.codehaus.xfire; 2 3 import java.io.ByteArrayOutputStream; 4 import org.codehaus.xfire.fault.SOAP12FaultHandler; 5 import org.codehaus.xfire.handler.EchoHandler; 6 import org.codehaus.xfire.service.Service; 7 import org.codehaus.xfire.service.SimpleService; 8 import org.codehaus.xfire.wsdl.WSDL; 9 10 /*** 11 * XFireTest 12 * 13 * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a> 14 */ 15 public class XFireTest 16 extends AbstractXFireTest 17 { 18 19 public void setUp() throws Exception 20 { 21 super.setUp(); 22 23 SimpleService service = new SimpleService(); 24 service.setName("Echo"); 25 service.setSoapVersion(SOAPConstants.SOAP12_ENVELOPE_NS); 26 service.setWSDLURL(getClass().getResource("/org/codehaus/xfire/echo11.wsdl").toString()); 27 28 service.setServiceHandler(new EchoHandler()); 29 service.setFaultHandler(new SOAP12FaultHandler()); 30 31 getServiceRegistry().register(service); 32 } 33 34 public void testInvoke() 35 throws Exception 36 { 37 ByteArrayOutputStream out = new ByteArrayOutputStream(); 38 MessageContext context = 39 new MessageContext( "Echo", 40 null, 41 out, 42 null, 43 null ); 44 45 getXFire().invoke( getClass().getResourceAsStream("/org/codehaus/xfire/echo11.xml"), 46 context ); 47 48 System.out.println( out.toString() ); 49 } 50 51 public void testWSDL() 52 throws Exception 53 { 54 Service service = (Service) getServiceRegistry().getService("Echo"); 55 56 WSDL wsdl = service.getWSDL(); 57 58 assertNotNull(wsdl); 59 60 ByteArrayOutputStream out = new ByteArrayOutputStream(); 61 getXFire().generateWSDL("Echo", out); 62 } 63 }