+ All Categories
Home > Documents > Web Services and Integration Framework Guide · ATG Web Services and Integration Framework Guide...

Web Services and Integration Framework Guide · ATG Web Services and Integration Framework Guide...

Date post: 14-Apr-2018
Category:
Upload: trantruc
View: 223 times
Download: 5 times
Share this document with a friend
216
Version 10.1.2 Web Services and Integration Framework Guide Oracle ATG One Main Street Cambridge, MA 02142 USA
Transcript
  • Version 10.1.2

    Web Services and Integration Framework Guide

    Oracle ATG

    One Main Street

    Cambridge, MA 02142

    USA

  • ATG Web Services and Integration Framework Guide

    Product version: 10.1.2

    Release date: 12-17-12

    Document identifier: WebServicesGuide1404301402

    Copyright 1997, 2012 Oracle and/or its affiliates. All rights reserved.

    Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.

    Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are

    trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or

    registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group.

    This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are

    protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy,

    reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any

    means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.

    The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please

    report them to us in writing.

    If this software or related documentation is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the

    following notice is applicable:

    U.S. GOVERNMENT END USERS:

    Oracle programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation,

    delivered to U.S. Government end users are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and

    agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the programs, including any

    operating system, integrated software, any programs installed on the hardware, and/or documentation, shall be subject to license terms and

    license restrictions applicable to the programs. No other rights are granted to the U.S. Government.

    This software or hardware is developed for general use in a variety of information management applications. It is not developed or intended

    for use in any inherently dangerous applications, including applications that may create a risk of personal injury. If you use this software or

    hardware in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures

    to ensure its safe use. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software or hardware in

    dangerous applications.

    This software or hardware and documentation may provide access to or information on content, products, and services from third parties.

    Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party

    content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to

    your access to or use of third-party content, products, or services.

    The software is based in part on the work of the Independent JPEG Group.

  • ATG Web Services and Integration Framework Guide iii

    Table of Contents

    I. Creating and Using Web Services in the ATG Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    1. ATG Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

    2. Creating Custom Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

    Overview of ATG Web Services Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

    JAX-RPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    Automatic Generation of Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    Session and Security Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    Web Service Creation Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    Using the Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    Naming Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    Anatomy of a Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    Service Endpoint Interface and Implementation Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    WSDL Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

    web.xml File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    JAX-RPC Deployment Descriptor and Mapping Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    Runtime Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    JSR 109 Compliant EAR File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    Web Service Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    Security Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    Creating and Editing Security Configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

    Deploying Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

    Managing Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

    Registering Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    3. Creating JMS Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

    Using the JMS Message Web Service Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

    Structure of a JMS Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    Patch Bay Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    4. Creating Repository Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

    Using the Repository Web Service Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

    Repository Web Service Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

    Modifying Repository Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

    RepositoryService Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25

    5. Repository to XML Data Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

    Mapping Files and XML Schemas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

    Mapping Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28

    Managing Mapping Files for Repository Item Descriptors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

    XML Schemas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

    Managing Schemas and Mapping Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

    PropertyElementNameSeparator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

    Item References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

    Repository Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

    Getting Repository Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

    Adding Repository Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

    Updating Repository Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

    Removing Repository Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

    6. Accessing ATG Web Services from Java Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

    About ATG Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

    Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    Sharing Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

  • iv ATG Web Services and Integration Framework Guide

    RepositoryItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    Before You Begin Using a Java Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

    Writing a CookieContainer Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45

    Calling ATG Web Services from a Java Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47

    Creating a Call Using a Client Stub (Static) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

    Creating a Call Using the Dynamic Invocation Interface (Dynamic) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

    Creating a Serializer and Deserializer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

    Creating a Mapping File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

    Generating an XML Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

    7. Accessing ATG Web Services from .NET Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

    About Web Services in the ATG Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

    Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55

    Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

    Session Sharing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

    Client Stubs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

    Web Services that Access RepositoryItems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

    Before You Begin Using a .NET Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

    Installing ATGWS.dll . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

    Calling ATG Web Services from a .NET Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

    Accessing an ATG Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

    Accessing a Custom ATG Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58

    Sample Web Service Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59

    Using the Atg.DotNet.WebService API to Serialize and Deserialize RepositoryItems . . . . . . . . . . . . . . . . . 60

    RepositoryItem Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62

    Property Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

    RepositoryItemRef Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63

    Complex Type Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

    NoSuchPropertyException Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

    RepositoryItemSerializer Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

    RepositoryItemSerializationException Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65

    II. Integration Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

    8. Using the Integration Repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

    Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69

    Integration Approaches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

    Remote Only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

    Remote then Local . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

    Local then Remote . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

    Local Only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71

    Setting Up an Integration Repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

    Defining an Integration Repository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

    Integration Repository APIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

    IntegrationRepository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

    IntegrationRepositoryItemDescriptor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

    IntegrationRepositoryItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

    ChangedPropertyBean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

    atg.repository.databinding.MappingRepositoryItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

    IntegrationRepositoryView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

    Command Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

    executeQuery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79

    getItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

    updateItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80

    addItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

    removeItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

  • ATG Web Services and Integration Framework Guide v

    Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

    Persistent Caching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82

    Cleaning up the Persistent Cache . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

    Configuration Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

    Configuring the Remote-Only Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84

    Configuring the Remote-then-Local Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

    Configuring the Local-then-Remote Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

    Integration Repository Definition File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

    integration-repository-template tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

    header tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

    item-descriptor tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87

    item-descriptor Child Tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

    integration-repository Document Type Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

    9. Remote Procedure Calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

    RPC API Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

    Command Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95

    CommandHandler Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

    CommandResult Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

    Implementing the RPC API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

    Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

    Executing Commands in Pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

    III. ATG Platform REST Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

    10. Using REST Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

    Starting the REST module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

    HTTP Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

    REST Web Services URLs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

    Client Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106

    HTTP Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107

    Handling POST Requests as Other Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

    Logging In . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

    Handling Session Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108

    Logging In as an External User . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109

    Logging In as an Internal User . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110

    Logging Out . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112

    Control Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112

    Control Parameter Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

    Functional Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

    Positional Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

    URL Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

    Message Body Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116

    Setting the Content-Type Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

    XML Parameter Markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

    JSON Parameter Markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118

    URL Query String Parameter Markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118

    Input Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118

    Primitive Values in Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

    Multiple Values in Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119

    Object Values in Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121

    Nested Multiple Value Objects in Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122

    Date Format in Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124

    Setting Properties to Null . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124

    HTTP Status Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125

    Returned Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126

  • vi ATG Web Services and Integration Framework Guide

    Choosing Output Markup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126

    JSON Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

    XML Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

    Identifying a Response . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

    Multiple Values in Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

    Return Depth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

    Date Format in Returned Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

    Errors and Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135

    Problems Performing Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

    Problems Processing a Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137

    11. Working with Component Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

    Getting Component Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139

    Setting Component Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

    12. Invoking Component Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143

    13. Invoking Form Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

    Submitting Form Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

    Returning Form Handler Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146

    Returning Form Handler Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

    Form Value Priority . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

    14. Invoking Java Server Pages (JSPs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149

    REST Web Services JSP Configuration Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150

    URL Templates for REST Web Services JSPs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151

    Configuring the REST ServiceProcessor Component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

    Example REST Web Services JSP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152

    15. Working with Repositories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

    Listing Repository Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155

    Retrieving a Repository Item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156

    Retrieving a Specific Property . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157

    Performing RQL Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158

    Adding a Repository Item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

    Transient Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161

    Setting Repository Item Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

    Deleting a Repository Item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163

    16. Property Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

    Default Filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

    Specifying the Filter Depth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167

    Filtering Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168

    Filtering for One Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169

    Property Aliasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

    Suppressing Property Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

    Suppressing Property Expansion for Java Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

    Suppressing Property Expansion for Specific Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

    Filtering Priority . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172

    17. Configuring the REST Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

    /atg/rest/Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

    defaultOutputCustomizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

    maxDepthAllowed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

    /atg/rest/processor/BeanProcessor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173

    returnFormHandlerExceptionsByDefault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

    returnFormHandlerPropertiesByDefault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

    /atg/rest/output/JSONOutputCustomizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

    enableFormatDateOutput for JSON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

    enablePerRequestFilters for JSON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

  • ATG Web Services and Integration Framework Guide vii

    enablePerRequestComponentFilters for JSON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

    enablePerRequestRepositoryFilters for JSON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

    enablePerRequestClassFilters for JSON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

    showRestPaths for JSON . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175

    /atg/rest/output/XMLOutputCustomizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176

    enableFormatDateOutput for XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176

    enablePerRequestFilters for XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176

    enablePerRequestComponentFilters for XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176

    enablePerRequestRepositoryFilters for XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176

    enablePerRequestClassFilters for XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

    showRestPaths for XML . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

    /atg/rest/processor/RepositoryProcessor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

    acceptJSONInput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

    appendMultiValuesByDefault . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178

    /atg/rest/processor/RestSecurityProcessor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178

    allowAccessForUnsecuredRepository . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178

    18. Security for REST Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179

    Security Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179

    Logging In and Session IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179

    Nucleus Component Granularity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179

    Quick Setup for Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

    Global Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180

    Component Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181

    Property and Method Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181

    Repository Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182

    Securing Groups of Components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182

    19. ATG Client Libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183

    Java Client Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183

    Creating Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183

    Creating a RestSession Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185

    Starting a REST Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186

    Logging in and Logging Out with the Java Client Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187

    Starting a Session Without Logging In . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

    Accessing Data from the Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

    Creating a Raw REST Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190

    Handling Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191

    Accessing Components with the Java Client Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192

    Calling Methods with the Java Client Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193

    Accessing Repository Items with the Java Client Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194

    Using the Java Client in Android Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197

    ActionScript Client Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197

    atg.rest.client.RestComponentHelper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198

    atg.rest.client.RestRepositoryHelper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199

    Calling Methods with ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199

    Formatting Input with ActionScript . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201

    Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203

  • viii ATG Web Services and Integration Framework Guide

  • Part I. Creating and Using Web

    Services in the ATG PlatformA common requirement for enterprise applications is the ability to share data and business logic with other applications. For

    example, suppose you have an employee portal built with the Oracle ATG Web Commerce platform, and also a payroll system

    based on some other software package. When a new employee starts, or an existing employee changes his or her marital

    status, you need to create or modify the employees profile in both systems. Ideally, youd like the employee to be able to

    make the changes in one application and have those changes automatically propagate to the other application.

    One way to address this issue is through Web Services, a widely supported standard for packaging remote procedure calls

    in an XML-based structure. In the example above, you could create a Web Service that automatically updates an employees

    profile in the employee portal when the information in the payroll system is modified.

    The Dynamo Application Framework includes tools that allow you to create custom Web Services that call methods on

    Nucleus components. These custom Web Services can expose methods on existing Oracle ATG Web Commerce Nucleus

    components, or on Nucleus components you write yourself. You can call these Web Services from an external application

    client, such as the payroll system mentioned above.

    The Oracle ATG Web Commerce platform packages Web Services as: J2EE applications, in accordance with the JAX-RPC (JSR

    101) and Implementing Enterprise Web Services (JSR 109) specifications. Note that this manual assumes that youre familiar

    with these specifications, and with Web Services in general. For more information about these specifications, see the Java

    Community Process web site at:

    http://www.jcp.org

    The chapters in this section discuss how to create Web Services in the Oracle ATG Web Commerce platform, and how to write

    Java and .NET clients that call these services:

    Creating Custom Web Services (page 5)

    Creating JMS Web Services (page 19)

    Creating Repository Web Services (page 23)

    Repository to XML Data Binding (page 27)

    Accessing ATG Web Services from Java Clients (page 43)

    Accessing ATG Web Services from .NET Clients (page 55)

  • 1 ATG Web Services 3

    1 ATG Web Services

    In addition to any Web Services you create, the Oracle ATG Web Commerce platform includes a number of

    prepackaged Web Services that you can call from Java and .NET clients. These services are packaged in three

    separate application modules. You can include any of these services in an assembled EAR file by including the

    module that contains the desired services. For example, to include the prepackaged Commerce Web Services,

    specify the DCS.WebServices module when you assemble your application.

    The following table summarizes these Web Services:

    Application Module Web Application Web Services

    DAS.WebServices

    For more information

    about these Web

    Services, see the ATG

    Repository Guide.

    Generic Repository

    Services

    - getRepositoryItem

    - performRQLQuery

    - performRQLCountQuery

    User Session - loginUser

    - logoutUser

    - getProfileId

    - setLocale

    - setContactInfo

    - setPassword

    - getProfile

    - createUser

    - updateUser

    - getPasswordHashKey

    - getPasswordHashAlgorithm

    - canClientEncryptPasswords

    - executeRepositoryTargeter

    DPS.WebServices

    For more information

    about these Web

    Services, see the

    ATG Personalization

    Programming Guide

    Messaging - sendPageVisit

    - sendClickThrough

  • 4 1 ATG Web Services

    Application Module Web Application Web Services

    Order - createOrderFromXML

    - submitOrderWithReprice

    - cancelOrder

    - getOrderStatus

    - getOrderAsXML

    - getOrdersAsXML

    - getOrderStatus

    - getCurrentOrderId

    - addItemToOrder

    - addItemToShippingGroup

    - createOrder

    - createOrderForUser

    - removeItemFromOrder

    - setItemQuantity

    - addCreditCardToOrder

    - addShippingAddressOrder

    - removePaymentGroupFromOrder

    - removeCreditCardFromOrder

    - removeShippingGroupFromOrder

    - moveItemBetweenShippingGroups

    - removeItemQuantityFromShippingGroup

    - setOrderAmountToPaymenGroup

    - getDefaultPaymentGroupId

    - getDefaultShippingGroupId

    Pricing - calculateOrderPrice

    - calculateOrderPriceSummary

    - calculateItemPriceSummary

    Promotions - grantPromotion

    - revokePromotion

    - claimCoupon

    - getPromotionsAsXML

    Inventory - getInventory

    - getInventoryStatus

    - setStockLevel

    - setStockLevels

    Catalog - getProductXMLById

    - getProductXMLByDescription

    - getProductXMLByRQL

    - getProductSkusXML

    - catalogItemViewed

    DCS.WebServices

    For more information

    about these Web

    Services, see ATG

    Commerce Programming

    Guide.

    Profile - setDefaultShippingAddress

    - setDefaultBillingAddress

    - setDefaultCreditCard

    - getDefaultShippingAddress

    - getDefaultBillingAddress

    - getDefaultCreditCard

  • 2 Creating Custom Web Services 5

    2 Creating Custom Web Services

    The Oracle ATG Web Commerce platform provides infrastructure and tools that enable you to expose a wide

    range of Oracle ATG Web Commerce functionality as Web Services. There are three kinds of Web Services you

    can create that expose Oracle ATG Web Commerce functionality:

    Web Services that invoke methods on Nucleus components.

    Web Services that send JMS messages through Patch Bay.

    Web Services that perform operations on repository items.

    This chapter describes the infrastructure for creating these services. It focuses on Web Services that invoke

    Nucleus methods, but most of what is described here applies to all three types of services. For information

    specific to Web Services that send JMS messages, see the Creating JMS Web Services (page 19) chapter.

    For information specific to Web Services that perform repository operations, see the Creating Repository Web

    Services (page 23) chapter.

    This chapter includes the following sections:

    Overview of ATG Web Services Support (page 5)

    Web Service Creation Wizard (page 7)

    Anatomy of a Web Service (page 9)

    Web Service Security (page 13)

    Deploying Web Services (page 15)

    Managing Web Services (page 16)

    Overview of ATG Web Services Support

    This section describes key aspects of Oracle ATG Web Commerce Web Services support:

    JAX-RPC

    Automatic generation of Web Services

    Session and security support

    Limitations

  • 6 2 Creating Custom Web Services

    JAX-RPC

    The Web Services support in the Oracle ATG Web Commerce platform is based on JAX-RPC (Java API for XML-

    based RPC). The JAX-RPC specification defines a standard way for incoming XML-based SOAP messages

    to be converted to Java-based RPC calls. The Oracle ATG Web Commerce platform uses Oracles reference

    implementation of JAX-RPC. Parts of this reference implementation are used to generate Web Services, and

    other parts of it handle the processing of SOAP messages when a Web Service is called.

    Automatic Generation of Web Services

    Creating a Web Service by hand can be a laborious process, due to the large number of Java and XML files you

    must create and package. The Oracle ATG Web Commerce platform automates this process through the Web

    Service Creation Wizard in the Dynamo Administration UI. You select the type of service you want to generate,

    and the wizard takes you through a series of screens where you specify the necessary information. You then

    click a button, and the wizard automatically generates the necessary classes, WSDL documents, and deployment

    descriptors, and packages them in EAR and WAR files.

    Session and Security Support

    When you create a Web Service, you specify whether it should be executed within the context of an HTTP

    session. Associating Web Services with a session enables an application to maintain state across Web Service

    calls and to use login information for security purposes.

    To enable multiple Web Services to execute within the same session, a client application must pass a session

    cookie between calls. Some Web Services frameworks, such as Microsofts .NET, provide support for passing

    session cookies. Java clients typically require applications to manage session cookies themselves.

    For more information about using sessions with Java clients, see the Accessing ATG Web Services from Java

    Clients (page 43) chapter. For more information about using sessions with .NET clients, see the Accessing ATG

    Web Services from .NET Clients (page 55) chapter.

    Limitations

    You can create Web Services from most Nucleus methods, both from components Oracle ATG Web Commerce

    provides and components that you write. There are, however, some methods that cannot be exposed as valid

    Web Services. The Web Service Creation Wizard will not create Web Services from these methods. In particular, it

    enforces the following restrictions by preventing you from selecting these methods:

    You cannot create a Web Service from any method that has a parameter or return type that is an abstract data

    type (such as a Map, Collection, Interface, abstract class, or an object with abstract data type properties).

    You cannot create a Web Service from any method that has a parameter or return type that is a wrapper class

    for a primitive data type. The prohibited classes are Byte, Boolean, Character, Integer, Short, Long,

    Float, and Double. Note, however, that methods that use actual primitives are valid. If there is a method that

    you want to expose that has one of these wrapper classes as a parameter or return type, you can either rewrite

    the method to use a primitive instead (if the methods class is your own custom code), or else subclass the

    methods class (if it is a class provided by Oracle ATG Web Commerce) and overload the method with a version

    that uses primitives.

    In addition, you cannot create a Web Service from a method that has the same name and signature as any of

    the methods of atg.webservice.ManagedComponentProperties or java.lang.Object. Attempting to

  • 2 Creating Custom Web Services 7

    do so results in a naming conflict, because the service implementation class of each Web Service subclasses

    atg.webservice.ManagedComponentProperties, which subclasses java.lang.Object. Note that the

    wizard does not prevent you from selecting these methods, but when you try to generate a Web Service, an

    exception is thrown and the service generation fails.

    Web Service Creation Wizard

    The process of creating Web Services is automated by the Web Service Creation Wizard in the Dynamo

    Administration UI. This wizard guides you through the steps of selecting a Nucleus component and method,

    specifying input parameters and other settings; it then automatically creates the Web Service by performing the

    following steps:

    Create the service endpoint interface that specifies the method to be exposed.

    Create the service endpoint class that implements the service endpoint interface and is responsible for

    handing incoming SOAP requests.

    Create the WSDL document that describes the resources required by the service endpoint class, as well as its

    inputs and outputs.

    Create the web.xml file for the Web application that the service is a part of.

    Create the JAX-RPC deployment descriptor (webservices.xml) and mapping file.

    Build the runtime classes.

    Package these elements in a JSR 109 compliant EAR file.

    These steps are described in more detail in the Anatomy of a Web Service (page 9) section.

    The wizard uses the component /atg/webservice/WebServiceGenerator to perform the actual work of

    generating the service. This component, which is of class atg.webservice.WebServiceGeneratorImpl,

    performs all of the operations listed above, either through its own methods or through other components it

    refers to.

    Using the Wizard

    The top-level page of the Dynamo Administration UI includes a Web Service Administration link. This link takes

    you to the Web Service Administration page, which has three links for working with Web Services:

    Web Service Registry Takes you to a page for viewing and managing currently loaded Web Services. The

    Web Services registry is discussed in the section Managing Web Services (page 16).

    Web Service Security Manager Enables you to create and edit Web Service security configurations.

    These security configurations can be used to define which users can access specific Web Services. When you

    create a Web Service, you have the option of associating a security configuration with the service. Security

    configurations are discussed in the section Web Service Security (page 13).

    Web Service Creation Wizard Takes you to a page with links for creating each of the three kinds of Web

    Services (Component Method Web Service, JMS Message Web Service, Repository Web Service).

  • 8 2 Creating Custom Web Services

    To create a Web Service that invokes a method on a Nucleus component, starting from the Web Service

    Administration page:

    1. Click the Web Service Creation Wizard link. This takes you to a page titled Select Type, where you can select

    the type of Web Service to create.

    2. Click the Component Method Web Service link. This takes you to the Select Nucleus Component page.

    3. On the Select Nucleus Component page, specify the pathname of the Nucleus component you want to create

    the Web Service from. You can either enter the pathname directly in the field at the top of the page and then

    click the Next button, or you can use the component browser below it to navigate to the component and

    select it.

    4. On the Select A Method page, select the method you want to expose as a Web Service.

    5. If the method requires any input parameters, the Set Parameter Names page provides you with fields for

    specifying the names of these parameters. The names you specify are used for the parameters of the Web

    Service call, and can be anything you like.

    When the Web Service is called, the service passes the values of these parameters to the parameters of the

    exposed Nucleus method. There is thus a one-to-one correspondence between the parameters of the Web

    Service call and the parameters of the underlying Nucleus methods.

    6. The next two pages are titled EAR Name & Servlet Settings and Enterprise and Web Application Settings.

    When the wizard creates a Web Service, it packages it in a WAR file, which is in turn packaged in an EAR file.

    It is possible to have any number of services in a single Web application (WAR file), and any number of Web

    applications in a single Enterprise application (EAR file). This flexibility gives you a good deal of control over

    how you deploy your Web Services. For each new Web Service, the wizard can do any of the following:

    Create a new EAR file for the service, and put it in a WAR file within the EAR file.

    Use an existing EAR file, and put the service in a new WAR file within it.

    Put the service in an existing WAR file within an existing EAR file.

    To add a Web Service to an existing EAR file, you specify that file as the EAR file name on the EAR Name &

    Servlet Settings page. The Web Application Settings page then gives you the choice of creating a new Web

    application for the service, or adding the service to an existing Web application.

    The wizard also gives you the option of specifying the host name and port number for a Web Service, or of

    leaving these fields blank. If you leave the fields blank, the values are dynamically assigned at runtime from

    the URL used for the WSDL file request.

    7. The Session & Security Options page allows you to specify whether the Web Service should be executed

    within the context of an HTTP session. The wizard gives you these options:

    Neither provide a session nor security constraints.

    Provide a session, but no security constraints.

    Provide both a session and security constraints.

    If you want to call the Web Service from a client that uses sessions or session sharing, you must choose

    one of the last two options. If you choose the last option, the wizard then prompts you to select a security

    configuration. See Web Service Security (page 13) for information about security configurations for Web

    Services.

    8. On the Create EAR File page, click the Create EAR File button to create the Web Service.

  • 2 Creating Custom Web Services 9

    If there is already an EAR file with the specified name, the wizard first appends .old to the name of the

    existing file so that new file does not overwrite it.

    Once you have created an EAR file, you must deploy it in order to run the Web Services in it. See the Deploying

    Web Services (page 15) section for more information.

    Naming Restrictions

    Most of the class names and filenames for Web Services are generated automatically by the wizard. As a result,

    certain circumstances can result in naming conflicts. For example, if you create a Web Service from a Nucleus

    method, you cannot then create a second Web Service from another method with the same name (such as

    an overloaded method) and put it in the same WAR file, even if the two methods have different signatures or

    capitalization. If you attempt to do this, the second Web Service will simply overwrite the first.

    To prevent the second service from overwriting the first, put the second service in a different WAR file. In

    addition, be sure to give the second WAR file a different context root from the first WAR file. (The default value

    for the context root in the wizard is based on the method name, so youll need to change the value when you

    run the wizard.) It will then be possible to differentiate calls to the two services based on their context roots.

    Anatomy of a Web Service

    As mentioned above, the Web Service Creation Wizard automatically performs a number of tasks, greatly

    simplifying the creation of Web Services from Nucleus components. The wizard enables you to simply create

    Web Services and begin using them, without needing to understand all of their underpinnings. However, in

    some cases you may need to troubleshoot or make changes to your Web Services, so it is helpful to have some

    familiarity with their form and packaging. This section discusses the various pieces that make up a Web Service,

    including:

    service endpoint interface and implementation class

    WSDL document

    web.xml file

    JAX-RPC deployment descriptor (webservices.xml) and mapping file

    runtime classes

    JSR 109 compliant EAR file

    Note that the business logic of the Web Service is actually contained in the method of the Nucleus component

    that is being exposed. The Web Service handles only the RPC infrastructure, and passes the actual processing to

    the Nucleus component.

    Service Endpoint Interface and Implementation Class

    The service endpoint interface (SEI) is a Java interface class that defines the methods to be exposed as a

    Web Service. This interface must extend the java.rmi.Remote interface and each method must throw

    java.rmi.RemoteException. The SEI for any Web Service generated by the Oracle ATG Web Commerce

    platform has a single method, corresponding to the Nucleus method being exposed.

  • 10 2 Creating Custom Web Services

    The service implementation class (also referred to as the service bean) implements the service

    endpoint interface and handles the actual servicing of incoming SOAP requests. In addition,

    service implementation classes generated by the Oracle ATG Web Commerce platform

    implement the interface javax.xml.rpc.server.ServiceLifecyle, and extend the

    atg.webservice.ManagedComponentProperties class, which registers services with the Oracle ATG

    Web Commerce platform Web Service Registry. The Web Service Registry is discussed in the Managing Web

    Services (page 16) section.

    The service endpoint interface and implementation class are generated by the /atg/webservice/

    WebServiceGenerator component. The names for these classes are based on the name of the Nucleus

    method being exposed. For instance, if the Nucleus method is getOrderStatus, the service endpoint interface

    is named GetOrderStatusSEI, and the implementation class is named GetOrderStatusSEIImpl.

    WSDL Document

    Web Services Description Language (WSDL) is an XML language for describing Web Services in a platform-

    independent way. A WSDL document describes a Web Services methods by specifying the locations of the

    resources they use and defining the methods inputs and outputs. (A WSDL document for a Web Service

    generated by the Oracle ATG Web Commerce platform always describes one method, because each Web Service

    can expose only one Nucleus method.)

    There must be a separate WSDL document for each Web Service. The WSDL document is generated by the /

    atg/webservice/WSDLGenerator component, which is of class atg.webservice.WSDLGeneratorImpl.

    This document is used for two key purposes:

    It is used by the JAX-RPC API to generate runtime classes.

    At runtime, it is used by Web Service clients to look up the semantics of the SOAP messages to send to invoke

    the service.

    When the Web Services input and output values are primitive types, they are defined in the primary WSDL

    document. For example:

    Each non-primitive input or output requires its own WSDL document that is imported by the primary WSDL

    document. Import statements similar to the following are included in the primary WSDL document when the

    Web Service is created using the Dynamo Administration UI:

    The location specified is relative to the primary WSDL document. Some Web Service clients are able to

    interpret relative locations, but others require fully qualified URLs. To work with these clients, when the

    Oracle ATG Web Commerce platform receives a request for a WSDL document, it uses the servlet class

    atg.webservice.WSDLFinderServlet and the filter class atg.webservice.WSDLImportFilter to

    translate the location value into a fully qualified URL:

    1. At runtime, JAXRPCServlet updates the SOAP address in the WSDL document to include the domain host

    name and port number.

  • 2 Creating Custom Web Services 11

    2. When WSDLFinderServlet detects a WSDL request, WSDLImportFilter appends the domain name

    and port number (from the SOAP address provided by JAXRPCServlet) and the context path (by calling

    request.getContextPath() on the Dynamo request) to the location value in the import statement. The

    resulting import statement looks similar to this:

    The WSDLFinderServlet and WSDLImportFilter classes are declared in the web.xml file for the Web

    application that the Web Service is a part of, as discussed in the next section. For more information about

    request handling, see the ATG Platform Programming Guide.

    web.xml File

    The web.xml file is the standard deployment descriptor for the Web application that the Web Service is a part of.

    It declares the filters and servlets used by the service.

    On the Oracle ATG Web Commerce platform, the servlet that listens for the SOAP request is

    com.sun.xml.rpc.server.http.JAXRPCServlet. This servlet is part of the JAX-RPC reference

    implementation, and is responsible for receiving the incoming SOAP request and determining how to dispatch

    the call. For example, if you create a Web Service called getOrderStatus, the entry for it in the web.xml file

    looks something like this:

    getOrderStatus getOrderStatus com.sun.xml.rpc.server.http.JAXRPCServlet configuration.file WEB-INF/wsconfig/getOrderStatus_Config.properties

    ...

    getOrderStatus /getOrderStatus/*

    When a call to the getOrderStatus Web Service is sent to the Oracle ATG Web Commerce platform,

    the JAXRPCServlet receives the request and dispatches it based on the information in the file that the

    configuration.file parameter points to. This configuration file is included in the WAR file, and looks similar

    to this:

    port0.wsdl.serviceName=GetOrderStatusSEIServiceport0.tie=webservices.GetOrderStatusSEI_Tiewsdl.transform=trueport0.name=getOrderStatusportcount=1wsdl.location=WEB-INF/getOrderStatus.wsdlport0.servant=webservices.GetOrderStatusSEIImplport0.wsdl.targetNamespace=http\://www.atg.com/webservicesport0.wsdl.portName=GetOrderStatusSEIPort

  • 12 2 Creating Custom Web Services

    Note that the port0.servant property is set to the name of the service implementation class. This property

    designates the class that JAXRPCServlet dispatches the SOAP request to.

    Handling Imported WSDL Documents

    As discussed in the WSDL Document section, there are two resources that assist in handling WSDL requests.

    These resources are declared in the web.xml file:

    WSDLImportFilter, which is a filter of class atg.webservice.WSDLImportFilter, is mapped to a parent

    directory that has subdirectories holding WSDL documents.

    WSDLFinder, which is a servlet of class atg.webservice.WSDLFinderServlet, should be defined and

    mapped to each path that will lead to a WSDL document.

    For example:

    WSDLImportFilter atg.webservice.WSDLImportFilter

    ...

    WSDLImportFilter /getOrderStatus/*

    ...

    WSDLFinder WSDLFinder Used to lookup imported wsdl files. atg.webservice.WSDLFinderServlet

    ...

    WSDLFinder atg.commerce.order.status.wsdl

    WSDLFinder atg.security.wsdl

    WSDLFinder atg.commerce.wsdl

    Web Service Registrar

    To register Web Services with the Web Services Registry, the web.xml file declares the WebServiceRegistrar

    servlet, and sets it to load on startup:

    WebServiceRegistrar WebServiceRegistrar ATG WebServiceRegistrar for registering servlet web-services. atg.webservice.WebServiceRegistrar

  • 2 Creating Custom Web Services 13

    1

    For more information about the Web Services Registry, see Managing Web Services (page 16).

    Other Elements of web.xml

    The web.xml file may declare certain additional elements:

    the servlet atg.nucleus.servlet.NucleusServlet, which runs Nucleus as a servlet within a Web

    application

    the filter atg.filter.dspjsp.PageFilter, which invokes the DAF request-handling pipeline

    the context parameter atg.session.parentContextName; its value is set to /dyn, which enables the Web

    Services to share information with the atg_bootstrap.war application

    JAX-RPC Deployment Descriptor and Mapping Files

    The JAX-RPC deployment descriptor, webservices.xml, provides metadata (such as names and descriptions of

    the SEIs, service beans, and WSDL documents) about all of the Web Services in a given Web application.

    The mapping file defines the association between a WSDL file and an SEI and implementation class, by mapping

    namespaces to Java packages. This mapping is used when serializing and deserializing XML files. There is a

    separate JAX-RPC mapping file for each Web Service, and the name of each file reflects the method the service

    is based on. For example, if the method is getOrderStatus, the mapping file for the Web Services is named

    getOrderStatusMapping.xml.

    Runtime Classes

    The runtime classes are generated using the Oracle JAX-RPC reference implementation. These classes include:

    the tie class that JAXRPCServlet invokes the method on, and which in turn invokes the method on the

    service implementation class

    classes for handling serializing and deserializing SOAP requests and responses

    JSR 109 Compliant EAR File

    The JSR 109 Java specification includes information about how a Web Service should be packaged within an EAR

    file. The wizard combines all the generated files (class files, web.xml, WSDL document, webservices.xml, and

    JAX-RPC mapping file) into a WAR file, which is then added to a JSR 109 compliant EAR file.

    Web Service Security

    When you create a Web Service, you have the option of applying security constraints so that only approved

    clients (those with administrator privileges, for example) can execute it. You specify the security constraints

    using a security configuration, which is a repository item that stores information that controls access to

  • 14 2 Creating Custom Web Services

    the Web Service. You can create any number of different security configurations using the Web Services

    Administration UI, and you can apply a security configuration to any number of Web Services.

    A security configuration has a corresponding security policy component, plus an optional ACL. A security

    configuration is identified by its functional name, which is a property of the repository item that maps the

    security configuration to a security component and ACL.

    This section describes the main components involved in securing Web Service methods, as well as how to create

    security configurations through the Web Services Administration UI. For a broader discussion of the Oracle ATG

    Web Commerce security API, see the Managing Access Control chapter in the ATG Platform Programming Guide.

    Security Components

    There are two primary components involved in securing a Web Service method:

    /atg/webservice/security/NucleusSecurityManager (an instance of

    atg.webservice.NucleusSecurityManager) uses the security configuration associated with the Web

    Service to apply the corresponding security policy and ACL, to determine whether to grant or deny access.

    /atg/webservice/security/NucleusSecurityRepository (an instance of

    atg.adapter.gsa.GSARepository) stores the Web Service security configurations used by the

    NucleusSecurityManager.

    NucleusSecurityManager

    At startup time, the NucleusSecurityManager retrieves the repository items from the

    NucleusSecurityRepository (described below) and creates an internal mapping between each functional

    name and the SecurityPolicy component and ACL associated with it.

    When a client calls a Web Service, the service invokes the hasAccess() method on the /atg/webservice/

    security/NucleusSecurityManager component, passing it the functional name of the services security

    configuration, the name of the Nucleus component and method exposed by the service, and a Map containing

    the methods parameters. The NucleusSecurityManager uses the functional name to find the associated

    SecurityPolicy component and ACL, applies them to the call, and returns the result (true or false) to the

    client. If true is returned, the Nucleus method exposed by the Web Service is invoked; if false is returned,

    access to the method is denied, and an exception of class atg.security.SecurityException is thrown.

    If the NucleusSecurityManager is unable to apply the security configuration to a Web Service call (for

    example, if the SecurityPolicy is not valid), it determines whether to grant access based on the value of its

    defaultGrantAccess property. The default value of this property is false (deny access).

    Setting defaultGrantAccess to true facilitates the development process, because it allows any Web Service

    that does not have an associated security configuration to be called by any client.

    For deployment purposes, though, this behavior is undesirable, because of the security risks involved. Therefore,

    when you enable liveconfig settings for the Oracle ATG Web Commerce platform, the defaultGrantAccess

    property is set to false. Note, however, that this means that each of your Web Services must have an associated

    security configuration, because any call to a service without a security configuration will fail.

    For information about enabling liveconfig settings, see the ATG Installation and Configuration Guide.

    NucleusSecurityRepository

    Web Service security configurations are stored in the NucleusSecurityRepository. This repository includes

    a single item descriptor called nucleusSecurity, which has properties called functionalName, policy, and

    ACL. The NucleusSecurityManager parses the items in this repository at startup time.

  • 2 Creating Custom Web Services 15

    The Web Services Administration interface provides an easy way to add new security configurations to this

    repository. See the next section for details.

    Creating and Editing Security Configurations

    The Web Services Administration page in the Dynamo Administration UI includes a Web Service Security

    Manager link that takes you to a page that where you can view and edit the security configurations stored in

    the NucleusSecurityRepository, or create new security configurations.

    Follow these steps to create a new security configuration:

    1. Click the Create New link.

    2. On the Create Security Configuration page, enter a name for the security configuration in the Functional

    Name field, and click Create New button.

    3. On the Edit Web Service Security Configuration page, click the Add buttons to add users, roles, and

    organizations to the security configuration. You can change the security policy (from the /atg/dynamo/

    security/SecurityPolicy default) if necessary.

    The new security configuration appears on the main Web Service Security Configurations page. If you need to

    make changes to it, click the Edit link to open the Edit Web Service Security Configuration page. Note that you

    cannot change the functional name.

    Deploying Web Services

    When you create a Web Service, the wizard places the EAR file in the /home directory. The Web

    Service is not ready to run, however, because it does not include the necessary Nucleus classes.

    In order to run the Web Service, these additional steps are necessary:

    1. Use the runAssembler command to assemble a Nucleus-based application, using the

    -add-ear-file flag to incorporate the contents of the Web Services EAR file.

    2. Deploy the assembled EAR file on your application server, and start up the application.

    For example, if your Web Services EAR file is called WS.ear, you might use a command like this to assemble a

    Nucleus


Recommended