01: /**
02: * $Id: SimpleWebServiceProvider.java,v 1.1 2003/06/03 10:48:21 sy131129 Exp $
03: * Copyright 2003 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.providers.simplewebservice.rpc;
14:
15: import com.sun.portal.providers.ProviderException;
16:
17: import com.sun.portal.providers.simplewebservice.WebServiceDescriptor;
18: import com.sun.portal.providers.simplewebservice.SimpleWebServiceProviderAdapter;
19: import com.sun.portal.providers.simplewebservice.SimpleWebServiceParameter;
20: import com.sun.portal.providers.simplewebservice.SimpleWebServiceException;
21: import com.sun.portal.providers.simplewebservice.rpc.CallInvoker;
22: import com.sun.portal.providers.simplewebservice.rpc.CallInvokerFactory;
23:
24: /**
25: * This is a sub-class of SimpleWebServiceProviderAdapter that implements
26: * the abstract method invokeWebService using JAXRPC.
27: *
28: */
29: public class SimpleWebServiceProvider extends
30: SimpleWebServiceProviderAdapter {
31:
32: /**
33: * This method invokes the web service method using the input paramters
34: * provided as an array of SimpleWebServiceParameter.
35: *
36: * @param inputValues
37: * @return The output in the form of SimpleWebServiceParameter.
38: * It throws SimpleWebServiceProcessException if the invoke fails because of less serious causes,
39: * like invalid parameters.
40: * @exception com.sun.portal.providers.simplewebservice.SimpleWebServiceException
41: */
42: public SimpleWebServiceParameter invokeWebService(
43: SimpleWebServiceParameter[] inputValues)
44: throws ProviderException, SimpleWebServiceException {
45:
46: SimpleWebServiceParameter returnParam = null;
47:
48: String proxyHost = System.getProperty("http.proxyHost");
49: int proxyPortNumber = -1;
50: try {
51: String proxyPort = System.getProperty("http.proxyPort");
52: proxyPortNumber = Integer.parseInt(proxyPort);
53: } catch (NumberFormatException ex) {
54: proxyPortNumber = -1;
55: }
56:
57: WebServiceDescriptor webServiceDescriptor = getWebServiceDescriptor();
58:
59: String binding = webServiceDescriptor.getSOAPBindingStyle();
60:
61: CallInvoker invoker = CallInvokerFactory.newInstance(binding);
62:
63: returnParam = invoker.invokeXBindingStyleWebService(
64: webServiceDescriptor, inputValues, proxyHost,
65: proxyPortNumber);
66:
67: return returnParam;
68: }
69:
70: }
|