Monday, 5 December 2011

Steps to create ATG Repository Web services:


Reference guide to create ATG Repository Web services:    
In addition to any Web Services you create, the ATG platform includes a number of prepackaged WebServices that you can call from Java and .NET clients. These services are packaged in three separateapplication modules. You can include any of these services in an assembled EAR file by including themodule that contains the desired services.
 For example, to include the prepackaged Commerce WebServices, specify the DCS.WebServices module when you assemble your application.
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
DPS.WebServices
For more information
about these Web
Services, see the ATG
Personalization
Programming Guide
User Session
Messaging
- loginUser
- logoutUser
- getProfileId
- setLocale
- setContactInfo
- setPassword
- getProfile
- createUser
- updateUser
- getPasswordHashKey
- getPasswordHashAlgorithm
- canClientEncryptPasswords
- executeRepositoryTargeter
- sendPageVisit
- sendClickThrough
DCS.WebServices
For more information
about these Web
Services, see ATG
Commerce
Programming Guide.
Order
Pricing
Promotions
Inventory
Catalog
Profile


- createOrderFromXML
- submitOrderWithReprice
- cancelOrder
- getOrderStatus
- getOrderAsXML
- getOrdersAsXML
- getOrderStatus
- getCurrentOrderId
- addItemToOrder
- addItemToShippingGroup
- createOrder
- createOrderForUser
- removeItemFromOrder
- setItemQuantity
- addCreditCardToOrder
- addShippingAddressOrder
- removePaymentGroupFromOrder
- removeCreditCardFromOrder
- removeShippingGroupFromOrder
- moveItemBetweenShippingGroups
- removeItemQuantityFromShippingGroup
- setOrderAmountToPaymenGroup
- getDefaultPaymentGroupId
- getDefaultShippingGroupId
- calculateOrderPrice
- calculateOrderPriceSummary
- calculateItemPriceSummary
- grantPromotion
- revokePromotion
- claimCoupon
- getPromotionsAsXML
- getInventory
- getInventoryStatus
- setStockLevel
- setStockLevels
- getProductXMLById
- getProductXMLByDescription
- getProductXMLByRQL
- getProductSkusXML
- catalogItemViewed
- setDefaultShippingAddress
- setDefaultBillingAddress
- setDefaultCreditCard
- getDefaultShippingAddress
- getDefaultBillingAddress
- getDefaultCreditCard

Step-1:
Include the DAS.WebServices module in your application to enable ATG rest web services to create ATG Repository web services.
Step-2:
Flow the screenshot step by step to create Repository Web service    
In DYN Admin use Web Service Administration to get Web Service Creation Wizard





Step-3:
use Repository Web Service to create Repository Web service      

Step-4:
Select  the repository componend to create repository  webservices

Step-5 :
Select  the Item  discriptor  to create repository  webservices

Step-6 :
Select  the method  to get  Item  using repository  webservices



Step-7 :
Provide values to create repository  webservices EAR file.

Step-8 :
Provide values to create  webservices web Application module. 

Step-9 :
Provide values for session and security  to create repository webservices. 

Step-10 :
Click on create EAR File to create repository webservices. 

Step-11 :
If  EAR File created scucessfully it will give below  success message.

Step-12 :
Once you have created an EAR file, you must deploy it.

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.
Step-13 :
 Deploy the assembled EAR file on your application server, and start up the application.
Step-14:
to Browse enabled web service use DynAdmin like below ,it will give list of enabled web services. 


Tuesday, 22 November 2011

Procedure to bring your custom repository in to ATG10.0.2 merchandising-flex view for Browse/Find modes, to query /update/search your custom repository asset items.


Procedure to bring your custom repository in to ATG10.0.2 merchandising-flex view for Browse/Find modes, to query /update/search on your custom repository asset items.
For these we have to create few components in your module for production (live) and publishing (CA) to bring custom repository in merchandising flex mode to support content administration (version)
Like Below:



Components for production (live): steps need for production (step:1-to-step:3)

step-1: create repository definition xml file as per your requirements
Example : /config/../xxRepository.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE gsa-template
        PUBLIC "-//Art Technology Group, Inc.//DTD General SQL Adapter//EN"
        "http://www.atg.com/dtds/gsa/gsa_1.0.dtd">
