CAA Web Services Home

 

Consuming the ENOVWSConcEngCpp CAA Web Service

Using the ENOVWSConcEngCpp CAA Web Service for concurrent engineering management
Use Case

Abstract

This article discusses the CAAENOVWSConcEngCppAxis1_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 ENOVWSConcEngCpp CAA Web service. It provides a sample usage scenario that demonstrates how to lock, unlock, getLock and transferOwnership of objects (Part Version, Part Instance and 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 ENOVWSConcEngCpp 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 CAAENOVWSConcEngCppAxis1_3Client Use Case

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

[Top]

What Does CAAENOVWSConcEngCppAxis1_3Client Do

The sample usage scenario performs the following actions:

[Top]

Where To Find the CAAENOVWSConcEngCppClient Code

The CAAENOVWSConcEngCppClient 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>\ENOVWSConcEngCpp.java
<Source>\<Output-package>\IConcEngWS.java
<Source>\<Output-package>\ENOVWSConcEngCppLocator.java
<Source>\<Output-package>\IConcEngWSBindingStub.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\ObjectLockInfoHolder.java
<Source>\<Output-package>\holders\ObjectLockInfoArrayTypeHolder.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>\CAAENOVWSConcEngCppUseCase.java
<Source>\<Root-package>\CAAENOVWSConcEngCppWrapper.java

The CAAENOVWSConcEngCppWrapper class describes how to configure the generated proxy and how to invoke its methods. The CAAENOVWSConcEngCppUseCase class demonstrates a sample use case scenario of the ENOVWSConcEngCpp 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 CAAENOVWSConcEngCppClient

To launch the CAAENOVWSConcEngCppAxis1_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 ENOVWSConcEngCpp -n <Newowner.Organization.Project>

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

-w http://stophe1dsy.dsy.ds:9080/B18 -e auser -u wpsadmin -p wpsadmin -t ENOVWSConcEngCpp -n TACR.ADMIN.DEFAULT

[Top]

Step-by-step

The following section first explains how to generate the Java client binding for the ENOVWSConcEngCpp 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. Lock ENOVIA V5 Objects
  4. Unlock ENOVIA V5 Objects
  5. GetLock of ENOVIA V5  Objects
  6. TransferOwnership of ENOVIA V5 Objects
  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 ENOVWSConcEngpp 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/B18/wsdl?service=urn:com:dassault_systemes:ENOVWSConcEngImpl:ENOVWSConcEngImpl:ENOVWSConcEngCpp

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 CAAENOVWSConcEngCppClient 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 ENOVWSConcEngCpp 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: ENOVWSConcEngCppLocator. It implements the ENOVWSConcEngCpp 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 CAAENOVWSConcEngCppWrapper {
    private String SERVICE_ID = "urn:com:dassault_systemes:ENOVWSConcEngImpl:ENOVWSConcEngImpl:ENOVWSConcEngCpp";
    private IConcEngWS proxy = null;
    /**
     * Creates a new proxy for the ENOVWSConcEngCpp 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 ENOVWSConcEngCpp CAA Web service
     * @param timeOut the proxy timeout
     */
    public CAAENOVWSConcEngCppWrapper(String clientId, String uri, int timeOut) {
        // Compute the SOAP endpoint URI value that bounds to the deployed
        // implementation of the ENOVWSConcEngCpp CAA Web service
        String endpoint = uri + "servicerouter?service=" + SERVICE_ID;
        // Retrieve proxy instance
        ENOVWSConcEngCppLocator locator = new ENOVWSConcEngCppLocator();
        try {
            proxy = locator.getENOVWSConcEngCppPort(new URL(endpoint));
        } catch (MalformedURLException e) {
            e.printStackTrace();
            throw new RuntimeException(
                    "Invalid SOAP endpoint URI specified for the ENOVWSConcEngCpp CAA Web service proxy");
        } catch (ServiceException e) {
            e.printStackTrace();
            throw new RuntimeException(
                    "Unable to instantiate the ENOVWSConcEngCpp CAA Web service proxy");
        }
        // Required for HTTP session state management on the current proxy
        ((IConcEngWSBindingStub) 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.getENOVWSConcEngCppPortWSDDServiceName();
            QName name = new QName(portName);
            List chain = registry.getHandlerChain(name);
            chain.add(info);
        }
        // Increase the default client time-out
        ((IConcEngWSBindingStub) 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]

Lock ENOVIA V5 Objects

ENOVIA LCA V5 Objects (Part and Document) can be locked using the following method, which is available through the generated IConcEngWS proxy interface:

public Status lock(Identifier[] iObjectIds)
  throws RemoteException, CATServiceExceptionType

This method accepts the following parameters:

[in] iObjects  Array of Identifiers
[out] Status  Return the status

The following code demonstrates the use of the lock method:

public class CAAENOVWSConcEngCppWrapper {
 ....
	public void lock(String[] ids)
		throws Exception {
		System.out.println(">>> Invoking 'lock' on ENOVWSConcEngCpp CAA Web service proxy");
		if (ids == null) {
			throw new IllegalArgumentException(
					"object UUID array is null");
		}
		// Create input data
		Identifier[] idents = CAAENOVWSUtils.toIdentifierArray(ids);
	
		// Invoke method on remote CAA Web service
		try {
			Status status = proxy.lock(idents);
			System.out.println("Status: " + status.getStatus());
		} catch (CATServiceExceptionType e) {
			throw e;
		} catch (Throwable t) {
			throw new Exception("Failed to lock objects", t);
		}
	} 
}

[Top]

Unlock ENOVIA  V5 Objects

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

public Status unlock(Identifier[] iObjectIds)
  throws RemoteException, CATServiceExceptionType

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

This method accepts the following parameters:

[in] iObjects  Array of Identifiers
[out] Status  Return the status

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

public class CAAENOVWSConcEngCppWrapper {
.....
	public void unlock(String[] ids)
		throws Exception {
		System.out.println(">>> Invoking 'unlock' on ENOVWSConcEngCpp CAA Web service proxy");
		if (ids == null) {
			throw new IllegalArgumentException(
					"object UUID array is null");
		}
		// Create input data
		Identifier[] idents = CAAENOVWSUtils.toIdentifierArray(ids);
	
		// Invoke method on remote CAA Web service
		try {
			Status status = proxy.unlock(idents);
			System.out.println("Status: " + status.getStatus());
		} catch (CATServiceExceptionType e) {
			throw e;
		} catch (Throwable t) {
			throw new Exception("Failed to unlock objects", t);
		}
	}
}
 

[Top]

GetLock of ENOVIA V5 Objects

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

ublic Status getLock(SessionToken iSessionToken,
  Identifier[] iObjectIds,
  ObjectLockInfoArrayTypeHolder oLockInfos) throws RemoteException, CATServiceExceptionType

This method accepts the following parameters:

[in] iSessionToken  The session token
[in] iObjectIds  The array of object identifiers
[in/out] oLockInfos  arrays of object lock information

The following code demonstrates the use of the getLock method:

public class CAAENOVWSConcEngCppWrapper {
.....
	public ObjectLockInfo[] getLock(String[] ids)
		throws Exception {
		System.out.println(">>> Invoking 'lock' on ENOVWSConcEngCpp CAA Web service proxy");
		if (ids == null) {
			throw new IllegalArgumentException(
					"object UUID array is null");
		}
		// Create input data
		SessionToken token = new SessionToken();  //place holder not used
		Identifier[] idents = CAAENOVWSUtils.toIdentifierArray(ids);
	
		// Invoke method on remote CAA Web service
		try {
			ObjectLockInfoArrayTypeHolder lockHolder = new ObjectLockInfoArrayTypeHolder();
			Status status = proxy.getLock(token, idents, lockHolder);
			System.out.println("Status: " + status.getStatus());
			return lockHolder.value;
		} catch (CATServiceExceptionType e) {
			throw e;
		} catch (Throwable t) {
			throw new Exception("Failed to getLock", t);
		}
	}	
}
 

[Top]

TransferOwnership of ENOVIA  V5 Objects

ENOVIA LCA V5 Object lock information can be obtained using the following method, which is available through the generated IConcEngWS proxy interface:

public Status transferOwnership(SessionToken iSessionToken,
  ObjectLockInfo[] iObjOwners,
  boolean iSendEmail) throws RemoteException, CATServiceExceptionType

This method accepts the following parameters:

[in] iSessionToken  session token
[in] iObjOwners  array of object lock new owner infromation
[in] iSendEmail flag to or not to send email
[out]  Status

 

The following code demonstrates the use of the transferOwnership method:

public class CAAENOVWSConcEngCppWrapper {
    ........
	public void transferOwnership(ObjectLockInfo [] lockInfos)
		throws Exception {
		System.out.println(">>> Invoking 'transferOwnership' on ENOVWSConcEngCpp CAA Web service proxy");
		if (lockInfos== null) {
			throw new IllegalArgumentException(
					"object lock info is null");
		}
		// Create input data
		SessionToken token = new SessionToken();  //place holder not used
		// Invoke method on remote CAA Web service
		try {
			Status status = proxy.transferOwnership(token, lockInfos, false);
			System.out.println("Status: " + status.getStatus());
		} catch (CATServiceExceptionType e) {
			throw e;
		} catch (Throwable t) {
			throw new Exception("Failed to transferownership", t);
		}
	}		
}
 

[Top]

Sample Usage Scenario

The sample usage scenario consumes following CAA web services:

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

public class CAAENOVWSConcEngCppUseCase {
    private String uri = null;
    private String credUser = null;
    private String credPwd = null;
    public CAAENOVWSConcEngCppUseCase(String uri,
                                      String credUser,
                                      String credPwd) {
        this.uri = uri;
        this.credUser = credUser;
        this.credPwd = credPwd;
    }
    public void runSampleUsageScenario(String enoviaUser, String newOwnerStr) {
        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);
            CAAENOVWSConcEngCppWrapper concEngWrapper = new CAAENOVWSConcEngCppWrapper(
                    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 = "CAAWSConc1" + 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 = "CAAWSConc2" + 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 = "CAAWSConcPrt" + 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 1&2 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 1");
            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 - lock document 2
            // ------------------------------------------------------------
            System.out.println("--------------------------------------------------------------------------------");
            System.out.println("STEP 7: lock document2 ");
            System.out.println("--------------------------------------------------------------------------------");
            
            String[] docIDs = { docUUID2 };
            concEngWrapper.lock(docIDs);
            // ------------------------------------------------------------
            // Step 8 - getLock of doc1, doc2 (locked) and partRef
            // ------------------------------------------------------------
            System.out.println("--------------------------------------------------------------------------------");
            System.out.println("Step 8 - getLock of doc1, doc2 (locked) and partRef ");
            System.out.println("--------------------------------------------------------------------------------");
 
            String[] objIDs = { docUUID1, docUUID2, partRefUUID};
            ObjectLockInfo lockInfos []= concEngWrapper.getLock(objIDs);
            
            CAAENOVWSUtils.displayLockInfo(lockInfos);
            // ------------------------------------------------------------
            // Step 9 - transfer  doc1 and partRef ownership
            // ------------------------------------------------------------
            System.out.println("--------------------------------------------------------------------------------");
            System.out.println("Step 9 - transfer  doc1 and partRef ownership ");
            System.out.println("--------------------------------------------------------------------------------");
  	            
            StringTokenizer sToken = new StringTokenizer(newOwnerStr);
            String user = sToken.nextToken(".");
            String org = sToken.nextToken(".");
            String proj = sToken.nextToken(".");
            System.out.println("user="+user+" org="+org+" proj="+proj);
            
            ObjectLockInfo doclock1 = new ObjectLockInfo();
            doclock1.setObjID(CAAENOVWSUtils.toIdentifier(docUUID1));
            doclock1.setUser(user);
            doclock1.setProject(proj);
            doclock1.setOrganization(org);            
           
            ObjectLockInfo partLock2 = new ObjectLockInfo();
            partLock2.setObjID(CAAENOVWSUtils.toIdentifier(partRefUUID));
            partLock2.setUser(user);
            partLock2.setProject(proj);
            partLock2.setOrganization(org);             
         
            ObjectLockInfo newlockInfo[] = {doclock1, partLock2};
            concEngWrapper.transferOwnership(newlockInfo);
            
            // ------------------------------------------------------------
            // Step 10 - getLock of doc1, and partRef to show new user 
            // ------------------------------------------------------------
            System.out.println("--------------------------------------------------------------------------------");
            System.out.println("Step 10 - getLock of doc1, and partRef to see new owner");
            System.out.println("--------------------------------------------------------------------------------");
            String[] newObjIDs = { docUUID1, partRefUUID};
            ObjectLockInfo lockInfos2 []= concEngWrapper.getLock(newObjIDs);
            
            CAAENOVWSUtils.displayLockInfo(lockInfos2);
                
            // ------------------------------------------------------------
            // Step 11 - unlock doc2
            // ------------------------------------------------------------           
            System.out.println("--------------------------------------------------------------------------------");
            System.out.println("Step 11 - unlock doc2");
            System.out.println("--------------------------------------------------------------------------------");
            String[] docIDs2 = { docUUID2 };
            concEngWrapper.unlock(docIDs2);          
            
            success = true;
        } catch (CATServiceExceptionType e) {
            exception = e;
        } catch (Exception e) {
            exception = e;
        } finally {
            // ------------------------------------------------------------
            // Step 12 - Terminate opened session
            // ------------------------------------------------------------
            System.out.println("--------------------------------------------------------------------------------");
            System.out.println("STEP 12: Terminating opened session with ENOVIA LCA V5");
            System.out.println("--------------------------------------------------------------------------------");
            // The session must be closed even if a call to a method on the
            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.displayLockInfo 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 ENOVWSConcEngCpp 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
[7] Consuming ENOVWSCntMgmtCpp CAA Web Service
   
[Top]

History

Version: 1 [Dec 2006] Document created
   
[Top]

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