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.soapheader;
19:
20: import java.net.URL;
21:
22: import javax.xml.namespace.QName;
23:
24: import org.apache.cxf.pizza.Pizza;
25: import org.apache.cxf.pizza.PizzaService;
26: import org.apache.cxf.pizza.types.CallerIDHeaderType;
27: import org.apache.cxf.pizza.types.OrderPizzaResponseType;
28: import org.apache.cxf.pizza.types.OrderPizzaType;
29: import org.apache.cxf.pizza.types.ToppingsListType;
30: import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
31: import org.junit.BeforeClass;
32: import org.junit.Ignore;
33: import org.junit.Test;
34:
35: public class HeaderClientServerTest extends
36: AbstractBusClientServerTestBase {
37:
38: private final QName serviceName = new QName(
39: "http://cxf.apache.org/pizza", "PizzaService");
40:
41: @BeforeClass
42: public static void startServers() throws Exception {
43: assertTrue("server did not launch correctly",
44: launchServer(Server.class));
45: }
46:
47: @Test
48: @Ignore("Works in systests, but the wsdl2java will not load the soap module in the top level")
49: public void testBasicConnection() throws Exception {
50: Pizza port = getPort();
51:
52: OrderPizzaType req = new OrderPizzaType();
53: ToppingsListType t = new ToppingsListType();
54: t.getTopping().add("test");
55: req.setToppings(t);
56:
57: CallerIDHeaderType header = new CallerIDHeaderType();
58: header.setName("mao");
59: header.setPhoneNumber("108");
60:
61: OrderPizzaResponseType res = port.orderPizza(req);
62: System.out.println(res);
63:
64: //OrderPizzaResponseType res = port.orderPizza(req, header);
65:
66: //assertEquals(208, res.getMinutesUntilReady());
67: }
68:
69: private Pizza getPort() {
70: URL wsdl = getClass().getResource("/wsdl/pizza_service.wsdl");
71: assertNotNull("WSDL is null", wsdl);
72:
73: PizzaService service = new PizzaService(wsdl, serviceName);
74: assertNotNull("Service is ull ", service);
75:
76: return service.getPizzaPort();
77: }
78:
79: }
|