CAA Web Services Home

 

Consuming the ENOVWSProdStructCpp CAA Web Service

Using the ENOVWSProdStructCpp CAA Web service on ENOVIA LCA V5
Use Case

Abstract

This article discusses the CAAENOVWSProdStructCppUseCase use case. It describes how to use the Java client binding that can be generated using the Axis WSDL2Java emitter in order to consume the ENOVWSProdStructCpp CAA Web service. It provides a sample usage scenario that demonstrates how to log on to ENOVIA LCA V5.


What You Will Learn With This Use Case

This use case is intended to show you how you to write a client application that consumes the ENOVWSProdStructCpp CAA Web service. More specifically, you will learn how to:

This article also provides guidance on how to build and run the sample client application using IRAD (IBM Rational Application Developer) 6.0, although any other Java IDE (Integrated Development Environment) or stand-alone JDK/JRE (Java Development Kit/Java Runtime Environment) could be used for that purpose.

[Top]

The CAAENOVWSProdStructCppUseCase Use Case

CAAENOVWSProdStructCppUseCase is a use case of the CAAENOVWS.edu framework that illustrates capabilities of the ENOVWSProdStructCpp CAA Web service.

[Top]

What Does CAAENOVWSProdStructCppUseCase Do

The sample usage scenario performs the following actions:

[Top]

Where To Find the CAAENOVWSProdStructCppUseCase Code

The CAAENOVWSProdStructCppUseCase use case is made of several classes located in the CAAENOVWSAxis1_1Client.mj and CAAENOVWSAxis1_1ClientGen.mj modules of the CAAENOVWS.edu framework. The related resources can be found at the following location :

Windows: <Install>\CAAENOVWS.edu\CAAENOVWSAxis1_3Client.mj\src
Unix: <Install>/CAAENOVWS.edu/CAAENOVWSAxis1_3Client.mj/src

The sample Java resources generated using the Axis WSDL2Java emitter are delivered at the following location (Windows):

<Source>\<Output-package>\CATServiceExceptionType.java
<Source>\<Output-package>\ENOVIA.java
<Source>\<Output-package>\ENOVIA_VPMPartVersion.java
<Source>\<Output-package>\ENOVIA_VPMProductRootClass.java
<Source>\<Output-package>\ENOVWSProdStructCpp.java
<Source>\<Output-package>\ENOVWSProdStructCppLocator.java
<Source>\<Output-package>\IProdStructWS.java
<Source>\<Output-package>\IProdStructWSBindingStub.java
<Source>\<Output-package>\SelectExpression.java
<Source>\<Output-package>\Status.java
<Source>\<Output-package>\StatusArrayType.java
<Source>\<Output-package>\StringArrayType.java
<Source>\<Output-package>\VPMBOPartInstance.java
<Source>\<Output-package>\VPMBOProductInstance.java
<Source>\<Output-package>\holders\ENOVIAHolder.java
<Source>\<Output-package>\holders\StringArrayTypeHolder.java

The CAAENOVWSAxis1_3Client.mj module contains the other following resources:

(Windows):

<Source>\<Root-package>\CAAENOVWSClient.java
<Source>\<Root-package>\CAAENOVWSProdStructCppUseCase.java
<Source>\<Root-package>\
CAAENOVWSProdStructCppWrapper.java

This use case has a dependency on the CustomSessionHandler class. See [1] for details on how to accesss it. It also has a dependency on the CAAENOPosAppBinderImplAxis1_1Client use case. See [2] for details on where to find the related resources.

[Top]

How to Launch CAAENOVWSProdStructCppUseCase

Prior to running this use case you must login to ENOVIA LCA V5 and create a Product class (name of your choosing) and then create a Product with the Product ID = "IProdStructWS_CAA_PRC1".

 

To launch the CAAENOVWSProdStructCppUseCase use case, you will need to set up a buildtime environment, build the code along with its prerequisites, set up a runtime configuration and then execute the use case. You can see [3] for details on how to perform these steps within the IRAD 6 environment.

There is no prerequisites to running this use case.

The sample usage scenario delivered within this use case is launched from the CAAENOVWSClient class. It defines a main method that takes several options as parameters, as described below:

-w <URI> -e <ENOVIA username> -u <Basic Authentication username> -p <Basic Authentication password> -t ENOVWSProdStructCpp

Here follows a sample command, to be updated with your own environment configuration:

