001: /*
002: *
003: * Copyright (c) 2007, Sun Microsystems, Inc.
004: *
005: * All rights reserved.
006: *
007: * Redistribution and use in source and binary forms, with or without
008: * modification, are permitted provided that the following conditions
009: * are met:
010: *
011: * * Redistributions of source code must retain the above copyright
012: * notice, this list of conditions and the following disclaimer.
013: * * Redistributions in binary form must reproduce the above copyright
014: * notice, this list of conditions and the following disclaimer in the
015: * documentation and/or other materials provided with the distribution.
016: * * Neither the name of Sun Microsystems nor the names of its contributors
017: * may be used to endorse or promote products derived from this software
018: * without specific prior written permission.
019: *
020: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
021: * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
022: * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
023: * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
024: * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
025: * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
026: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
027: * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
028: * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
029: * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
030: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
031: */
032: // This class was generated by 172 StubGenerator.
033: // Contents subject to change without notice.
034: // @generated
035: package example.serverscript.connector;
036:
037: import javax.microedition.xml.rpc.ComplexType;
038: import javax.microedition.xml.rpc.Element;
039: import javax.microedition.xml.rpc.Operation;
040: import javax.microedition.xml.rpc.Type;
041:
042: import javax.xml.namespace.QName;
043: import javax.xml.rpc.JAXRPCException;
044:
045: public class Interface_Stub implements
046: example.serverscript.connector.Interface, javax.xml.rpc.Stub {
047: //
048: // End user methods
049: //
050: protected static final QName _qname_String_1 = new QName("",
051: "String_1");
052: protected static final QName _qname_String_2 = new QName("",
053: "String_2");
054: protected static final QName _qname_result = new QName("", "result");
055: protected static final QName _qname_request = new QName(
056: "http://serverscript.org/types", "request");
057: protected static final QName _qname_requestResponse = new QName(
058: "http://serverscript.org/types", "requestResponse");
059: protected static final QName _qname_wsdl_request = new QName(
060: "http://serverscript.org/wsdl", "request");
061: protected static final Element _type_request;
062: protected static final Element _type_requestResponse;
063:
064: static {
065: // Create all of the Type's that this stub uses, once.
066: Element _type_String_1;
067: _type_String_1 = new Element(_qname_String_1, Type.STRING, 1,
068: 1, true);
069:
070: Element _type_String_2;
071: _type_String_2 = new Element(_qname_String_2, Type.STRING, 1,
072: 1, true);
073:
074: ComplexType _complexType_request;
075: _complexType_request = new ComplexType();
076: _complexType_request.elements = new Element[2];
077: _complexType_request.elements[0] = _type_String_1;
078: _complexType_request.elements[1] = _type_String_2;
079: _type_request = new Element(_qname_request,
080: _complexType_request);
081:
082: Element _type_result;
083: _type_result = new Element(_qname_result, Type.STRING, 1, 1,
084: true);
085:
086: ComplexType _complexType_requestResponse;
087: _complexType_requestResponse = new ComplexType();
088: _complexType_requestResponse.elements = new Element[1];
089: _complexType_requestResponse.elements[0] = _type_result;
090: _type_requestResponse = new Element(_qname_requestResponse,
091: _complexType_requestResponse);
092: }
093:
094: private String[] _propertyNames;
095: private Object[] _propertyValues;
096:
097: public Interface_Stub() {
098: _propertyNames = new String[] { ENDPOINT_ADDRESS_PROPERTY };
099: _propertyValues = new Object[] { "http://cds.cmsg.sun.com:80/serverscript/serverscript" };
100: }
101:
102: public void _setProperty(String name, Object value) {
103: int size = _propertyNames.length;
104:
105: for (int i = 0; i < size; ++i) {
106: if (_propertyNames[i].equals(name)) {
107: _propertyValues[i] = value;
108:
109: return;
110: }
111: }
112:
113: // Need to expand our array for a new property
114: String[] newPropNames = new String[size + 1];
115: System.arraycopy(_propertyNames, 0, newPropNames, 0, size);
116: _propertyNames = newPropNames;
117:
118: Object[] newPropValues = new Object[size + 1];
119: System.arraycopy(_propertyValues, 0, newPropValues, 0, size);
120: _propertyValues = newPropValues;
121: _propertyNames[size] = name;
122: _propertyValues[size] = value;
123: }
124:
125: public Object _getProperty(String name) {
126: for (int i = 0; i < _propertyNames.length; ++i) {
127: if (_propertyNames[i].equals(name)) {
128: return _propertyValues[i];
129: }
130: }
131:
132: if (ENDPOINT_ADDRESS_PROPERTY.equals(name)
133: || USERNAME_PROPERTY.equals(name)
134: || PASSWORD_PROPERTY.equals(name)) {
135: return null;
136: }
137:
138: if (SESSION_MAINTAIN_PROPERTY.equals(name)) {
139: return new java.lang.Boolean(false);
140: }
141:
142: throw new JAXRPCException("Stub does not recognize property: "
143: + name);
144: }
145:
146: protected void _prepOperation(Operation op) {
147: for (int i = 0; i < _propertyNames.length; ++i) {
148: op.setProperty(_propertyNames[i], _propertyValues[i]
149: .toString());
150: }
151: }
152:
153: //
154: // Begin user methods
155: //
156: public java.lang.String request(java.lang.String string_1,
157: java.lang.String string_2) throws java.rmi.RemoteException {
158: // Copy the incoming values into an Object array if needed.
159: Object[] inputObject = new Object[2];
160: inputObject[0] = string_1;
161: inputObject[1] = string_2;
162:
163: Operation op = Operation.newInstance(_qname_wsdl_request,
164: _type_request, _type_requestResponse);
165: _prepOperation(op);
166: op.setProperty(Operation.SOAPACTION_URI_PROPERTY, "");
167:
168: Object resultObj;
169:
170: try {
171: resultObj = op.invoke(inputObject);
172: } catch (JAXRPCException e) {
173: Throwable cause = e.getLinkedCause();
174:
175: if (cause instanceof java.rmi.RemoteException) {
176: throw (java.rmi.RemoteException) cause;
177: }
178:
179: throw e;
180: }
181:
182: java.lang.String result;
183:
184: // Convert the result into the right Java type.
185: // Unwrapped return value
186: Object resultObj2 = ((Object[]) resultObj)[0];
187: result = (java.lang.String) resultObj2;
188:
189: return result;
190: }
191: }
|