CAA Web Services Home

 

Consuming the ENOVWSCntMgmtCpp CAA Web Service

Using the ENOVWSCntMgmtCpp CAA Web Service for document management
Use Case

Abstract

This article discusses the CAAENOVWSCntMgmtCppAxis1_3Client 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 ENOVWSCntMgmtCpp CAA Web service. It provides a sample usage scenario that demonstrates how to create Documents, attach Documents to a Part, CheckIn and CheckOut Documents from ENOVIA LCA V5.


What You Will Learn With This Use Case

This use case is intended to show you how to write a client application that consumes the ENOVWSCntMgmtCpp 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 CAAENOVWSCntMgmtCppAxis1_3Client Use Case

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

[Top]

What Does CAAENOVWSCntMgmtCppAxis1_3Client Do

The sample usage scenario performs the following actions:

[Top]

Where To Find the CAAENOVWSCntMgmtCppClient Code

The CAAENOVWSCntMgmtCppClient use case is made of several classes located in the CAAENOVWSAxis1_3Client.mj module of the CAAENOVWS.edu framework:

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 in the following directory (Windows):

<Source>\<Output-package>\CATServiceExceptionType.java
<Source>\<Output-package>\ENOVWSCntMgmtCpp.java
<Source>\<Output-package>\ICntMgmtWS.java
<Source>\<Output-package>\ENOVWSCntMgmtCppLocator.java
<Source>\<Output-package>\ICntMgmtWSBindingStub.java
<Source>\<Output-package>\Identifier.java
<Source>\<Output-package>\SessionToken.java
<Source>\<Output-package>\Status.java
<Source>\<Output-package>\StatusArrayType.java
<Source>\<Output-package>\StringArrayType.java
<Source>\<Output-package>\holders\SessionTokenHolder.java
<Source>\<Output-package>\holders\StringArrayTypeHolder.java

The CAAENOVWSAxis1_3Client.mj module contains the other following resources:

<Source>\<Root-package>\CAAENOVWSClient.java
<Source>\<Root-package>\CAAENOVWSCntMgmtCppUseCase.java
<Source>\<Root-package>\CAAENOVWSCntMgmtCppWrapper.java

The CAAENOVWSQueryCppWrapper class describes how to configure the generated proxy and how to invoke its methods. The CAAENOVWSQueryCppUseCase class demonstrates a sample use case scenario of the ENOVWSQueryCpp CAA Web service. The CAAENOVWSClient class contains the main program. It parses the command line inputs and starts up the use case.

This use case has a dependency on the CustomSessionHandler class which is available in the CAAJAXRPCHTTPSessionHandler.mj module of the CAAWebServices.edu framework. Please refer to [1] for details on HTTP session management and where to find the related class.

This use case has also a dependency on the CAAENOPosAppBinderImplAxis1_3Client use case in order to manage a session with ENOVIA LCA V5. Please refer to [1] for details on where to find the related code.

 

This use case has a dependency on the CustomSessionHandler class. See [1] for details on how to access 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 CAAENOVWSCntMgmtCppClient

To launch the CAAENOVWSCntMgmtCppAxis1_3Client 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 ENOVWSCntMgmtCpp

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 ENOVWSCntMgmtCpp

[Top]

Step-by-step

The following section first explains how to generate the Java client binding for the ENOVWSCntMgmtCpp 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 the Generated Proxy
  3. Creating ENOVIA LCA V5 Document
  4. Attaching ENOVIA LCA V5 Document to ENOVIA LCA V5 Part
  5. Checking In ENOVIA LCA V5 Document
  6. Checking Out ENOVIA LCA V5 Document
  7. Sample Usage Scenario

[Top]

Creating the Java Client Binding

Please refer to [3] for details on how to generate the Java client binding using the Axis WSDL2Java emitter.