-w http://stophe1dsy.dsy.ds:9080/B17 -e cjk -u wpsadmin -p wpsadmin -t ENOVWSProdStructCpp

[Top]

Step-by-step

The following section first explains how to generate the Java client binding for the ENOVWSProdStructCpp CAA Web service demonstrated. The remaining sections then describe the code that must be written in order to consume this Web service:

  1. Creating the Java Client Binding
  2. Instantiating and Configuring the Generated Proxy
  3. Create Part
  4. Add Child Part
  5. Expand Product Structure
  6. Delete Child Part
  7. Helper Functions
  8. Sample Usage Scenario

[Top]

Creating the Java Client Binding

See [4] for details on how to configure the WSDL2Java emitter environment. Once done, you can execute the following command in order to generate the Java client binding for the ENOVWSProdStructCpp CAA Web service:

%JDK_HOME%\bin\java org.apache.axis.wsdl.WSDL2Java -o C:\CAAENOVWS\src -p com.dassault_systemes.caaenovws.caaenovwsaxis1_1clientgen.generated http://karindsy.dsy.ds:9080/V5R16/wsdl?service=urn:com:dassault_systemes:ENOVWSProdStructImpl:ENOVWSProdStructImpl:ENOVWSProdStructCpp

The server name, port, and context root URI information must be updated to match the server where the CAA Web service has been deployed. The list of generated resources is available from the above section: "Where To Find the CAAENOVWSProdStructCppUseCase Code".

[Top]

Instantiating and Configuring the Generated Proxy 

In order to be able to consume the ENOVWSProdStructCpp CAA Web service implementation that has been deployed on a target server, you need to retrieve an instance of the IProdStructWSBindingStub generated class (also often referred to as the proxy). It's a common best practice to manipulate an instance through its dedicated interface whenever available. The WSDL2Java emitter produces an interface that is implemented by the IProdStructWSBindingStub class: IProdStructWS. It describes the methods available on the remote CAA Web service.

Warning  Although the IProdStructWSBindingStub class can be directly instantiated using its own set of constructors, the Axis User's Guide recommends to discard this approach. Instead, the recommended approach is to use another generated class for that purpose: ENOVWSProdStructCppLocator. It implements the ENOVWSProdStructCpp interface.

The following code describes how to instantiate the generated proxy. Such proxy is used in order to marshall method calls and objects to SOAP requests, and to unmarshall SOAP responses to objects.  This proxy must be configured in order to manage authentication on the remote Web server, timeout, and session management. Maintaining the HTTP session state is mandatory when consuming ENOVIA LCA V5 CAA Web services. 

//**
 * Class to demonstrate a sample usage scenario of the ENOVWSProdStructCpp CAA
 * Web service.
 */
public class CAAENOVWSProdStructCppUseCase {
    private String uri = null;
    private String credUser = null;
    private String credPwd = null;
 
    public CAAENOVWSProdStructCppUseCase(String uri,
                                         String credUser,
                                         String credPwd) {
        this.uri = uri;
        this.credUser = credUser;
        this.credPwd = credPwd;
    }
 
    public void runSampleUsageScenario(String enoviaUser) {
        boolean success = false;
        Exception exception = null;
        CAAENOPosApplicationBinderImplWrapper binderWrapper = null;
        SessionToken sessionToken = null;
 
        try {
            // ------------------------------------------------------------
            // Step 1 - Instantiate and configure the proxy
            // ------------------------------------------------------------
 
            System.out.println("STEP 1: Instantiating and configuring CAA Web service proxy");
 
            String clientId = new Long(System.currentTimeMillis()).toString();
            int timeOut = 360000;
 
            // Instantiate the wrapper client classes
            binderWrapper = new CAAENOPosApplicationBinderImplWrapper(clientId,
                    uri, credUser, credPwd, timeOut);
            CAAENOVWSQueryCppWrapper queryWrapper = new CAAENOVWSQueryCppWrapper(
                    clientId, uri, timeOut);
            CAAENOVWSProdStructCppWrapper prodStructWrapper = new CAAENOVWSProdStructCppWrapper(
                    clientId, uri, timeOut);
//code continues....

      }

}

