Source Code Cross Referenced for RPCCallHandler.java in  » Portal » Open-Portal » com » sun » portal » providers » simplewebservice » rpc » 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 » Portal » Open Portal » com.sun.portal.providers.simplewebservice.rpc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Copyright 2003 Sun Microsystems, Inc. All
003:         * rights reserved. Use of this product is subject
004:         * to license terms. Federal Acquisitions:
005:         * Commercial Software -- Government Users
006:         * Subject to Standard License Terms and
007:         * Conditions.
008:         *
009:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
010:         * are trademarks or registered trademarks of Sun Microsystems,
011:         * Inc. in the United States and other countries.
012:         */package com.sun.portal.providers.simplewebservice.rpc;
013:
014:        import com.sun.portal.providers.simplewebservice.WebServiceDescriptor;
015:        import com.sun.portal.providers.simplewebservice.SimpleWebServiceParameter;
016:        import com.sun.portal.providers.simplewebservice.ParameterDescriptor;
017:        import com.sun.portal.providers.simplewebservice.util.XList;
018:        import com.sun.xml.rpc.encoding.CombinedSerializer;
019:        import com.sun.xml.rpc.encoding.SingletonSerializerFactory;
020:        import com.sun.xml.rpc.encoding.SingletonDeserializerFactory;
021:        import com.sun.xml.rpc.encoding.literal.LiteralFragmentSerializer;
022:
023:        import javax.xml.rpc.Call;
024:        import javax.xml.rpc.Service;
025:        import javax.xml.rpc.ServiceException;
026:        import javax.xml.namespace.QName;
027:        import javax.xml.soap.SOAPElement;
028:        import java.util.Iterator;
029:
030:        /**
031:         *
032:         * User: Ravikiran
033:         * Date: Oct 11, 2003
034:         * Time: 3:18:13 PM
035:         */
036:        class RPCCallHandler {
037:            public Call createCall(Service service,
038:                    WebServiceDescriptor descriptor) throws ServiceException {
039:
040:                ParameterDescriptor[] inParams = descriptor.getInputParams();
041:                if (inParams != null) {
042:                    for (int i = 0; i < inParams.length; i++) {
043:                        registerSerializers(service, inParams[i], descriptor
044:                                .getInputEncodingStyleURI());
045:                    }
046:                }
047:
048:                ParameterDescriptor[] outParam = descriptor.getOutputParams();
049:                if (outParam != null && (outParam.length > 0)) {
050:
051:                    registerSerializers(service, outParam[0], descriptor
052:                            .getOutputEncodingStyleURI());
053:                }
054:
055:                // Create call from service
056:                String inputNamespace = descriptor.getInputNamespace();
057:                if (inputNamespace == null)
058:                    inputNamespace = "";
059:
060:                QName portQName = new QName(descriptor.getPortName());
061:                QName methodQName = new QName(inputNamespace, descriptor
062:                        .getMethodName());
063:
064:                Call call = service.createCall(portQName, methodQName);
065:
066:                return call;
067:            }
068:
069:            /*
070:             * For each of the input parameters and for the output parameter, register
071:             * the corresponding serializers & deserializers. This also results in the
072:             * the QName to Java class mapping being determined.
073:             *
074:             * This function also registers the serializer/deserializers of the constituent
075:             * types, if the current parameter's element is a complex type or an array of
076:             * complex type, by recursively calling itself.
077:             */
078:            protected void registerSerializers(Service service,
079:                    ParameterDescriptor inParam, String encodingToUse) {
080:                // Register the serializers & deserializers for this parameter
081:                registerParameterDescriptor(service, inParam, encodingToUse);
082:
083:                if (inParam.isArrayType()) {
084:
085:                    if (!inParam.isSimpleTypeArray()) {
086:                        XList value = (XList) inParam.getValue();
087:                        Iterator iterator = value.iterator();
088:                        while (iterator.hasNext()) {
089:                            ParameterDescriptor elementParam = (ParameterDescriptor) iterator
090:                                    .next();
091:                            if (!elementParam.isSimpleType()) {
092:                                registerSerializers(service, elementParam,
093:                                        encodingToUse);
094:                            }
095:                        }
096:                    }
097:                } else {
098:                    if (!inParam.isSimpleType()) {
099:                        XList value = (XList) inParam.getValue();
100:                        Iterator iterator = value.iterator();
101:                        while (iterator.hasNext()) {
102:                            ParameterDescriptor elementParam = (ParameterDescriptor) iterator
103:                                    .next();
104:                            if (!elementParam.isSimpleType()) {
105:                                registerSerializers(service, elementParam,
106:                                        encodingToUse);
107:                            }
108:                        }
109:                    }
110:                }
111:            }
112:
113:            /*
114:             * Registers the serializers/deserializers for the type of the parameter.
115:             */
116:            protected void registerParameterDescriptor(Service service,
117:                    ParameterDescriptor param, String encodingToUse) {
118:
119:                if (param.isArrayType()) {
120:                    // ArrayTypeName of a ParameterDescriptor holds the type name of the elements
121:                    // of the array. Hence, if the type name of the elements is primitive, then
122:                    // register this param as primitive type array, else as a complex type array,
123:                    // using the appropriate registration handler.
124:                    if (param.isSimpleTypeArray()) {
125:                        SimpleTypeHandler simpleHandler = TypeHandlerFactory
126:                                .getSimpleTypeHandler(service, encodingToUse);
127:                        simpleHandler.registerSimpleTypeArrayHandlers(param);
128:
129:                    } else {
130:                        ComplexTypeHandler complexHandler = TypeHandlerFactory
131:                                .getComplexTypeHandler(service, encodingToUse);
132:
133:                        complexHandler
134:                                .registerComplexTypeHandler(
135:                                        param,
136:                                        ComplexTypeHandler.COMPLEX_ARRAY_TYPE_SERIALIZER);
137:                    }
138:
139:                } else {
140:                    // Determine if it is a complex type or a simple type.
141:                    // Register accordingly using the appropriate registration handler.
142:                    if (!param.isSimpleType()) {
143:                        ComplexTypeHandler complexHandler = TypeHandlerFactory
144:                                .getComplexTypeHandler(service, encodingToUse);
145:
146:                        complexHandler.registerComplexTypeHandler(param,
147:                                ComplexTypeHandler.COMPLEX_TYPE_SERIALIZER);
148:                    } else {
149:                        SimpleTypeHandler simpleHandler = TypeHandlerFactory
150:                                .getSimpleTypeHandler(service, encodingToUse);
151:                        simpleHandler.registerSimpleTypeHandlers(param);
152:                    }
153:                }
154:            }
155:
156:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.