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: */
19: package org.apache.axis2.jaxws.client.proxy;
20:
21: import org.apache.axis2.jaxws.ExceptionFactory;
22: import org.apache.axis2.jaxws.client.async.AsyncResponse;
23: import org.apache.axis2.jaxws.core.MessageContext;
24: import org.apache.axis2.jaxws.description.OperationDescription;
25:
26: /**
27: * ProxyAsyncListener will be used to create response object when client does response.get(); The
28: * Class will return the data type associated with Response<T> Generic Class. Example
29: * Response<Float> will return a Float object to client on Response.get() call.
30: */
31: public class ProxyAsyncListener extends AsyncResponse {
32:
33: JAXWSProxyHandler handler = null;
34: Object[] inputArgs = null;
35: OperationDescription operationDesc = null;
36:
37: public ProxyAsyncListener(OperationDescription od) {
38: super (od.getEndpointInterfaceDescription()
39: .getEndpointDescription());
40: operationDesc = od;
41: }
42:
43: public JAXWSProxyHandler getHandler() {
44: return handler;
45: }
46:
47: public void setHandler(JAXWSProxyHandler handler) {
48: this .handler = handler;
49: }
50:
51: public void setInputArgs(Object[] inputArgs) {
52: this .inputArgs = inputArgs;
53: }
54:
55: @Override
56: public Object getResponseValueObject(MessageContext mc) {
57: try {
58: //Delegate the request to create respose to proxyHandler
59: //since it has all the logic written to create response for Sync
60: //and oneWay.
61: return handler.createResponse(null, inputArgs, mc,
62: operationDesc);
63: } catch (Throwable e) {
64: throw ExceptionFactory.makeWebServiceException(e);
65: }
66: }
67:
68: @Override
69: public Throwable getFaultResponse(MessageContext mc) {
70: return JAXWSProxyHandler.getFaultResponse(mc, operationDesc);
71: }
72: }
|