    /**
     * Creates a new proxy for the ENOVWSProdStructCpp CAA Web service
     * implementation and configures it.
     *
     * @param clientId the client identifier used to maintain the session state
     * accross distinct proxies
     * @param uri the root URI of the Web application hosting the implementation
     * of the ENOVWSProdStructCpp CAA Web service
     * @param timeOut the proxy timeout
     */
    public CAAENOVWSProdStructCppWrapper(String clientId,
                                         String uri,
                                         int timeOut) {
        // Compute the SOAP endpoint URI value that bounds to the deployed
        // implementation of the ENOVWSProdStructCpp CAA Web service
        String endpoint = uri + "servicerouter?service=" + SERVICE_ID;
 
        // Retrieve proxy instance
        ENOVWSProdStructCppLocator locator = new ENOVWSProdStructCppLocator();
        try {
            proxy = locator.getENOVWSProdStructCppPort(new URL(endpoint));
        } catch (MalformedURLException e) {
            e.printStackTrace();
            throw new RuntimeException(
                    "Invalid SOAP endpoint URI specified for the ENOVWSProdStructCpp CAA Web service proxy");
        } catch (ServiceException e) {
            e.printStackTrace();
            throw new RuntimeException(
                    "Unable to instantiate the ENOVWSProdStructCpp CAA Web service proxy");
        }
 
        // Required for HTTP session state management on the current proxy
        ((IProdStructWSBindingStub) proxy).setMaintainSession(true);
 
        if (clientId != null) {
            // Used to maintain the HTTP session state accross distinct proxies
            HandlerInfo info = new HandlerInfo();
            info.setHandlerClass(CustomSessionHandler.class);
            Map handlerConfig = new HashMap();
            handlerConfig.put(CustomSessionHandler.CLIENT_ID, clientId);
            info.setHandlerConfig(handlerConfig);
 
            HandlerRegistry registry = locator.getHandlerRegistry();
            String portName = locator.getENOVWSProdStructCppPortWSDDServiceName();
            QName name = new QName(portName);
            List chain = registry.getHandlerChain(name);
            chain.add(info);
        }
 
        // Increase the default client time-out
        ((IProdStructWSBindingStub) proxy).setTimeout(timeOut);
    } 

(1): in order to maintain the HTTP session state between successive calls performed using the same proxy instance, the setMaintainSession method must be used. This is mandatory in the context of ENOVIA LCA V5 CAA Web services,
(2): the default timeout is set to 360 seconds (the value specified in the code is in milliseconds),
(3): when security is enabled, it is mandatory to set the username and password attributes on the generated proxy. The values specified must match a valid set of credentials for the Basic Authentication mechanism.

[Top]

Create Part

In order to create parts, you may use the following method which is available through the generated IProdStructWS proxy interface:

public Status createPart(
  ENOVIA iObjects,
  String iConfigurable,
  ENOVIAHolder oObjects) throws RemoteException,CATServiceExceptionType;

This method accepts the following parameters:

iObjects  List of Part Versions to be created
iConfigurable  TRUE or FALSE (default of FALSE)
oObjects  The successfully created objects are returned

The following code demonstrates the use of the createPart method:

 

   /** 
      * Creates one or more part references. 
      *  
      * @param partNumbers the part numbers 
      * @param domain the part environment domain 
      * @param configurable TRUE or FALSE 
      * @return the ENOVIA result set 
      * @throws Exception 
      */ 
     public ENOVIA createPartRef(String[] partNumbers, 
                                 String domain, 
                                 String configurable) throws Exception { 
         System.out.println(">>> Invoking 'createPart' on ENOVWSProdStructCpp CAA Web service proxy"); 
         if (partNumbers == null) { 
             throw new IllegalArgumentException("Part number array is null"); 
         } else if (domain == null) { 
             throw new IllegalArgumentException("Environment domain is null"); 
         } else if (configurable == null) { 
             throw new IllegalArgumentException("Configurable flag is null"); 
         } 

         System.out.println("Environment domain: " + domain); 
         System.out.println("Configurable part: " + configurable); 
         for (int i = 0; i < partNumbers.length; i++) { 
             System.out.println("Part number[" + i + "]: " + partNumbers[i]); 
         } 
         // Create input data 
         ENOVIA_VPMPartVersion[] vpmPartVersions = new ENOVIA_VPMPartVersion[partNumbers.length]; 

         for (int i = 0; i < partNumbers.length; i++) { 
             vpmPartVersions[i] = new ENOVIA_VPMPartVersion(); 
             vpmPartVersions[i].setDomain(domain); 
             vpmPartVersions[i].setENOVIA_VPMPartMasterV_ID(partNumbers[i]); 
         } 

         ENOVIA input = new ENOVIA(); 
         input.setENOVIA_VPMPartVersion(vpmPartVersions); 
         ENOVIAHolder resultSet = new ENOVIAHolder(); 

         // Invoke method on remote CAA Web service 
         try { 
             Status status = proxy.createPart(input, configurable, resultSet); 
             System.out.println("Status: " + status.getStatus()); 
         } catch (CATServiceExceptionType e) { 
             throw e; 
         } catch (Throwable t) { 
             throw new Exception("Failed to create part reference(s)", t); 
         } 

         // Process output data 
         if (resultSet == null || resultSet.value == null) { 
             throw new Exception("Failed to create part reference(s)"); 
         } 
         return resultSet.value; 
     } 

Information See [2] for details on the processException method.

[Top]

Add Child Part

In order to add child parts, you may use the following method which is available through the generated IProdStructWS proxy interface:
 

