01: /**
02: *
03: * Licensed to the Apache Software Foundation (ASF) under one or more
04: * contributor license agreements. See the NOTICE file distributed with
05: * this work for additional information regarding copyright ownership.
06: * The ASF licenses this file to You under the Apache License, Version 2.0
07: * (the "License"); you may not use this file except in compliance with
08: * 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, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */package org.superbiz.servlet;
18:
19: import javax.xml.ws.Service;
20: import java.io.PrintStream;
21: import java.net.URL;
22:
23: public class WebserviceClient {
24: /**
25: * Unfortunately, to run this example with CXF you need to have a HUGE class path. This
26: * is just what is required to run CXF:
27: * <p/>
28: * jaxb-api-2.0.jar
29: * jaxb-impl-2.0.3.jar
30: * <p/>
31: * saaj-api-1.3.jar
32: * saaj-impl-1.3.jar
33: * <p/>
34: * <p/>
35: * cxf-api-2.0.2-incubator.jar
36: * cxf-common-utilities-2.0.2-incubator.jar
37: * cxf-rt-bindings-soap-2.0.2-incubator.jar
38: * cxf-rt-core-2.0.2-incubator.jar
39: * cxf-rt-databinding-jaxb-2.0.2-incubator.jar
40: * cxf-rt-frontend-jaxws-2.0.2-incubator.jar
41: * cxf-rt-frontend-simple-2.0.2-incubator.jar
42: * cxf-rt-transports-http-jetty-2.0.2-incubator.jar
43: * cxf-rt-transports-http-2.0.2-incubator.jar
44: * cxf-tools-common-2.0.2-incubator.jar
45: * <p/>
46: * geronimo-activation_1.1_spec-1.0.jar
47: * geronimo-annotation_1.0_spec-1.1.jar
48: * geronimo-ejb_3.0_spec-1.0.jar
49: * geronimo-jpa_3.0_spec-1.1.jar
50: * geronimo-servlet_2.5_spec-1.1.jar
51: * geronimo-stax-api_1.0_spec-1.0.jar
52: * jaxws-api-2.0.jar
53: * axis2-jws-api-1.3.jar
54: * <p/>
55: * wsdl4j-1.6.1.jar
56: * xml-resolver-1.2.jar
57: * XmlSchema-1.3.1.jar
58: */
59: public static void main(String[] args) throws Exception {
60: PrintStream out = System.out;
61:
62: Service helloPojoService = Service.create(new URL(
63: "http://localhost:8080/ejb-examples/hello?wsdl"), null);
64: HelloPojo helloPojo = helloPojoService.getPort(HelloPojo.class);
65: out.println();
66: out.println("Pojo Webservice");
67: out.println(" helloPojo.hello(\"Bob\")="
68: + helloPojo.hello("Bob"));
69: out.println(" helloPojo.hello(null)="
70: + helloPojo.hello(null));
71: out.println();
72:
73: Service helloEjbService = Service.create(new URL(
74: "http://localhost:8080/HelloEjbService?wsdl"), null);
75: HelloEjb helloEjb = helloEjbService.getPort(HelloEjb.class);
76: out.println();
77: out.println("EJB Webservice");
78: out.println(" helloEjb.hello(\"Bob\")="
79: + helloEjb.hello("Bob"));
80: out.println(" helloEjb.hello(null)=" + helloEjb.hello(null));
81: out.println();
82: }
83: }
|