<gsa-template>

<header>
<name>xx Repository</name>
</header>
 
  <!--///////////////////////////////////////-->
  <!-- xx Repository      -->
  <!--///////////////////////////////////////-->

<item-descriptor name="xxSection" display-name="xxxcontent" display-property="type">
 <table name="xx_content"  type="primary" id-column-name="section_id">
  
  <property name="xxsectionId" column-name="xxsection_id" data-type="String"
         display-name-resource="xx Section ID"   />
   <property name="type" column-name="type" data-type="String"
             display-name-resource="Type of the Section" />
          
 </table>
     </item-descriptor>
 </gsa-template>

Note: repository definitions should be simple. If it contains multi-relationship it may through error/unable to bring those relationships .be concentrate on repository design. Initially start with simple repository design.

Step-2:
create repository component by using above repository definition file
Example code:/config/../xxRepository.properties
$class=atg.adapter.gsa.GSARepository
$scope=global
definitionFiles=/../xxRepository.xml
repositoryName=xxRepository
XMLToolsFactory=/atg/dynamo/service/xml/XMLToolsFactory
transactionManager=/atg/dynamo/transaction/TransactionManager
idGenerator=/atg/dynamo/service/IdGenerator
dataSource=/atg/dynamo/service/jdbc/SwitchingDataSource

Step-3: create  ”Initial.properties” in your  project  local  config folder in this path ”/config/atg/Initial.properties”
Example Code : Initial.properties
initialServices+=/../xxRepository

Components for publishing (CA):   steps need for content administration (step-4 - to-   step-13)

Step-4: create repository component (“xxRepository_production”) by using above custom repository definition file (Step-1)
Example code: in your version module ..\Versioned\config\..\ xxRepository_production.properties
$class=atg.adapter.gsa.GSARepository
$scope=global
definitionFiles=/../xxRepository.xml
foreignRepositorySuffix=_production
XMLToolsFactory=/atg/dynamo/service/xml/XMLToolsFactory
transactionManager=/atg/dynamo/transaction/TransactionManager
idGenerator=/atg/dynamo/service/IdGenerator
dataSource=/atg/dynamo/service/jdbc/SwitchingDataSource
lockManager=/atg/dynamo/service/ClientLockManager_production

Step-5: create repository component (“xxRepository ”)by using above custom repository definition file (Step-1)
Example code: ..\Versioned\config\..\ xxRepository.properties
$class=atg.adapter.version.VersionRepository
versionManager=/atg/epub/version/VersionManagerService
versionItemsByDefault=true
$scope=global
definitionFiles=/../xxRepository.xml
repositoryName=xxRepository
XMLToolsFactory=/atg/dynamo/service/xml/XMLToolsFactory
transactionManager=/atg/dynamo/transaction/TransactionManager
idGenerator=/atg/dynamo/service/IdGenerator
dataSource=/atg/dynamo/service/jdbc/JTDataSource
Step-6:  create AssetResolver component in exact path ” ..\Versioned\config\atg\dynamo\service\ AssetResolver.properties” : in your version module
Example code: AssetResolver.properties
additionalAssetSources+=\
             /../xxRepository

Step-7:  create VersionManagerService component in exact path ” ..\Versioned\config\atg\epub\version\ VersionManagerService.properties” : in your version module
Example code VersionManagerService.properties
versionedRepositories+=\
    xxRepository=/../xxRepository