 public Status addChildPart(
  Identifier iParentId,
  IdentifierArrayType iChildIds,
  ENOVIAHolder oResult) throws RemoteException,CATServiceExceptionType

The method accepts the following parameters:

iParentId  The identifier of the parent object in ENOVIA LCA V5
iChildIds  The array of child identifiers
oResult  The child part instances added to the parent

The following code demonstrates the use of the addChildPart method:

   /**
     * Creates one or more part instances. The parent object can either be a
     * part instance or a product root class.
     *
     * @param parentUUID the parent unique identifier
     * @param partRefUUIDs the part reference unique identifier
     * @return the ENOVIA result set
     * @throws Exception
     */
    public ENOVIA createPartInst(String parentUUID, String[] partRefUUIDs)
            throws Exception {
        System.out.println(">>> Invoking 'addChildPart' on ENOVWSProdStructCpp CAA Web service proxy");
        if (parentUUID == null) {
            throw new IllegalArgumentException("Parent UUID is null");
        } else if (partRefUUIDs == null) {
            throw new IllegalArgumentException(
                    "Part instance UUID array is null");
        }
        System.out.println("Parent UUID: " + parentUUID);
        for (int i = 0; i < partRefUUIDs.length; i++) {
            System.out.println("Part reference UUID[" + i + "]: " + partRefUUIDs[i]);
        }
 
        // Create input data
        Identifier parentId = CAAENOVWSUtils.toIdentifier(parentUUID);
        Identifier[] partRefIds = CAAENOVWSUtils.toIdentifierArray(partRefUUIDs);
        ENOVIAHolder resultSet = new ENOVIAHolder();
 
        // Invoke method on remote CAA Web service
        try {
            Status status = proxy.addChildPart(parentId, partRefIds, resultSet);
            System.out.println("Status: " + status.getStatus());
        } catch (CATServiceExceptionType e) {
            throw e;
        } catch (Throwable t) {
            throw new Exception("Failed to create part instance(s)", t);
        }
 
        // Process output data
        if (resultSet == null || resultSet.value == null) {
            throw new Exception("Failed to create part instance(s)");
        }
        return resultSet.value;
    } 

[Top]

Expand Product Structure
 

In order to expand product structure, you may use the following method which is available through the generated IProdStructWS proxy interface:
 

 public Status expandProductStructure(
  Identifier iObjectId,
  SelectExpression iSelect,
  int iDepth,
  ENOVIAHolder oResult) throws java.rmi.RemoteException,CATServiceExceptionType;

This method accepts the following parameters:

iObjectId  The identifier of the parent object in ENOVIA LCA V5
iSelect  The select Expression for query. see   for [5] details on SelectExpression.
iDepth depth of the structure that needs to be returned (it is -1|0|1). iDepth = -1 will return all, 0 will return parent (and optionally attached documents), 1 will return first level children.
oResult  The child part instances added to the parent

The following code demonstrates the use of the expandProductStructure method:

