Source Code Cross Referenced for TestClient.java in  » J2EE » enhydra » samples » bidbuy » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » enhydra » samples.bidbuy 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2004 The Apache Software Foundation.
003:         * 
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         * 
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         * 
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package samples.bidbuy;
018:
019:        import org.apache.axis.client.Call;
020:        import org.apache.axis.client.Service;
021:        import org.apache.axis.encoding.XMLType;
022:        import org.apache.axis.encoding.ser.BeanDeserializerFactory;
023:        import org.apache.axis.encoding.ser.BeanSerializerFactory;
024:        import org.apache.axis.utils.Options;
025:
026:        import javax.xml.namespace.QName;
027:        import javax.xml.rpc.ParameterMode;
028:        import java.net.URL;
029:        import java.util.Calendar;
030:
031:        /**
032:         * Test Client for the echo interop service.  See the main entrypoint
033:         * for more details on usage.
034:         *
035:         * @author Sam Ruby <rubys@us.ibm.com>
036:         */
037:        public class TestClient {
038:
039:            private static Service service = null;
040:            private static Call call = null;
041:
042:            /**
043:             * Test an echo method.  Declares success if the response returns
044:             * true with an Object.equal comparison with the object to be sent.
045:             * @param method name of the method to invoke
046:             * @param toSend object of the correct type to be sent
047:             */
048:            private static void test(String method, Object toSend) {
049:
050:            }
051:
052:            /**
053:             * Main entry point.  Tests a variety of echo methods and reports
054:             * on their results.
055:             *
056:             * Arguments are of the form:
057:             *   -h localhost -p 8080 -s /soap/servlet/rpcrouter
058:             */
059:            public static void main(String args[]) throws Exception {
060:                // set up the call object
061:                Options opts = new Options(args);
062:                service = new Service();
063:                call = (Call) service.createCall();
064:                call.setTargetEndpointAddress(new URL(opts.getURL()));
065:                call.setUseSOAPAction(true);
066:                call.setSOAPActionURI("http://www.soapinterop.org/Bid");
067:
068:                // register the PurchaseOrder class
069:                QName poqn = new QName("http://www.soapinterop.org/Bid",
070:                        "PurchaseOrder");
071:                Class cls = PurchaseOrder.class;
072:                call.registerTypeMapping(cls, poqn,
073:                        BeanSerializerFactory.class,
074:                        BeanDeserializerFactory.class);
075:
076:                // register the Address class
077:                QName aqn = new QName("http://www.soapinterop.org/Bid",
078:                        "Address");
079:                cls = Address.class;
080:                call.registerTypeMapping(cls, aqn, BeanSerializerFactory.class,
081:                        BeanDeserializerFactory.class);
082:
083:                // register the LineItem class
084:                QName liqn = new QName("http://www.soapinterop.org/Bid",
085:                        "LineItem");
086:                cls = LineItem.class;
087:                call.registerTypeMapping(cls, liqn,
088:                        BeanSerializerFactory.class,
089:                        BeanDeserializerFactory.class);
090:
091:                try {
092:                    // Default return type based on what we expect
093:                    call.setOperationName(new QName(
094:                            "http://www.soapinterop.org/Bid", "Buy"));
095:                    call.addParameter("PO", poqn, ParameterMode.IN);
096:                    call.setReturnType(XMLType.XSD_STRING);
097:
098:                    LineItem[] li = new LineItem[2];
099:                    li[0] = new LineItem("Tricorder", 1, "2500.95");
100:                    li[1] = new LineItem("Phasor", 3, "7250.95");
101:
102:                    PurchaseOrder po = new PurchaseOrder("NCC-1701", Calendar
103:                            .getInstance(), new Address("Sam Ruby", "Home",
104:                            "Raleigh", "NC", "27676"), new Address(
105:                            "Lou Gerstner", "Work", "Armonk", "NY", "15222"),
106:                            li);
107:
108:                    // issue the request
109:                    String receipt = (String) call.invoke(new Object[] { po });
110:
111:                    System.out.println(receipt);
112:                } catch (Exception e) {
113:                    System.out.println("Buy failed: " + e);
114:                    throw e;
115:                }
116:            }
117:
118:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.