Here follows a sample command in order to generate the Java client binding for the ENOVWSCntMgmtpp CAA Web service:

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

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 CAAENOVWSCntMgmtCppClient Code".

[Top]

Instantiating the Generated Proxy

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.

 

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

Warning  Although the ICntMgmtWSBindingStub 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: ENOVWSCntMgmtCppLocator. It implements the ENOVWSCntMgmtCpp 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.

 

public class CAAENOVWSCntMgmtCppWrapper {
    private String SERVICE_ID = "urn:com:dassault_systemes:ENOVWSCntMgmtImpl:ENOVWSCntMgmtImpl:ENOVWSCntMgmtCpp";
    private ICntMgmtWS proxy = null;
    /**
     * Creates a new proxy for the ENOVWSCntMgmtCpp 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 ENOVWSCntMgmtCpp CAA Web service
     * @param timeOut the proxy timeout
     */
    public CAAENOVWSCntMgmtCppWrapper(String clientId, String uri, int timeOut) {
        // Compute the SOAP endpoint URI value that bounds to the deployed
        // implementation of the ENOVWSCntMgmtCpp CAA Web service
        String endpoint = uri + "servicerouter?service=" + SERVICE_ID;
        // Retrieve proxy instance
        ENOVWSCntMgmtCppLocator locator = new ENOVWSCntMgmtCppLocator();
        try {
            proxy = locator.getENOVWSCntMgmtCppPort(new URL(endpoint));
        } catch (MalformedURLException e) {
            e.printStackTrace();
            throw new RuntimeException(
                    "Invalid SOAP endpoint URI specified for the ENOVWSCntMgmtCpp CAA Web service proxy");
        } catch (ServiceException e) {
            e.printStackTrace();
            throw new RuntimeException(
                    "Unable to instantiate the ENOVWSCntMgmtCpp CAA Web service proxy");
        }
        // Required for HTTP session state management on the current proxy
        ((ICntMgmtWSBindingStub) 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.getENOVWSCntMgmtCppPortWSDDServiceName();
            QName name = new QName(portName);
            List chain = registry.getHandlerChain(name);
            chain.add(info);
        }
        // Increase the default client time-out
        ((ICntMgmtWSBindingStub) 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 60 seconds. This value can be increased in order to avoid potential issues at runtime, such as losing the HTTP connection before receiving the SOAP response. For security, the 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]

Creating ENOVIA LCA V5 Document

ENOVIA LCA V5 Document can be created using the following method, which is available through the generated ICntMgmtWS proxy interface:

public Status createDocument(ENOVIA iObjects,
  ENOVIAHolder oObjects) throws RemoteException, CATServiceExceptionType

This method accepts the following parameters:

[in] iObjects  ENOVIA_VPMDocumentRevision object with a unique V_ID for ENOVIA_VPMTPDocumentMaster
[in/out] oUserContexts  Return the created document revision object

The following code demonstrates the use of the createDocument method:

public class CAAENOVWSCntMgmtCppWrapper {
 ....
    public ENOVIA createDocument(String docID, String docName, String domain)
            throws Exception {
        System.out.println(">>> Invoking 'createDocument' on ENOVWSCntMgmtCpp CAA Web service proxy");
        if (docID == null) {
            throw new IllegalArgumentException("Document ID is null");
        } else if (docName == null) {
            throw new IllegalArgumentException("Document name is null");
        } else if (domain == null) {
            throw new IllegalArgumentException("Document domain is null");
        }
        System.out.println("Document domain: " + domain);
        System.out.println("Document ID: " + docID);
        System.out.println("Document name: " + docName);
        // Create input data
        ENOVIA_VPMDocumentRevision vpmDocumentRevision = new ENOVIA_VPMDocumentRevision();
        vpmDocumentRevision.setDomain(domain);
        vpmDocumentRevision.setENOVIA_VPMTPDocumentMasterV_ID(docID);
        vpmDocumentRevision.setENOVIA_VPMTPDocumentMasterV_name(docName);
        ENOVIA_VPMDocumentRevision[] vpmDocumentRevisions = { vpmDocumentRevision };
        ENOVIA input = new ENOVIA();
        input.setENOVIA_VPMDocumentRevision(vpmDocumentRevisions);
        ENOVIAHolder resultSet = new ENOVIAHolder();
        // Invoke create document on remote Web service
        try {
            Status status = proxy.createDocument(input, resultSet);
            System.out.println("Status: " + status.getStatus());
        } catch (CATServiceExceptionType e) {
            throw e;
        } catch (Throwable t) {
            throw new Exception("Failed to create document(s)", t);
        }
        // Process output data
        if (resultSet == null || resultSet.value == null) {
            throw new Exception("Failed to create document(s)");
        }
        return resultSet.value;
    }
}

[Top]

Attaching ENOVIA LCA V5 Document to ENOVIA LCA V5 Part

ENOVIA LCA V5 Document can be attached to an existing part using the following method, which is available through the generated ICntMgmtWS proxy interface:

public Status attachDocument(Identifier iParentId,
  IdentifierArrayType iDocumentIds,
  String iAttachType,
  String iDocRole) throws RemoteException, CATServiceExceptionType

Prerequisite: A ENOVIA LCA V5 Part Object should be existing.

This method accepts the following parameters:

[in] iParentId  Part object identifier
[in] iDocumentIds  Document Identifier(s)
[in] iAttachType  Representation" or "Documentation"
[in] iDocRole  Primary" or "Secondary"

The following code can demonstrates the use of the attachDocument() method:

public class CAAENOVWSCntMgmtCppWrapper {
.....
    public void attachDocument(String partUUID,
                               String[] docUUIDs,
                               String attachType,
                               String role) throws Exception {
        System.out.println(">>> Invoking 'attachDocument' on ENOVWSCntMgmtCpp CAA Web service proxy");
        if (partUUID == null) {
            throw new IllegalArgumentException("Part reference UUID is null");
        } else if (docUUIDs == null) {
            throw new IllegalArgumentException("Document UUID array is null");
        } else if (attachType == null) {
            throw new IllegalArgumentException("Attach type is null");
        } else if (role == null) {
            throw new IllegalArgumentException("Role is null");
        }
        System.out.println("Part reference UUID: " + partUUID);
        System.out.println("Attach type: " + attachType);
        System.out.println("Role: " + role);
        for (int i = 0; i < docUUIDs.length; i++) {
            System.out.println("Document UUID[" + i + "]: " + docUUIDs[i]);
        }
        // Create input data
        Identifier partId = CAAENOVWSUtils.toIdentifier(partUUID);
        Identifier[] docIds = CAAENOVWSUtils.toIdentifierArray(docUUIDs);
        // Invoke create document on remote Web service
        try {
            Status status = proxy.attachDocument(partId,
                                                 docIds,
                                                 attachType,
                                                 role);
            System.out.println("Status: " + status.getStatus());
        } catch (CATServiceExceptionType e) {
            throw e;
        } catch (Throwable t) {
            throw new Exception("Failed to attach document(s)", t);
        }
    }
}
 

[Top]

Check In ENOVIA LCA V5 Document

ENOVIA LCA V5 Document can be checked in using the following method, which is available through the generated ICntMgmtWS proxy interface:

public Status checkIn(Identifier iDocumentId,
  String iFileName,
  String iVaultName,
  byte[] iData,
  ENOVIAHolder oResult) throws RemoteException, CATServiceExceptionType

This method accepts the following parameters:

[in] iDocumentId  The Document revision identifier
[in] iFileName  The desired doc filename
[in] iVaultName  The target vault name (optional, uses default)
[in] iData  Binary document file contents
[in/out] oResult  Modified Document file object and attributes

The following code demonstrates the use of the checkIn method:

public class CAAENOVWSCntMgmtCppWrapper {
.....
    public ENOVIA ckeckIn(String docUUID,
                          String fileName,
                          String vaultName,
                          byte[] data) throws Exception {
        System.out.println(">>> Invoking 'checkIn' on ENOVWSCntMgmtCpp CAA Web service proxy");
        if (docUUID == null) {
            throw new IllegalArgumentException("Document UUID is null");
        } else if (fileName == null) {
            throw new IllegalArgumentException("Filename is null");
        } else if (vaultName == null) {
            throw new IllegalArgumentException("Vault name is null");
        } else if (data == null) {
            throw new IllegalArgumentException("Data byte array is null");
        }
        System.out.println("Document UUID: " + docUUID);
        System.out.println("Filename: " + fileName);
        System.out.println("Vault name: " + vaultName);
        System.out.println("Data: " + data);
        // Create input data
        Identifier docId = CAAENOVWSUtils.toIdentifier(docUUID);
        ENOVIAHolder resultSet = new ENOVIAHolder();
        // Invoke create document on remote Web service
        try {
            Status status = proxy.checkIn(docId,
                                          fileName,
                                          vaultName,
                                          data,
                                          resultSet);
            System.out.println("Status: " + status.getStatus());
        } catch (CATServiceExceptionType e) {
            throw e;
        } catch (Throwable t) {
            throw new Exception("Failed to check in document(s)", t);
        }
        // Process output data
        if (resultSet == null || resultSet.value == null) {
            throw new Exception("Failed to check in document(s)");
        }
        return resultSet.value;
    }
}
 

[Top]

Check Out ENOVIA LCA V5 Document

ENOVIA LCA V5 Document can be checked out using the following method, which is available through the generated ICntMgmtWS proxy interface:

public Status checkOut(Identifier iDocumentId,
  ByteArrayHolder oData,
  ENOVIAHolder oResult) throws RemoteException, CATServiceExceptionType

This method accepts the following parameters:

[in] iDocumentId  Identifier of the Document Revision
[in/out] oData  Binary document file contents
[in/out] oResult  Structure containing the checked-out document file object and attributes

The following code demonstrates the use of the checkOut method:

public class CAAENOVWSCntMgmtCppWrapper {
    ........
    public ENOVIA checkOut(String docUUID) throws Exception {
        System.out.println(">>> Invoking 'checkOut' on ENOVWSCntMgmtCpp CAA Web service proxy");
        if (docUUID == null) {
            throw new IllegalArgumentException("Document UUID is null");
        }
        System.out.println("Document UUID: " + docUUID);
        // Create input data
        Identifier docId = CAAENOVWSUtils.toIdentifier(docUUID);
        ENOVIAHolder resultSet = new ENOVIAHolder();
        ByteArrayHolder data = new ByteArrayHolder();
        // Invoke create document on remote Web service
        try {
            Status status = proxy.checkOut(docId, data, resultSet);
            System.out.println("Status: " + status.getStatus());
        } catch (CATServiceExceptionType e) {
            throw e;
        } catch (Throwable t) {
            throw new Exception("Failed to check out document(s)", t);
        }
        // Process output data
        if (resultSet == null || resultSet.value == null) {
            throw new Exception("Failed to check out document(s)");
        }
        return resultSet.value;
    }
}
 

[Top]

Sample Usage Scenario

The sample usage scenario consumes following CAA web services:

The following code demonstrates a sample usage scenario for the ENOVWSCntMgmtCpp CAA Web service:

public class CAAENOVWSCntMgmtCppUseCase {
    private String uri = null;
    private String credUser = null;
    private String credPwd = null;
    public CAAENOVWSCntMgmtCppUseCase(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 class
            binderWrapper = new CAAENOPosApplicationBinderImplWrapper(clientId,
                    uri, credUser, credPwd, timeOut);
            CAAENOVWSProdStructCppWrapper prodStructWrapper = new CAAENOVWSProdStructCppWrapper(
                    clientId, uri, timeOut);
            CAAENOVWSCntMgmtCppWrapper cntMgmtWrapper = new CAAENOVWSCntMgmtCppWrapper(
                    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:");
            for (int i = 0; i < userContexts.length; i++) {
                System.out.println("Context[" + i + "]: " + userContexts[i]);
            }
            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(userContexts[0]);
            // ------------------------------------------------------------
            // Step 3 - Create 2 documents
            // ------------------------------------------------------------
            System.out.println("--------------------------------------------------------------------------------");
            System.out.println("STEP 3: Creating 2 documents");
            System.out.println("--------------------------------------------------------------------------------");
            String docId1 = "CAAWSCnt1" + System.currentTimeMillis(); // the VID
            // has to
            // be
            // unique
            String docName1 = "Doc1" + docId1;
            String domain = "DOCDIR";
            ENOVIA createDocResultSet1 = cntMgmtWrapper.createDocument(docId1,
                                                                       docName1,
                                                                       domain);
            String[] docUUIDs1 = cntMgmtWrapper.getENOVIA_VPMDocumentRevisionUUIDs(createDocResultSet1);
            if (docUUIDs1.length > 1) {
                throw new Exception(
                        "Invalid state: more than 1 document was returned");
            } else if (docUUIDs1.length != 1) {
                throw new Exception("Failed to create the document");
            }
            String docUUID1 = docUUIDs1[0];
            CAAENOVWSUtils.displayResults(createDocResultSet1, 1);
            String docId2 = "CAAWSCnt2" + System.currentTimeMillis();
            String docName2 = "Doc2" + docId2;
            ENOVIA createDocResultSet2 = cntMgmtWrapper.createDocument(docId2,
                                                                       docName2,
                                                                       domain);
            String[] docUUIDs2 = cntMgmtWrapper.getENOVIA_VPMDocumentRevisionUUIDs(createDocResultSet2);
            if (docUUIDs2.length > 1) {
                throw new Exception(
                        "Invalid state: more than 1 document was returned");
            } else if (docUUIDs2.length != 1) {
                throw new Exception("Failed to create the document");
            }
            String docUUID2 = docUUIDs2[0];
            CAAENOVWSUtils.displayResults(createDocResultSet2, 1);
            // ------------------------------------------------------------
            // Step 4 - Create part
            // ------------------------------------------------------------
            System.out.println("--------------------------------------------------------------------------------");
            System.out.println("STEP 4: Creating part reference");
            System.out.println("--------------------------------------------------------------------------------");
            String partNumber = "CAAWSCntPrt" + System.currentTimeMillis();
            ENOVIA createPartResultSet = prodStructWrapper.createPartRef(new String[] { partNumber },
                                                                         "PRODUCT",
                                                                         "FALSE");
            String[] partRefUUIDs = prodStructWrapper.getENOVIA_VPMPartVersionUUIDs(createPartResultSet);
            if (partRefUUIDs.length > 1) {
                throw new Exception(
                        "Invalid state: more than 1 part reference was returned");
            } else if (partRefUUIDs.length != 1) {
                throw new Exception("Failed to create part reference");
            }
            String partRefUUID = partRefUUIDs[0];
            CAAENOVWSUtils.displayResults(createPartResultSet, 1);
            // ------------------------------------------------------------
            // Step 5 - Attach document to part
            // ------------------------------------------------------------
            System.out.println("--------------------------------------------------------------------------------");
            System.out.println("STEP 5: Attaching document to part");
            System.out.println("--------------------------------------------------------------------------------");
            String attachType = "Primary"; // "Primary" or "Secondary"
            String role = "Documentation"; // "Representation" or
            // "Documentation"
            String[] docUUIDs = { docUUID1, docUUID2 };
            cntMgmtWrapper.attachDocument(partRefUUID,
                                          docUUIDs,
                                          attachType,
                                          role);
            // ------------------------------------------------------------
            // Step 6 - Check in document
            // ------------------------------------------------------------
            System.out.println("--------------------------------------------------------------------------------");
            System.out.println("STEP 6: Check in document");
            System.out.println("--------------------------------------------------------------------------------");
            String fileName = "CAAFileTestForCntCheckIn.txt";
            String vaultName = "";
            String fileContent = "asasasasasaasasasasaskljadlkfhslkdfhsdlfhklsdh;asdhjl;dfhsdhjksdfhkshjkshjksdhfjksdhfjksd";
            byte[] data = fileContent.getBytes();
            ENOVIA checkInResultSet = cntMgmtWrapper.ckeckIn(docUUID1,
                                                             fileName,
                                                             vaultName,
                                                             data);
            CAAENOVWSUtils.displayResults(checkInResultSet, 1);
            // ------------------------------------------------------------
            // Step 7 - Check out document
            // ------------------------------------------------------------
            System.out.println("--------------------------------------------------------------------------------");
            System.out.println("STEP 7: Check out document");
            System.out.println("--------------------------------------------------------------------------------");
            ENOVIA checkOutResultSet = cntMgmtWrapper.checkOut(docUUID1);
            CAAENOVWSUtils.displayResults(checkOutResultSet, 1);
            success = true;
        } catch (CATServiceExceptionType e) {
            exception = e;
        } catch (Exception e) {
            exception = e;
        } finally {
            // ------------------------------------------------------------
            // Step 4 - Terminate opened session
            // ------------------------------------------------------------
            System.out.println("--------------------------------------------------------------------------------");
            System.out.println("STEP 5: Terminating opened session with ENOVIA LCA V5");
            System.out.println("--------------------------------------------------------------------------------");
            // The session must be closed even if a call to a method on the
            // ENOVWSCntMgmtCpp CAA Web service fails
            try {
                binderWrapper.logout(sessionToken);
            } catch (Exception e) {
                System.err.println("Failed to logout gracefully");
            }
        }
        if (success) {
            System.out.println("================================================================================");
            System.out.println("Use case execution successful");
        } else {
            System.out.println("================================================================================");
            System.out.println("Use case execution failed");
            System.out.println("--------------------------------------------------------------------------------");
            if (exception instanceof CATServiceExceptionType) {
                CATServiceExceptionType e = (CATServiceExceptionType) exception;
                System.out.println("Error code: " + e.getCode());
                System.out.println("Error message: " + e.getMessage1());
                if (e.getErrorArguments() != null) {
                    String[] errorArguments = e.getErrorArguments();
                    System.out.println("Error arguments: " + errorArguments.length);
                    for (int i = 0; i < errorArguments.length; i++) {
                        System.out.println("\tArgument[" + i + "]: " + errorArguments[i]);
                    }
                }
            } else {
                System.out.println(exception.getMessage());
                if (exception.getCause() != null) {
                    // Handle nested exceptions launched from the use case
                    System.out.println("Exception details:");
                    exception.getCause().printStackTrace();
                } else if (exception.getStackTrace() != null && exception.getStackTrace().length != 0) {
                    // Handle unexpected exceptions
                    System.out.println("Exception details:");
                    exception.printStackTrace();
                }
            }
        }
    }
}
 

The CAAENOVWSUtils.displayResults method can be found at:

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

[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 ENOVWSCntMgmtCpp 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 ENOPosApplicationBinderImp CAA Web Service
[3] Building and Launching a CAA Web Service Use Case
[4] Generating a Java Client Binding
[5] Consuming ENOVWSProdStructCpp CAA Web Service
[6] SelectExpression
[Top]

History

Version: 1 [Jun 2005] Document created
Version: 2 [Feb 2006] Document updated
[Top]

Copyright © 1994-2006,  Dassault Systèmes. All rights reserved.