   /**
     * Expands a product structure.
     *
     * @param parentUUID the parent unique identifier
     * @param level the expand level
     * @param selectExpression
     * @return the ENOVIA result set
     * @throws Exception
     */
    public ENOVIA expandProductStructure(String parentUUID,
                                         int level,
                                         String selectExpression)
            throws Exception {
        System.out.println(">>> Invoking 'expandProductStructure' on ENOVWSProdStructCpp CAA Web service proxy");
        if (parentUUID == null) {
            throw new IllegalArgumentException("Parent UUID is null");
        } else if (level < 0) {
            throw new IllegalArgumentException("Invalid level value");
        }
        System.out.println("Parent UUID: " + parentUUID);
        System.out.println("Level: " + level);
 
        // Create input data
        Identifier parentId = CAAENOVWSUtils.toIdentifier(parentUUID);
        SelectExpression selectExp = new SelectExpression();
        selectExp.setValue(selectExpression);
        ENOVIAHolder resultSet = new ENOVIAHolder();
 
        // Invoke method on remote CAA Web service
        try {
            Status status = proxy.expandProductStructure(parentId,
                                                         selectExp,
                                                         level,
                                                         resultSet);
            System.out.println("Status: " + status.getStatus());
        } catch (CATServiceExceptionType e) {
            throw e;
        } catch (Throwable t) {
            throw new Exception("Failed to expand product structure", t);
        }
 
        // Process output data
        if (resultSet == null || resultSet.value == null) {
            throw new Exception("Failed to expand product structure");
        }
        return resultSet.value;
    } 

[Top]

Delete Child Part

In order to delete child parts, you may use the following method which is available through the generated IProdStructWS proxy interface:
 

 public Status deleteChildPart(
  Identifier iParentId,
  IdentifierArrayType iChildIds) throws java.rmi.RemoteException,CATServiceExceptionType;
 

This method accepts the following parameters:

iParentId  The identifier of the parent object in ENOVIA LCA V5
iChildIds  The array of child identifiers

The following code demonstrates the use of the deleteChildPart method:

    /**
     * Deletes one or more part instances.
     *
     * @param parentUUID the parent unique identifier
     * @param partInstUUIDs the part instance unique identifiers
     * @throws Exception
     */
    public void deletePartInst(String parentUUID, String[] partInstUUIDs)
            throws Exception {
        System.out.println(">>> Invoking 'deleteChildPart' on ENOVWSProdStructCpp CAA Web service proxy");
        if (parentUUID == null) {
            throw new IllegalArgumentException(
                    "Parent unique identifier is null");
        } else if (partInstUUIDs == null) {
            throw new IllegalArgumentException(
                    "Part instance UUID array is null");
        }
        System.out.println("Parent UUID: " + parentUUID);
        for (int i = 0; i < partInstUUIDs.length; i++) {
            System.out.println("Part instance UUID[" + i + "]: " + partInstUUIDs[i]);
        }
 
        // Create input data
        Identifier parentId = CAAENOVWSUtils.toIdentifier(parentUUID);
        Identifier[] partInstIds = CAAENOVWSUtils.toIdentifierArray(partInstUUIDs);
 
        // Invoke method on remote CAA Web service
        try {
            Status status = proxy.deleteChildPart(parentId, partInstIds);
            System.out.println("Status: " + status.getStatus());
        } catch (CATServiceExceptionType e) {
            throw e;
        } catch (Throwable t) {
            throw new Exception("Failed to delete part instance(s)", t);
       }
    }
 

[Top]

Helper Functions

The CAAENOVWSUtils.displayResults method can be found at:

<Install>\<Source>\<Package>\CAAENOVWSUtils.java

Here is a sample of the source:

