001: /*
002: * The Apache Software License, Version 1.1
003: *
004: *
005: * Copyright (c) 2002 The Apache Software Foundation. All rights
006: * reserved.
007: *
008: * Redistribution and use in source and binary forms, with or without
009: * modification, are permitted provided that the following conditions
010: * are met:
011: *
012: * 1. Redistributions of source code must retain the above copyright
013: * notice, this list of conditions and the following disclaimer.
014: *
015: * 2. Redistributions in binary form must reproduce the above copyright
016: * notice, this list of conditions and the following disclaimer in
017: * the documentation and/or other materials provided with the
018: * distribution.
019: *
020: * 3. The end-user documentation included with the redistribution,
021: * if any, must include the following acknowledgment:
022: * "This product includes software developed by the
023: * Apache Software Foundation (http://www.apache.org/)."
024: * Alternately, this acknowledgment may appear in the software itself,
025: * if and wherever such third-party acknowledgments normally appear.
026: *
027: * 4. The names "WSIF" and "Apache Software Foundation" must
028: * not be used to endorse or promote products derived from this
029: * software without prior written permission. For written
030: * permission, please contact apache@apache.org.
031: *
032: * 5. Products derived from this software may not be called "Apache",
033: * nor may "Apache" appear in their name, without prior written
034: * permission of the Apache Software Foundation.
035: *
036: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
037: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
038: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
039: * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
040: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
041: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
042: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
043: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
044: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
045: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
046: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
047: * SUCH DAMAGE.
048: * ====================================================================
049: *
050: * This software consists of voluntary contributions made by many
051: * individuals on behalf of the Apache Software Foundation and was
052: * originally based on software copyright (c) 2001, 2002, International
053: * Business Machines, Inc., http://www.apache.org. For more
054: * information on the Apache Software Foundation, please see
055: * <http://www.apache.org/>.
056: */
057:
058: /*
059: * The Apache Software License, Version 1.1
060: *
061: *
062: * Copyright (c) 2002 The Apache Software Foundation. All rights
063: * reserved.
064: *
065: * Redistribution and use in source and binary forms, with or without
066: * modification, are permitted provided that the following conditions
067: * are met:
068: *
069: * 1. Redistributions of source code must retain the above copyright
070: * notice, this list of conditions and the following disclaimer.
071: *
072: * 2. Redistributions in binary form must reproduce the above copyright
073: * notice, this list of conditions and the following disclaimer in
074: * the documentation and/or other materials provided with the
075: * distribution.
076: *
077: * 3. The end-user documentation included with the redistribution,
078: * if any, must include the following acknowledgment:
079: * "This product includes software developed by the
080: * Apache Software Foundation (http://www.apache.org/)."
081: * Alternately, this acknowledgment may appear in the software itself,
082: * if and wherever such third-party acknowledgments normally appear.
083: *
084: * 4. The names "WSIF" and "Apache Software Foundation" must
085: * not be used to endorse or promote products derived from this
086: * software without prior written permission. For written
087: * permission, please contact apache@apache.org.
088: *
089: * 5. Products derived from this software may not be called "Apache",
090: * nor may "Apache" appear in their name, without prior written
091: * permission of the Apache Software Foundation.
092: *
093: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
094: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
095: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
096: * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
097: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
098: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
099: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
100: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
101: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
102: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
103: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
104: * SUCH DAMAGE.
105: * ====================================================================
106: *
107: * This software consists of voluntary contributions made by many
108: * individuals on behalf of the Apache Software Foundation and was
109: * originally based on software copyright (c) 2001, 2002, International
110: * Business Machines, Inc., http://www.apache.org. For more
111: * information on the Apache Software Foundation, please see
112: * <http://www.apache.org/>.
113: */
114:
115: package clients.zipcode;
116:
117: import javax.xml.namespace.QName;
118:
119: import org.apache.wsif.WSIFMessage;
120: import org.apache.wsif.WSIFOperation;
121: import org.apache.wsif.WSIFPort;
122: import org.apache.wsif.WSIFService;
123: import org.apache.wsif.WSIFServiceFactory;
124: import org.apache.wsif.base.WSIFServiceImpl;
125: import org.apache.wsif.providers.soap.apachesoap.WSIFDynamicProvider_ApacheSOAP;
126: import org.apache.wsif.util.WSIFPluggableProviders;
127:
128: /**
129: * interopLabProxy
130: * @generated
131: */
132: public class ZIPCodeProxy {
133: private WSIFService fieldService;
134:
135: public ShortZipCodeResponse getShortZipCodeResponse(
136: ShortZipCode input) {
137: return getShortZipCodeResponse(input, null);
138: }
139:
140: public ShortZipCodeResponse getShortZipCodeResponse(
141: ShortZipCode input, String portName) {
142:
143: try {
144:
145: WSIFPort port = null;
146: if (portName != null)
147: port = fieldService.getPort(portName);
148: else
149: port = fieldService.getPort();
150:
151: WSIFOperation operation = port.createOperation(
152: "ShortZipCode", null, null);
153:
154: WSIFMessage inputMessage = operation.createInputMessage();
155: inputMessage.setName("ShortZipCodeSoapIn");
156:
157: WSIFMessage outputMessage = operation.createOutputMessage();
158: outputMessage.setName("ShortZipCodeSoapOut");
159:
160: inputMessage.setObjectPart("parameters", input);
161:
162: operation.executeRequestResponseOperation(inputMessage,
163: outputMessage, null);
164:
165: return (ShortZipCodeResponse) outputMessage
166: .getObjectPart("parameters");
167:
168: } catch (Exception e) {
169: e.printStackTrace();
170: throw new RuntimeException(e.getMessage());
171: }
172: }
173:
174: /**
175: * Constructor
176: * @generated
177: */
178: public ZIPCodeProxy(String wsdl) {
179: super ();
180:
181: try {
182:
183: WSIFDynamicProvider_ApacheSOAP apacheSoapProvider = new WSIFDynamicProvider_ApacheSOAP();
184: apacheSoapProvider
185: .setPartSerializerName("clients.zipcode.LiteralSerializer");
186:
187: WSIFPluggableProviders.overrideDefaultProvider(
188: "http://schemas.xmlsoap.org/wsdl/soap/",
189: apacheSoapProvider);
190:
191: if (fieldService == null) {
192: WSIFServiceFactory factory = WSIFServiceFactory
193: .newInstance();
194: fieldService = factory.getService(wsdl, this .getClass()
195: .getClassLoader(),
196: "http://webservices.eraserver.net/",
197: "ZipCodeResolver",
198: "http://webservices.eraserver.net/",
199: "ZipCodeResolverSoap");
200: }
201:
202: ((WSIFServiceImpl) fieldService).mapType(
203: new QName("http://webservices.eraserver.net/",
204: "ShortZipCode"), ShortZipCode.class);
205: ((WSIFServiceImpl) fieldService)
206: .mapType(new QName(
207: "http://webservices.eraserver.net/",
208: "ShortZipCodeResponse"),
209: ShortZipCodeResponse.class);
210:
211: // provider reset now at end of ZIPCodeTest.doit()
212: //WSIFServiceImpl.setDynamicWSIFProvider(
213: // "http://schemas.xmlsoap.org/wsdl/soap/", null);
214:
215: } catch (Exception e) {
216: e.printStackTrace();
217: }
218: }
219: }
|