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.factory_pattern;
19:
20: import javax.jws.WebService;
21: import javax.xml.namespace.QName;
22:
23: import org.apache.cxf.BusFactory;
24: import org.apache.cxf.jaxws.EndpointImpl;
25: import org.apache.cxf.ws.addressing.EndpointReferenceType;
26: import org.apache.cxf.wsdl.EndpointReferenceUtils;
27:
28: @WebService(serviceName="NumberFactoryService",portName="NumberFactoryPort",endpointInterface="org.apache.cxf.factory_pattern.NumberFactory",targetNamespace="http://cxf.apache.org/factory_pattern")
29: public class HttpNumberFactoryImpl extends NumberFactoryImpl {
30:
31: public HttpNumberFactoryImpl() {
32: super ();
33: // do servant creation up front so manual epr creation test has endpoint to talk to.
34: // the manual epr will not come from create()
35: //
36: manageNumberServantInitialisation();
37: }
38:
39: public EndpointReferenceType create(String id) {
40: String portName = null;
41: return EndpointReferenceUtils.getEndpointReferenceWithId(
42: NUMBER_SERVICE_QNAME, portName, id, BusFactory
43: .getDefaultBus());
44: }
45:
46: protected void initDefaultServant() {
47: servant = new HttpNumberImpl();
48:
49: String wsdlLocation = "testutils/factory_pattern.wsdl";
50: String bindingId = null;
51: EndpointImpl ep = new EndpointImpl(BusFactory.getDefaultBus(),
52: servant, bindingId, wsdlLocation);
53: ep.setEndpointName(new QName(NUMBER_SERVICE_QNAME
54: .getNamespaceURI(), "NumberPort"));
55: ep.publish();
56: templateEpr = ep.getServer().getDestination().getAddress();
57: }
58: }
|