      public static void displayResults(ENOVIA resultSet, int maxDisplay) {
            if (resultSet == null) {
                  throw new IllegalArgumentException("ENOVIA result set is null");
            }
            System.out.println(
                  "Displaying first "
                         + maxDisplay
                        + " results for each object type found in the ENOVIA result set");
 
            ENOVIA_Action_Deliverable[] actionDeliverable =
                  resultSet.getENOVIA_Action_Deliverable();
            if (actionDeliverable != null) {
                  System.out.println(
                        "Number of ENOVIA_Action_Deliverable objects: "
                              + actionDeliverable.length);
                  for (int i = 0;
                        i < actionDeliverable.length && i < maxDisplay;
                        i++) {
                        ENOVIA_Action_Deliverable current = actionDeliverable[i];
 
                        System.out.println("ENOVIA_Action_Deliverable[" + i + "]:");
                        System.out.println("\tCATJsyUUID: " + current.getCATJsyUUID());
                        System.out.println("\tDomain: " + current.getDomain());
                        System.out.println(
                              "\tAFLActionV_abstract: "
                                    + current.getENOVIA_AFLActionV_abstract());
                        System.out.println(
                              "\tAFLActionV_creator: "
                                    + current.getENOVIA_AFLActionV_creator());
                        System.out.println(
                              "\tAFLActionV_description: "
                                    + current.getENOVIA_AFLActionV_description());
                        System.out.println(
                              "\tAFLActionV_name: "
                                    + current.getENOVIA_AFLActionV_name());
                        System.out.println(
                              "\tAFLActionV_priority: "
                                    + current.getENOVIA_AFLActionV_priority());
                        System.out.println(
                              "\tAFLActionV_status: "
                                    + current.getENOVIA_AFLActionV_status());
                        System.out.println(
                              "\tAFLActionV_user: "
                                    + current.getENOVIA_AFLActionV_user());
                        System.out.println(
                              "\tAFLActionC_created: "
                                    + current.getENOVIA_AFLActionC_created());
                        System.out.println(
                              "\tAFLActionC_modified: "
                                    + current.getENOVIA_AFLActionC_modified());
                        System.out.println(
                              "\tAFLActionV_actual_start_date: "
                                    + current.getENOVIA_AFLActionV_actual_start_date());
                        System.out.println(
                              "\tAFLActionV_end_date: "
                                    + current.getENOVIA_AFLActionV_end_date());
                        System.out.println(
                              "\tAFLActionV_start_date: "
                                    + current.getENOVIA_AFLActionV_start_date());
                  }
            }
 
            ENOVIA_Action_Design[] actionDesign =
                  resultSet.getENOVIA_Action_Design();
            if (actionDesign != null) {
                  System.out.println(
                        "Number of ENOVIA_Action_Design objects: "
                              + actionDesign.length);
                  for (int i = 0; i < actionDesign.length && i < maxDisplay; i++) {
                        ENOVIA_Action_Design current = actionDesign[i];
 
                        System.out.println("ENOVIA_Action_Design[" + i + "]:");
                        System.out.println("\tCATJsyUUID: " + current.getCATJsyUUID());
                        System.out.println("\tDomain: " + current.getDomain());
                        System.out.println(
                              "\tAFLActionV_abstract: "
                                    + current.getENOVIA_AFLActionV_abstract());
                        System.out.println(
                              "\tAFLActionV_creator: "
                                    + current.getENOVIA_AFLActionV_creator());
                        System.out.println(
                              "\tAFLActionV_description: "
                                    + current.getENOVIA_AFLActionV_description());
                        System.out.println(
                              "\tAFLActionV_name: "
                                    + current.getENOVIA_AFLActionV_name());
                        System.out.println(
                              "\tAFLActionV_priority: "
                                    + current.getENOVIA_AFLActionV_priority());
                        System.out.println(
                              "\tAFLActionV_status: "
                                    + current.getENOVIA_AFLActionV_status());
                        System.out.println(
                              "\tAFLActionV_user: "
                                    + current.getENOVIA_AFLActionV_user());
                        System.out.println(
                              "\tAFLActionC_created: "
                                    + current.getENOVIA_AFLActionC_created());
                        System.out.println(
                              "\tAFLActionC_modified: "
                                    + current.getENOVIA_AFLActionC_modified());
                        System.out.println(
                              "\tAFLActionV_actual_start_date: "
                                    + current.getENOVIA_AFLActionV_actual_start_date());
                        System.out.println(
                              "\tAFLActionV_end_date: "
                                    + current.getENOVIA_AFLActionV_end_date());
                        System.out.println(
                              "\tAFLActionV_start_date: "
                                    + current.getENOVIA_AFLActionV_start_date());
                  }
            }
 
            ENOVIA_Action_Documentation[] actionDocumentation =
                  resultSet.getENOVIA_Action_Documentation();
            if (actionDocumentation != null) {
                  System.out.println(
                        "Number of ENOVIA_Action_Documentation objects: "
                              + actionDocumentation.length);
                  for (int i = 0;
                        i < actionDocumentation.length && i < maxDisplay;
                        i++) {
                        ENOVIA_Action_Documentation current = actionDocumentation[i];
 
                        System.out.println("ENOVIA_Action_Documentation[" + i + "]:");
                        System.out.println("\tCATJsyUUID: " + current.getCATJsyUUID());
                        System.out.println("\tDomain: " + current.getDomain());
                        System.out.println(
                              "\tAFLActionV_abstract: "
                                    + current.getENOVIA_AFLActionV_abstract());
                        System.out.println(
                              "\tAFLActionV_creator: "
                                    + current.getENOVIA_AFLActionV_creator());
                        System.out.println(
                              "\tAFLActionV_description: "
                                    + current.getENOVIA_AFLActionV_description());
                        System.out.println(
                              "\tAFLActionV_name: "
                                    + current.getENOVIA_AFLActionV_name());
                        System.out.println(
                              "\tAFLActionV_priority: "
                                    + current.getENOVIA_AFLActionV_priority());
                        System.out.println(
                              "\tAFLActionV_status: "
                                    + current.getENOVIA_AFLActionV_status());
                        System.out.println(
                              "\tAFLActionV_user: "
                                    + current.getENOVIA_AFLActionV_user());
                        System.out.println(
                              "\tAFLActionC_created: "
                                    + current.getENOVIA_AFLActionC_created());
                        System.out.println(
                              "\tAFLActionC_modified: "
                                    + current.getENOVIA_AFLActionC_modified());
                        System.out.println(
                              "\tAFLActionV_actual_start_date: "
                                    + current.getENOVIA_AFLActionV_actual_start_date());
                        System.out.println(
                              "\tAFLActionV_end_date: "
                                    + current.getENOVIA_AFLActionV_end_date());
                        System.out.println(
                              "\tAFLActionV_start_date: "
                                    + current.getENOVIA_AFLActionV_start_date());
                  }
            }
 
 //rest of the source omitted for clarity

      }

[Top]

Sample Usage Scenario

The sample usage scenario consumes following CAA web services:

Information This sample client assumes that a Product Root Class has been created using the ENOVIA V5 LCA product, and that the V_ID must be "IProdStructWS_CAA_PRC1".

The following code demonstrates a sample usage scenario for the ENOVWSProdStructCpp CAA Web service.  It is a partial example, for full source refer to:

<Install>\<Source>\<Root-package>\CAAENOVWSProdStructCppUseCase.java

 

// COPYRIGHT DASSAULT SYSTEMES 2006
// =============================================================================
// This class provides a sample use case scenario that illustrates the
// ENOVWSProdStructCpp CAA Web service.
// =============================================================================
 
package com.dassault_systemes.caaenovws.caaenovwsaxis1_3client;
 
import com.dassault_systemes.caaenovws.caaenovwsaxis1_3client.generated.CATServiceExceptionType;
import com.dassault_systemes.caaenovws.caaenovwsaxis1_3client.generated.ENOVIA;
import com.dassault_systemes.caaplmsecurity.caaenoposappbinderaxis1_3client.CAAENOPosApplicationBinderImplWrapper;
import com.dassault_systemes.caaplmsecurity.caaenoposappbinderaxis1_3client.generated.SessionToken;
 
/**
 * Class to demonstrate a sample usage scenario of the ENOVWSProdStructCpp CAA
 * Web service.
 */
public class CAAENOVWSProdStructCppUseCase {
    private String uri = null;
    private String credUser = null;
    private String credPwd = null;
 