Step-8:  create deploymentTopology.xml  in exact path ” ..\ Versioned\config\atg\epub\ deploymentTopology.xml ” : in your version module
Example code: for  deploymentTopology.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE publishing-deployment-topology SYSTEM
"http://www.atg.com/dtds/publishing_deployment/publishing_deployment_1.0.dtd">
<publishing-deployment-topology>
<target>
 <target-name>Production</target-name>

    <agent>
    <agent-name>PubAgent</agent-name>
    <principal-asset>NONE</principal-asset>
    <include-asset-destination>/atg/epub/file/ConfigFileSystem
    </include-asset-destination>
    <include-asset-destination>/atg/epub/file/WebAppRefFileSystem
    </include-asset-destination>
    <transport>
    <transport-type>RMI</transport-type>
    <rmi-uri>rmi://127.0.0.1:8860/atg/epub/AgentTransport</rmi-uri>
    </transport>
    </agent>

    <agent>
    <agent-name>WebAgent1</agent-name>
    <principal-asset>NONE</principal-asset>
    <include-asset-destination>/atg/epub/file/WWWFileSystem
    </include-asset-destination>
    <transport>
      <transport-type>RMI</transport-type>
      <rmi-uri>rmi://127.0.0.1:8860/atg/epub/AgentTransport</rmi-uri>
    </transport>
    </agent>

<repository-mapping>
  <source-repository>/..xxRepository</source-repository>
  <destination-repository>/../xxRepository_production</destination-repository>
</repository-mapping>
</target>
</publishing-deployment-topology>

Step-9:  create  ContentRepositories component in exact path ” ..\ Versioned\config\atg\registry\ ContentRepositories.properties” : in your version module
Example code: ContentRepositories.properties
$class=atg.repository.nucleus.RepositoryRegistryService
initialRepositories+=\
                /../xxRepository,\
                /../xxRepository_production


Step-10:  create  ProductionRepositoryMapper component in exact path ” ..\ Versioned\config\atg\repository\ ProductionRepositoryMapper.properties” : in your version module
Example code: ProductionRepositoryMapper.properties
repositoryMappings+=\
       /../xxRepository_production
Step-11: create  ”Initial.properties” in component in exact path ” ..\ Versioned\config\atg\ Initial .properties” : in your version module
Example Code : Initial.properties
initialServices+=/../xxRepository_production,\
      ../xxRepository



These Steps especially need for Flex merchandising view:
To get your custom repository in to merchandising flex Browse mode this step is required 

Step-12:  create MerchandisingBrowseHierarchy.xml  in exact path ” ..\ Versioned\config\atg\remote\commerce\browse\ MerchandisingBrowseHierarchy.xml ”  in your version module .
Example code: for  MerchandisingBrowseHierarchy.xml
<browse-hierarchy xml-combine="append">

<browse-item id="home" xml-combine="append">
     <browse-item reference-id="myxxRepository"/>
</browse-item>

<!-- ***************** -->
<!--   xx Repository  -->
<!-- ***************** -->
<!-- Root browsing node -->
<browse-item id="myxxRepository"
     label="xx Repository"
     is-root="true"
     icon-resource="node.catalogs.iconSmall"
     multisite="disabled">
      <browse-item reference-id="myxxSection "/>
</browse-item>

<!--Cms Section -->
<browse-item id="myxxSection"
     label="xx Section"
     is-root="true"
     icon-resource="node.catalogs.iconSmall"
     multisite="disabled">
     <list-definition id="allXxSectionItems"
          retriever="query"
          child-type="/../xxRepository:xxSection ">
          <retriever-parameter name="query"
               value="ALL" />
     </list-definition>
</browse-item>
</browse-hierarchy>

To get your custom repository in to merchandising flex Find mode this step is required 

Step-13:  create MerchandisingFindConfiguration.xml  in exact path ” ..\ Versioned\config\atg\remote\commerce\find\ MerchandisingFindConfiguration.xml ”  in your version module .
Example code: for  MerchandisingFindConfiguration.xml
<find-configuration site-filtering="true">
     <asset-family id="myXxRepository" site-filtering="true">
          <display-name>xx Repository</display-name>
          <enable-default-query>true</enable-default-query>
          <enable-filter-as-you-type>true</enable-filter-as-you-type>
          <result-list page-size="100"/>
          <default-asset-type>myXxSection</default-asset-type>
         
                  
          <asset-type
               id=" myXxSection"
               site-filtering="true">
               <enable-default-query>true</enable-default-query>
               <enable-filter-as-you-type>true</enable-filter-as-you-type>
               <repository-path>/../xxRepository</repository-path>
               <repository-item-type>xxSection</repository-item-type>
          </asset-type>
                 
     </asset-family>
</find-configuration>