01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.geronimo.axis2.client;
17:
18: import java.net.URI;
19: import java.util.Map;
20:
21: import javax.xml.namespace.QName;
22: import javax.xml.ws.handler.HandlerResolver;
23:
24: import org.apache.axis2.jaxws.context.WebServiceContextImpl;
25: import org.apache.commons.logging.Log;
26: import org.apache.commons.logging.LogFactory;
27: import org.apache.geronimo.axis2.Axis2HandlerResolver;
28: import org.apache.geronimo.gbean.AbstractName;
29: import org.apache.geronimo.jaxws.JAXWSAnnotationProcessor;
30: import org.apache.geronimo.jaxws.JNDIResolver;
31: import org.apache.geronimo.jaxws.client.EndpointInfo;
32: import org.apache.geronimo.jaxws.client.JAXWSServiceReference;
33: import org.apache.geronimo.jaxws.client.PortMethodInterceptor;
34: import org.apache.geronimo.xbeans.javaee.HandlerChainsDocument;
35: import org.apache.geronimo.xbeans.javaee.HandlerChainsType;
36: import org.apache.xmlbeans.XmlException;
37:
38: /**
39: * @version $Rev$ $Date$
40: */
41: public class Axis2ServiceReference extends JAXWSServiceReference {
42:
43: private static final Log LOG = LogFactory
44: .getLog(Axis2ServiceReference.class);
45:
46: public Axis2ServiceReference(String serviceClassName,
47: String referenceClassName, URI wsdlURI, QName serviceQName,
48: AbstractName name, String handlerChainsXML,
49: Map<Object, EndpointInfo> seiInfoMap) {
50: super (handlerChainsXML, seiInfoMap, name, serviceQName,
51: wsdlURI, referenceClassName, serviceClassName);
52: }
53:
54: protected HandlerResolver getHandlerResolver(Class serviceClass) {
55: HandlerChainsType types = null;
56: try {
57: if (this .handlerChainsXML != null) {
58: try {
59: types = HandlerChainsDocument.Factory.parse(
60: this .handlerChainsXML).getHandlerChains();
61: } catch (XmlException e) {
62: types = HandlerChainsType.Factory
63: .parse(this .handlerChainsXML);
64: }
65: }
66: } catch (Exception e) {
67: LOG.warn("Failed to deserialize handler chains", e);
68: }
69: JAXWSAnnotationProcessor annotationProcessor = new JAXWSAnnotationProcessor(
70: new JNDIResolver(), new WebServiceContextImpl());
71: Axis2HandlerResolver handlerResolver = new Axis2HandlerResolver(
72: classLoader, serviceClass, types, annotationProcessor);
73: return handlerResolver;
74: }
75:
76: protected PortMethodInterceptor getPortMethodInterceptor() {
77: return new Axis2PortMethodInterceptor(this.seiInfoMap);
78: }
79:
80: }
|