    public CAAENOVWSProdStructCppUseCase(String uri,
                                         String credUser,
                                         String credPwd) {
        this.uri = uri;
        this.credUser = credUser;
        this.credPwd = credPwd;
    }
 
    public void runSampleUsageScenario(String enoviaUser) {
        boolean success = false;
        Exception exception = null;
        CAAENOPosApplicationBinderImplWrapper binderWrapper = null;
        SessionToken sessionToken = null;
 
        try {
            // ------------------------------------------------------------
            // Step 1 - Instantiate and configure the proxy
            // ------------------------------------------------------------
 
            System.out.println("STEP 1: Instantiating and configuring CAA Web service proxy");
 
            String clientId = new Long(System.currentTimeMillis()).toString();
            int timeOut = 360000;
 
            // Instantiate the wrapper client classes
            binderWrapper = new CAAENOPosApplicationBinderImplWrapper(clientId,
                    uri, credUser, credPwd, timeOut);
            CAAENOVWSQueryCppWrapper queryWrapper = new CAAENOVWSQueryCppWrapper(
                    clientId, uri, timeOut);
            CAAENOVWSProdStructCppWrapper prodStructWrapper = new CAAENOVWSProdStructCppWrapper(
                    clientId, uri, timeOut);
 
            // ------------------------------------------------------------
            // Step 2 - Open session with ENOVIA LCA V5
            // ------------------------------------------------------------
 
            System.out.println("--------------------------------------------------------------------------------");
            System.out.println("STEP 2: Opening session with ENOVIA LCA V5");
            System.out.println("--------------------------------------------------------------------------------");
 
            String[] userContexts = binderWrapper.getUserContexts(enoviaUser);
 
            System.out.println("Found " + userContexts.length + " context(s) in database");
            System.out.println("Displaying list of available contexts:");
            String firstContext = new String();
           
            for (int i = 0; i < userContexts.length; i++) {
                System.out.println("Context[" + i + "]: " + userContexts[i]);
            }
           
            firstContext = (String)userContexts[0];
           
 
            System.out.println("\n--------------------------------------------------------------------------------");
            System.out.println("STEP 3: Logging on to ENOVIA LCA V5");
            System.out.println("--------------------------------------------------------------------------------");
 
            if (userContexts.length == 0) {
                throw new Exception("No context found for the user specified");
            }
            sessionToken = binderWrapper.login(firstContext);
 
            // ------------------------------------------------------------
            // Step 3 - Look up for product
            //
            // -- IProdStructWS_CAA_PRC1

           // ------------------------------------------------------------
 
            System.out.println("--------------------------------------------------------------------------------");
            System.out.println("STEP 3: Searching for product");
            System.out.println("--------------------------------------------------------------------------------");
 
            String productId = "IProdStructWS_CAA_PRC1";
            StringBuffer xmlFilter = new StringBuffer();
            xmlFilter.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
            xmlFilter.append("<FILTER CASESENSITIVE=\"TRUE\">");
            xmlFilter.append("<SELECT>");
            xmlFilter.append("<OBJECT DOMAIN=\"PRODUCT\" NAME=\"ENOVIA_VPMProductRootClass\" >");
            xmlFilter.append("<ATTRIBUTE NAME=\"ENOVIA_VPMProductRootClass.V_ID\" />");
            xmlFilter.append("</OBJECT>");
            xmlFilter.append("</SELECT>");
            xmlFilter.append("<WHERE>");
            xmlFilter.append("<FILTER_CONDITION OPERATOR=\"AND\">");
            xmlFilter.append("<ATTRIBUTE_FILTER>");
            xmlFilter.append("<EXPRESSION OP=\"LIKE\" VALUE=\"" + productId + "\">");
            xmlFilter.append("<ATTRIBUTE NAME=\"ENOVIA_VPMProductRootClass.V_ID\" />");
            xmlFilter.append("</EXPRESSION>");
            xmlFilter.append(" </ATTRIBUTE_FILTER>");
            xmlFilter.append("</FILTER_CONDITION>");
            xmlFilter.append("</WHERE>");
            xmlFilter.append("<ORDERBY>");
            xmlFilter.append("ENOVIA_VPMProductRootClass.V_ID");
            xmlFilter.append("</ORDERBY>");
            xmlFilter.append("</FILTER>");
 
            ENOVIA queryResultSet = queryWrapper.queryObjects(xmlFilter.toString());
 
            String[] productUUIDs = queryWrapper.getENOVIA_VPMProductRootClassUUIDs(queryResultSet);
            if (productUUIDs.length == 0) {
                throw new Exception("Failed to find product");
            } else if (productUUIDs.length > 1) {
                throw new Exception(
                        "Invalid state: more than one product matched the input criteria");
            }
            String productUUID = productUUIDs[0];
 
            CAAENOVWSUtils.displayResults(queryResultSet, 1);
}
//rest of the source omitted for clarity

}

[Top]


In Short

This use case explains how to use the Java client binding generated using the Axis WSDL2Java emitter in order to consume the ENOVWSProdStructCpp CAA Web service. It also gives an overview of the methods available for that particular CAA Web service:

[Top]


References

[1] Maintaining the Session State
[2] Consuming the ENOPosApplicationBinderImpl CAA Web Service
[3] Building and Launching a CAA Web Service Use Case
[4] Generating a Java Client Binding
[5] Using SelectExpression
[6] Consuming the ENOVWSQueryCpp CAA Web Service
[Top]

History

Version: 1 [May 2005] Document created
[Top]

Copyright © 2005, Dassault Systèmes. All rights reserved.