01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */package org.apache.cxf.systest.soap;
19:
20: import org.apache.cxf.binding.soap.Soap12;
21: import org.apache.cxf.binding.soap.SoapBindingConfiguration;
22: import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
23: import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
24: import org.apache.cxf.test.AbstractCXFTest;
25: import org.apache.hello_world_soap_action.Greeter;
26: import org.junit.Test;
27:
28: public class SoapActionTest extends AbstractCXFTest {
29:
30: @Test
31: public void testEndpoint() throws Exception {
32: String add = "http://localhost:9036/test";
33: JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
34: sf.setServiceBean(new SoapActionGreeterImpl());
35: sf.setAddress(add);
36: sf.setBus(getBus());
37: sf.create();
38:
39: JaxWsProxyFactoryBean pf = new JaxWsProxyFactoryBean();
40: pf.setServiceClass(Greeter.class);
41: pf.setAddress(add);
42: pf.setBus(getBus());
43: Greeter greeter = (Greeter) pf.create();
44:
45: assertEquals("sayHi", greeter.sayHi("test"));
46: assertEquals("sayHi2", greeter.sayHi2("test"));
47:
48: }
49:
50: @Test
51: public void testSoap12Endpoint() throws Exception {
52: String add = "http://localhost:9036/test";
53: JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
54: sf.setServiceBean(new SoapActionGreeterImpl());
55: sf.setAddress(add);
56: sf.setBus(getBus());
57: SoapBindingConfiguration config = new SoapBindingConfiguration();
58: config.setVersion(Soap12.getInstance());
59: sf.setBindingConfig(config);
60: sf.create();
61:
62: JaxWsProxyFactoryBean pf = new JaxWsProxyFactoryBean();
63: pf.setServiceClass(Greeter.class);
64: pf.setAddress(add);
65: pf.setBindingConfig(config);
66: pf.setBus(getBus());
67:
68: Greeter greeter = (Greeter) pf.create();
69:
70: assertEquals("sayHi", greeter.sayHi("test"));
71: assertEquals("sayHi2", greeter.sayHi2("test"));
72: }
73: }
|