Oracle9iAS Portal Developer Kit
FAQ on Web Services and PDK-Java
This document provides answers for frequently asked questions about using Web Services in portlets with the Oracle9iAS Portal Developer Kit.
ASSUMPTIONS
You have a basic understanding of Oracle9iAS Portal and PDK-Java.
You have a basic understanding of Web Services and the SOA(Service Oriented Architecture). For more background information, (including terminology like SOA, SOAP, UDDI, WSDL), you will find further resources here.
GENERAL
ANS: With Oracle9iAS Portal Developer Kit (PDK), you can invoke both RPC style and DOC style web services in a declarative fashion.
ANS: To get started right away, you need to install: OC4J Oracle9iAS Release 2 - J2EE Developer's Preview, Oracle9i JDeveloper Release Candidate, and PDK-J2EE ( to be released as part of PDK-April shortly). Also remember to provide the Proxy host and port while starting up OC4J. (e.g. java -Dhttp.proxyHost=www-proxy.us.oracle.com -Dhttp.proxyPort=80 -jar oc4j.jar ).
ANS: Point the PDK-Java framework to your Web Service, and add the portlet to a page:
ANS: To invoke a DOC style service, you need to use the built-in DocWebServiceRenderer class, and fill in relevant tags in the provider.xml.
ANS: To invoke an RPC style service, you need to use a tool such as the JDeveloper to generate a 'stub' for your Web Service from its WSDL document, and then plug the stub into the RPCWebServiceRenderer class by filling in tags in the provider.xml
ANS: For DOC style portlets, the important tags are endpointURL, element, attribute, literal and responseXSL. For RPC style portlets, the important tags are className, renderMethod, param, and responseXSL.
ANS: Every web service publishes its WSDL document to a site like xmethods.com, or a UDDI directory. In lay terms, the tags:
For further details on WSDL documents, refer to WSDL 1.1.
ANS: Web Services (mostly DOC style) that return literal XML that can be handled by a built-in literal XML handler class in the PDK-J2EE. You need to set the literal tag of provider.xml to point to these built in classes ( LiteralXML and LiteralXML$Handler).
ANS: A Web Services response can be passed through an XSL filter to apply the relevant transformations to control the look and feel. You need to set the responseXSL tag for ponting to the name of the stylesheet which will be generated or used, if provided.
ANS: No. PDK-J2EE would generate a default stylesheet if it does not find the named .xsl. You can then modify this generated stylesheet, if you need to.
ANS: You can set the logging tag to true for your portlet, in which case both the Web Service request and response XMLs are generated. This is the response XML on which your XSL transformation is going to be applied. You will find these under the j2ee/home/applications directory path of OC4J, in the same directory as the provider.xml. You can also look at the application.log under the j2ee/home/application-deployments/<appname> directory for any error log information.
ANS: You can have one master portlet drive another details Web Services portlet(s) by passing parameters between them. You can bind the service parameter to a URL parameter declaratively, and it would automatically be driven by the URL parameter passed from another portlet.
ANS: Web Service parameters can use the provider.xml tags to bind to:
ANS: You can use the default tag n the provider.xml to provide a default value to the Web Service.
ANS: You can use the prompt tag in the provider.xml to drive the generation of an HTML form which prompts for the input parameters to the Web Service.
ANS: You can set the mandatory tag to true for your parameter, to prevent a call to the Web Service unless a parameter value is passed.
ANS: You can find a sample provider.xml for both RPC style and DOC style portlets here.
ANS: You can add portlet features like Customization, as you would normally do in a Java portlet. You can add an Edit page, and more pages for the different show modes. You can bind the Web Service parameters to the Edit data that is updated in the Edit page. You can save the customization data in the preference store, or the session store and even bind the session parameters to the Web Service parameters. There are other features that would make sense in coding within the Web Service, if you are the Web Service developer.
ANS: You can use any toolkit like Oracle9i JDeveloper to develop in any programming language and deploy these as Web Services. Oracle9i JDeveloper has some great features for Web Services development and deployment, like the Web Services publishing wizard and stub generation wizard.
ANS: You can find further resources from the links provided below.
BACKGROUND
Web Services are discrete business services that can be programmatically accessed over the internet in a standard manner. They encapsulate business services that can be platform and language independent. They can be described, published, discovered and invoked in a distributed computing environment.
There are two "styles" of SOAP communication - RPC based(Remote Procedure Calls) and DOC based (Document style). In the DOC style, the SOAP Body carries a generic XML document. There's no explicit concept of "method invocation" coming into play here; it's simply about passing XML docs back and forth between the client and server. Most of the early work on SOAP toolkit implementations focused on RPC-style SOAP. Today, it's more balanced between RPC and document styles. Both styles are suited for different situations. In some cases, the expressiveness of XML documents is preferable needed; in other cases, the easy integration into development environments that SOAP RPC gives you (with automatic type serialization/ deserialization, etc.) is important.
Service-Oriented Architecture (SOA) SOA is a conceptual architecture for implementing dynamic e-business. Today, most of the systems and applications running in the business world are made up of tightly-coupled applications and subsystems. The drawback with this is that a change to any one subsystem can causes breakage in a variety of dependent applications. This brittle aspect of existing systems is in part responsible for the high cost of system maintenance and the limitations around the number of trading partners one can manage.
A service provider is a Network node that provides a service interface for a software asset that manages a specific set of tasks. A service provider node can represent the services of a business entity or it can simply represent the service interface for a reusable subsystem.
A service requestor is a Network node that discovers and invokes other software services to provide a business solution. Service requestor nodes will often represent a business application component that performs remote procedure calls to a distributed object, the service provider. In some cases, the provider node may reside locally within an intranet or in other cases it could reside remotely over the Internet. The conceptual nature of SOA leaves the networking, transport protocol, and security details to the specific implementation.
The third SOA participant is that of the service broker; it is a Network node that acts as a repository, yellow pages, or clearing house for software interfaces that are published by service providers. A business entity or an independent operator can represent a service broker.
These three SOA participants interact using three basic operations: publish, find, and bind. Service providers publish services to a service broker. Service requesters find required services using a service broker and bind to them.
GLOSSARY
SOAP: Simple Object Access Protocol is an XML-based lightweight protocol for the exchange of information in a decentralized, distributed environment. SOAP defines a messaging protocol between requestor and provider objects, such that the requesting objects can perform a remote method invocation on the providing objects in an object-oriented programming fashion.
WSDL: The Web Services Description Language is an XML vocabulary that provides a standard way of describing service IDLs. WSDL provides an abstract language for defining the published operations of a service with their respective parameters and data types. The language also addresses the definition of the location and binding details of the service.
UDDI: The Universal Description, Discovery, and Integration specification provides a common set of SOAP APIs that enable the implementation of a service broker. The UDDI specification was outlined to help facilitate the creation, description, discovery, and integration of Web based services.
SAMPLE PROVIDER DEFINITION FILE
The following provider.xml illustrates the tags used for an RPC style Web Service portlet:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?providerDefinition version="3.1"?> <provider class="oracle.portal.provider.v2.DefaultProviderDefinition"> <portlet class="oracle.portal.provider.v2.DefaultPortletDefinition"> <id>1</id> <name>LocalTemperature</name> <title>Temperature Web Service Portlet</title> <shortTitle>Temperature Information</shortTitle> <description>Web Service demonstration portlet.</description> <timeout>100</timeout> <timeoutMessage>Temperature portlet timed out</timeoutMessage> <renderer class="oracle.portal.provider.v2.render.RenderManager"> <showPage class="oracle.portal.provider.v2.webservice.RPCWebServiceRenderer"> <contentType>text/html</contentType> <logging>false</logging> <className>webservices.WeatherRetrieverStub</className> <renderMethod>GetTemperature</renderMethod> <param class="oracle.portal.provider.v2.webservice.WebServiceRenderer$URLParam"> <name>p_zip</name> <default>94065</default> <prompt>Please enter a Zip Code</prompt> </param> <responseXSL>getTemperature.xsl</responseXSL> </showPage> </renderer> </portlet> </provider>
The following provider.xml illustrates the tags used for a DOC style Web Service portlet:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?providerDefinition version="3.1"?> <provider class="oracle.portal.provider.v2.DefaultProviderDefinition"> <portlet class="oracle.portal.provider.v2.DefaultPortletDefinition"> <id>1</id> <name>WeatherInformation</name> <title>Weather Web Service Portlet</title> <shortTitle>Weather Information</shortTitle> <description>Web Service demonstration portlet.</description> <timeout>100</timeout> <timeoutMessage>Weather Information portlet timed out</timeoutMessage> <acceptContentType>text/html</acceptContentType> <renderer class="oracle.portal.provider.v2.render.RenderManager"> <contentType>text/html</contentType> <charSet>UTF-8</charSet> <showPage class="oracle.portal.provider.v2.webservice.DocWebServiceRenderer"> <contentType>text/html</contentType> <logging>true</logging> <endpointURL>http://hosting001.vs.k2unisys.net/Weather/PDCWebService/WeatherServices.asmx </endpointURL> <soapAction>http://www.unisys.com/WebServices/GetWeather</soapAction> <literal class="oracle.portal.provider.v2.webservice.LiteralXML" handler="oracle.portal.provider.v2.webservice.LiteralXML$Handler"> <element name="GetWeather"> <attribute name="xmlns">http://www.unisys.com/WebServices/</attribute> <element name="ZipCode" bind="urlParams/p_zip" default="94065" prompt="Please enter a Zip Code"/> </element> </literal> <responseXSL>getWeather.xsl</responseXSL> </showPage> </renderer> </portlet> </provider>
Revision History:
March 28, 2002.