1 package org.codehaus.xfire.wsdl11;
2
3 import javax.xml.namespace.QName;
4
5 import org.codehaus.xfire.service.object.ObjectService;
6 import org.codehaus.xfire.service.object.Operation;
7 import org.codehaus.xfire.services.Echo;
8 import org.codehaus.xfire.test.AbstractXFireTypeTest;
9 import org.codehaus.xfire.type.AutoTypeMapping;
10 import org.codehaus.xfire.type.TypeMapping;
11 import org.codehaus.xfire.type.basic.StringType;
12 import org.dom4j.Document;
13
14 /***
15 * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
16 */
17 public class WSDLVisitorTest
18 extends AbstractXFireTypeTest
19 {
20 public void testVisitor()
21 throws Exception
22 {
23 TypeMapping tm = new AutoTypeMapping();
24 tm.register(String.class, new QName("urn:Echo", "echoRequest"), new StringType());
25 tm.register(String.class, new QName("urn:Echo", "echoResponse"), new StringType());
26
27 ObjectService service =
28 (ObjectService) getServiceBuilder()
29 .create(Echo.class, tm, getTestFile("src/test/org/codehaus/xfire/wsdl11/Echo.wsdl").toURL());
30
31 assertEquals(1, service.getOperations().size());
32
33 Operation o = service.getOperation("echo");
34 assertNotNull(o);
35
36 Document response = invokeService("Echo", "/org/codehaus/xfire/wsdl11/echo11.xml");
37
38 addNamespace("e", "urn:Echo");
39 assertValid("//e:echoResponse[text()='Yo Yo']", response);
40 }
41 }