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.lang.reflect.Method;
19: import java.util.List;
20: import java.util.Map;
21:
22: import javax.xml.ws.handler.Handler;
23:
24: import net.sf.cglib.proxy.MethodProxy;
25:
26: import org.apache.axis2.description.AxisService;
27: import org.apache.axis2.jaxws.description.EndpointDescription;
28: import org.apache.axis2.jaxws.description.impl.DescriptionUtils;
29: import org.apache.axis2.jaxws.spi.BindingProvider;
30: import org.apache.geronimo.jaxws.client.EndpointInfo;
31: import org.apache.geronimo.jaxws.client.PortMethodInterceptor;
32:
33: public class Axis2PortMethodInterceptor extends PortMethodInterceptor {
34:
35: public Axis2PortMethodInterceptor(
36: Map<Object, EndpointInfo> seiInfoMap) {
37: super (seiInfoMap);
38: }
39:
40: public Object intercept(Object target, Method method,
41: Object[] arguments, MethodProxy methodProxy)
42: throws Throwable {
43: Object proxy = super .intercept(target, method, arguments,
44: methodProxy);
45:
46: BindingProvider axisProxy = (BindingProvider) proxy;
47:
48: List<Handler> handlers = (axisProxy.getBinding() != null) ? axisProxy
49: .getBinding().getHandlerChain()
50: : null;
51: AxisService axisService = (axisProxy.getEndpointDescription() != null) ? axisProxy
52: .getEndpointDescription().getAxisService()
53: : null;
54:
55: DescriptionUtils.registerHandlerHeaders(axisService, handlers);
56:
57: return proxy;
58: }
59:
60: }
|