CAA Web Services Home |
|
Consuming the ENOVWSChgMgmtCpp CAA Web ServiceUsing the ENOVWSChgMgmtCpp CAA Web service For Change Mangement |
Use Case |
AbstractThis article discusses CAAENOVWSChgMgmtAxis1_3CppClient use case. It describes how to use the Java client binding that is generated using the Axis WSDL2Java emitter in order to consume ENOVWSChgMgmtAxis1_3Cpp CAA Web Service. It provides a sample usage scenario that demonstrates how to retrieve Affected Objects from ENOVIA LCA V5. |
This use case is intended to demonstrate how to write a client application that consumes the ENOVWSChgMgmtCpp CAA Web service. It uses the createAction, addAffectedObject, removeAffectedObject, getAffectedObjects, addAssociatedObject, removeAssociatedObject and getAssociatedObjects methods within this service as an example. 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]
CAAENOVWSChgMgmtAxis1_3CppClient is a use case in the CAAENOVWS.edu framework. It illustrates capabilities of the ENOVWSChgMgmtCpp CAA Web service.
[Top]
This use case calls following methods:
createAction method to create an action.
createDocument
method from
ENOVWSCntMgmtCpp CAA Web service to create a
document.[Top]
The CAAENOVWSChgMgmtCppAxis1_3Client 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
|
<Install>
: the directory where the CAA CD-ROM is installed.
The sample Java resources generated using the Axis WSDL2Java emitter are delivered in the following directory (Windows):
<<Source>\<Output-package>>\CATServiceExceptionType.java |
<Source>
:
<Install>\CAAENOVWS.edu\CAAENOVWSAxis1_3Client.mj\src
,
<Install>
: same as above,
<Output-package>
: com\dassault_systemes\caaenovws\caaenovwsaxis1_3client\generated
(based on the output package value specified when using the WSDL2Java emitter).
The CAAENOVWSAxis1_3Client.mj module contains the other following resources:
<Source>\<Root-package>\CAAENOVWSClient.java
|
<Source>
: same as above,
<Root-package>
: com\dassault_systemes\caaenovws\caaenovwsaxis1_3client.
The CAAENOVWSChgMgmtCppWrapper class describes how to configure the generated proxy and how to invoke its methods. The CAAENOVWSChgMgmtCppUseCase class demonstrates a sample use case scenario of the ENOVWSChgMgmtCpp 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 [2] for details on where to find the related code.
[Top]
To launch the CAAENOVWSQueryCppAxis1_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 ENOVWSChgMgmtCpp
|
<URI>
: is the root URI of the Web application where the ENOPosApplicationBinderImpl
CAA Web service is deployed,
<ENOVIA username>
: is a valid username declared in the ENOVIA P&O database,
<Basic Authentication Username> and <Basic Authentication Password>
:
are a valid set of credentials for authentication on the remote Web server.
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 ENOVWSChgMgmtCpp
|
[Top]
The following section first explains how to generate the Java client binding for the ENOVWSChgMgmtCpp CAA Web service demonstrated. The remaining sections then describe the code that must be written in order to consume this Web service:
[Top]
Please refer to [4] 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 ENOVWSQueryCpp 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:ENOVWSChgMgmtImpl:ENOVWSChgMgmtImpl:ENOVWSChgMgmtCpp |
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 CAAENOVWSChgMgmtCppClient Code".
[Top]
In order to be able to consume the ENOVWSChgMgmtCpp CAA Web service
implementation that has been deployed on a target server, you need to retrieve
an instance of the IChgMgmtWSBindingStub
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 IChgMgmtWSBindingStub
class: IChgMgmtWS
. It describes the methods available on the remote
CAA Web service.
Although the
IChgMgmtWSBindingStub
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:
ENOVWSChgMgmtImplLocator
. It implements the ENOVWSChgMgmtCpp
interface.
In order to be able to consume the ENOVWSChgMgmtCpp CAA Web service
implementation that has been deployed on a target server, you need to retrieve
an instance of the IChgMgmtWSBindingStub
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 IChgMgmtWSBindingStub
class: IChgMgmtWS
. It describes the methods available on the remote
CAA Web service.
public class CAAENOVWSChgMgmtCppWrapper { private String SERVICE_ID = "urn:com:dassault_systemes:ENOVWSChgMgmtImpl:ENOVWSChgMgmtImpl:ENOVWSChgMgmtCpp"; private IChgMgmtWS proxy = null; /** * Creates a new proxy for the ENOVWSChgMgmtCpp 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 ENOVWSChgMgmtCpp CAA Web service * @param timeOut the proxy timeout */ public CAAENOVWSChgMgmtCppWrapper(String clientId, String uri, int timeOut) { // Compute the SOAP endpoint URI value that bounds to the deployed // implementation of the ENOVWSChgMgmtCpp CAA Web service String endpoint = uri + "servicerouter?service=" + SERVICE_ID; // Retrieve proxy instance ENOVWSChgMgmtCppLocator locator = new ENOVWSChgMgmtCppLocator(); try { proxy = locator.getENOVWSChgMgmtCppPort(new URL(endpoint)); } catch (MalformedURLException e) { e.printStackTrace(); throw new RuntimeException( "Invalid SOAP endpoint URI specified for the ENOVWSChgMgmtCpp CAA Web service proxy"); } catch (ServiceException e) { e.printStackTrace(); throw new RuntimeException( "Unable to instantiate the ENOVWSChgMgmtCpp CAA Web service proxy"); } // Required for HTTP session state management on the current proxy ((IChgMgmtWSBindingStub) 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.getENOVWSChgMgmtCppPortWSDDServiceName(); QName name = new QName(portName); List chain = registry.getHandlerChain(name); chain.add(info); } // Increase the default client time-out ((IChgMgmtWSBindingStub) 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]
To create action in ENOVIA LCA V5 use the following method, which
is available through the generated IChgMgmtWS
proxy
interface:
Status createAction(ENOVIA iobjects, |
This method accepts the following parameters:
This method accepts the following parameters:
[in] iObjects |
List of actions to be created |
[in/out] oObjects |
The successfully created objects are returned |
The following code demonstrates the use of the createAction
method:
public class CAAENOVWSChgMgmtCppWrapper { .... public ENOVIA createAction(String[] actionNumbers, String domain, String priority) throws Exception { System.out.println(">>> Invoking 'createAction' on ENOVWSChgMgmtCpp CAA Web service proxy"); if (actionNumbers == null) { throw new IllegalArgumentException("Action number array is null"); } else if (domain == null) { throw new IllegalArgumentException("Environment domain is null"); } System.out.println("Environment domain: " + domain); for (int i = 0; i < actionNumbers.length; i++) { System.out.println("Action number[" + i + "]: " + actionNumbers[i]); } // Create input data ENOVIA_Action_Design[] actionDesign = new ENOVIA_Action_Design[actionNumbers.length]; for (int i = 0; i < actionNumbers.length; i++) { actionDesign[i] = new ENOVIA_Action_Design(); actionDesign[i].setDomain(domain); actionDesign[i].setENOVIA_AFLActionV_name(actionNumbers[i]); actionDesign[i].setENOVIA_AFLActionV_priority(priority); } ENOVIA input = new ENOVIA(); input.setENOVIA_Action_Design(actionDesign); ENOVIAHolder resultSet = new ENOVIAHolder(); // Invoke method on remote CAA Web service try { Status status = proxy.createAction(input,resultSet); System.out.println("Status: " + status.getStatus()); } catch (CATServiceExceptionType e) { throw e; } catch (Throwable t) { throw new Exception("Failed to create action(s)", t); } // Process output data if (resultSet == null || resultSet.value == null) { throw new Exception("Failed to create action(s)"); } return resultSet.value; }} |
[Top]
To add 'affected objects' in ENOVIA LCA V5 use the following method, which
is available through the generated IChgMgmtWS
proxy
interface:
Status addAffectedObjects( dIentifier
iActionId, Identifier[] iInputObjectIds Identifier[] iOutputObjectIds) throws RemoteException,
CATServiceExceptionType; |
This method accepts the following parameters:
[in] iActionId |
The identifier of the action |
[in] iInputObjectIds |
List of Input affected objects identifier |
[in] iOutputObjectIds |
List of output affected Object identifier |
The following code demonstrates the use of the addAffectedObjects
method:
public class CAAENOVWSChgMgmtCppWrapper { .... public ENOVIA getAffectedObjects(String ecoUUID, String[] objTypes, String selectExpression) throws Exception { System.out.println(">>> Invoking 'getAffectedObjects' on ENOVWSChgMgmtCpp CAA Web service proxy"); if (ecoUUID == null) { throw new IllegalArgumentException("ECO UUID is null"); } System.out.println("ECO UUID: " + ecoUUID); // Create input data Identifier ecoId = CAAENOVWSUtils.toIdentifier(ecoUUID); SelectExpression selectExp = new SelectExpression(); selectExp.setValue(selectExpression); ENOVIAHolder resultSet = new ENOVIAHolder(); // Invoke method on remote CAA Web service try { Status status = proxy.getAffectedObjects(ecoId, selectExp, objTypes, resultSet); System.out.println("Status: " + status.getStatus()); } catch (CATServiceExceptionType e) { throw e; } catch (Throwable t) { throw new Exception("Failed to get affected object(s)", t); } // Process output data if (resultSet == null || resultSet.value == null) { throw new Exception("Failed to get affected object(s)"); } return resultSet.value; }} |
[Top]
To remove 'affected objects' from ENOVIA LCA V5 use the following method, which
is available through the generated IChgMgmtWS
proxy
interface:
Status removeAffectedObjects(Identifier iActionId, |
This method accepts the following parameters:
[in] iActionId |
The identifier of the action |
[in] iObjfIds |
The list of to be removed affected object identifiers |
The following code demonstrates the use of the removeAffectedObjects
method:
public class CAAENOVWSChgMgmtCppWrapper { .... public void removeAffectedObject( String actionUUID, String[] affectedObjUUIDs) throws Exception { System.out.println(">>> Invoking 'removeAffectedObjects' on ENOVWSChgMgmtCpp CAA Web service proxy"); if (actionUUID == null) { throw new IllegalArgumentException("Action UUID is null"); } System.out.println("Action UUID: " + actionUUID); // Create input data Identifier actionID = CAAENOVWSUtils.toIdentifier(actionUUID); Identifier[] affectedObjIDs = CAAENOVWSUtils.toIdentifierArray(affectedObjUUIDs); // Invoke method on remote CAA Web service try { Status status = proxy.removeAffectedObject(actionID, affectedObjIDs); System.out.println("Status: " + status.getStatus()); } catch (CATServiceExceptionType e) { throw e; } catch (Throwable t) { throw new Exception("Failed to remove affected object(s)", t); }} |
[Top]
To get 'affected objects' from ENOVIA LCA V5 use the following method, which
is available through the generated IChgMgmtWS
proxy
interface:
Status getAffectedObjects(Identifier iObjectId, |
This method accepts the following parameters:
[in] iObjectId |
The identifier of the target EC object |
[in] iSelect |
Select Expression subscribing to the attributes to be returned on the result set 'affected objects'. See [5] for details on SelectExpression |
[in] iObjTypes |
List of affected object types (eg., Documents, Part Instance, Part Version, Product) to be returned. If this list is empty all affected objects will be returned |
[in/out] oResult |
Return affected object list |
The following code demonstrates the use of the getAffectedObjects
method:
public class CAAENOVWSChgMgmtCppWrapper { .... public ENOVIA getAffectedObjects(String ecoUUID, String[] objTypes, String selectExpression) throws Exception { System.out.println(">>> Invoking 'getAffectedObjects' on ENOVWSChgMgmtCpp CAA Web service proxy"); if (ecoUUID == null) { throw new IllegalArgumentException("ECO UUID is null"); } System.out.println("ECO UUID: " + ecoUUID); // Create input data Identifier ecoId = CAAENOVWSUtils.toIdentifier(ecoUUID); SelectExpression selectExp = new SelectExpression(); selectExp.setValue(selectExpression); ENOVIAHolder resultSet = new ENOVIAHolder(); // Invoke method on remote CAA Web service try { Status status = proxy.getAffectedObjects(ecoId, selectExp, objTypes, resultSet); System.out.println("Status: " + status.getStatus()); } catch (CATServiceExceptionType e) { throw e; } catch (Throwable t) { throw new Exception("Failed to get affected object(s)", t); } // Process output data if (resultSet == null || resultSet.value == null) { throw new Exception("Failed to get affected object(s)"); } return resultSet.value; }} |
[Top]
To add associated objectsin ENOVIA LCA V5 use the following method, which is
available through the generated IChgMgmtWS
proxy interface:
Status addAssocitedObjects(I dentifier
iActionId, dentifier iObjectId, IIdentifier[] iModIds) throws RemoteException,
CATServiceExceptionType; |
This method accepts the following parameters:
[in] iActionId |
The identifier of the action |
[in] iInputObjectIds |
List of Input associated objects identifier |
[in] iModIds |
List of mods |
The following code demonstrates the use of the addAssociatedObjects
method:
public class CAAENOVWSChgMgmtCppWrapper { .... public void addAssociatedObject(String actionUUID, String toAssociateObjUUID, String[] modUUIDs) throws Exception { System.out.println(">>> Invoking 'addAssociatedObjects' on ENOVWSChgMgmtCpp CAA Web service proxy"); if (actionUUID == null) { throw new IllegalArgumentException("Action UUID is null"); } System.out.println("Action UUID: " + actionUUID); // Create input data Identifier actionID = CAAENOVWSUtils.toIdentifier(actionUUID); Identifier toAssociateObjIDs = CAAENOVWSUtils.toIdentifier(toAssociateObjUUID); Identifier[] modIDs = CAAENOVWSUtils.toIdentifierArray(modUUIDs); // Invoke method on remote CAA Web service try { Status status = proxy.addAssociatedObject(actionID, toAssociateObjIDs, modIDs); System.out.println("Status: " + status.getStatus()); } catch (CATServiceExceptionType e) { throw e; } catch (Throwable t) { throw new Exception("Failed to add associated object(s)", t); } }} |
[Top]
To remove associated objects from ENOVIA LCA V5 use the following method, which
is available through the generated IChgMgmtWS
proxy
interface:
Status removeAssociatedObjects( Identifier
iActionId, Identifier[] iObjectIds) throws RemoteException,
CATServiceExceptionType; |
This method accepts the following parameters:
[in] iObjectId |
The identifier of the action object |
[in] iObjectIds |
Return associated object list |
The following code demonstrates the use of the removeAssociatedObject
method:
public class CAAENOVWSChgMgmtCppWrapper { .... public void removeAssociatedObject( String actionUUID, String[] objsToRemove) throws Exception { System.out.println(">>> Invoking 'addAssociatedObjects' on ENOVWSChgMgmtCpp CAA Web service proxy"); if (actionUUID == null) { throw new IllegalArgumentException("Action UUID is null"); } System.out.println("Action UUID: " + actionUUID); // Create input data Identifier actionID = CAAENOVWSUtils.toIdentifier(actionUUID); Identifier[] objsToRemoveIDs = CAAENOVWSUtils.toIdentifierArray(objsToRemove); // Invoke method on remote CAA Web service try { Status status = proxy.removeAssociatedObject(actionID, objsToRemoveIDs); System.out.println("Status: " + status.getStatus()); } catch (CATServiceExceptionType e) { throw e; } catch (Throwable t) { throw new Exception("Failed to remove associated object(s)", t); } }} |
[Top]
To get 'associated objects' from ENOVIA LCA V5 use the following method, which
is available through the generated IChgMgmtWS
proxy
interface:
Status getAssociatedObjects(Identifier iObjectId, |
This method accepts the following parameters:
[in] iObjectId |
The identifier of the target EC object |
[in] iSelect |
Select Expression subscribing to the attributes to be returned on the result set 'affected objects'. See [5] for details on SelectExpression |
[in/out] oResult |
Return associated object list |
The following code demonstrates the use of the getAssociatedObjects
method:
public class CAAENOVWSChgMgmtCppWrapper { .... public ENOVIA getAssociatededObjects(String actionUUID, tring selectExpression) throws Exception { System.out.println(">>> Invoking 'getAssociatededObjects' on ENOVWSChgMgmtCpp CAA Web service proxy"); if (actionUUID == null) { throw new IllegalArgumentException("ECO UUID is null"); } System.out.println("ACTION UUID: " + actionUUID); // Create input data Identifier actionId = CAAENOVWSUtils.toIdentifier(actionUUID); SelectExpression selectExp = new SelectExpression(); selectExp.setValue(selectExpression); ENOVIAHolder resultSet = new ENOVIAHolder(); // Invoke method on remote CAA Web service try { Status status = proxy.getAssociatedObjects(actionId, selectExp, resultSet); System.out.println("Status: " + status.getStatus()); } catch (CATServiceExceptionType e) { throw e; } catch (Throwable t) { throw new Exception("Failed to get associated object(s)", t); } // Process output data if (resultSet == null || resultSet.value == null) { throw new Exception("Failed to get associated object(s)"); } return resultSet.value; }} |
[Top]
The following code depends on:
It demonstrates a sample usage scenario for the ENOVWSChgMgmtCpp CAA Web service:
public class CAAENOVWSChgMgmtCppUseCase { private String uri = null; private String credUser = null; private String credPwd = null; public CAAENOVWSChgMgmtCppUseCase(String uri, String credUser, String credPwd) { this.uri = uri; this.credUser = credUser; this.credPwd = credPwd; } public void runSampleUsageScenario(String enoviaUser) { // Prerequisites: // From an LCA Client: // - create a configured Product, // - create an Engineering Change Order (ECO) named // "GetAffectedObjectsUseCase_ECO", // - add an Action Item to the ECO, // - associate the configured Product to the Action, assign Effectivity // (say '1 - infinity') // - associate the Action to the configured Product, // - insert two Instances (of Items) under the Product, // The two Item Instances are automatically included as Associated // Objects on the ECO 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); CAAENOVWSChgMgmtCppWrapper chgMgmtWrapper = new CAAENOVWSChgMgmtCppWrapper( clientId, uri, timeOut); CAAENOVWSCntMgmtCppWrapper cntMgmtWrapper = new CAAENOVWSCntMgmtCppWrapper( 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:"); for (int i = 0; i < userContexts.length; i++) { System.out.println("Context[" + i + "]: " + userContexts[i]); } if (userContexts.length == 0) { throw new Exception("No context found for the user specified"); } sessionToken = binderWrapper.login(userContexts[0]); // ------------------------------------------------------------ // Step 3 - Change management use case : Create Action // ------------------------------------------------------------ System.out.println("--------------------------------------------------------------------------------"); System.out.println("STEP 3: Creating Action"); System.out.println("--------------------------------------------------------------------------------");String carAction = "Action design CAR" + clientId; String[] actionID = {carAction}; actionID[0] = carAction; String actionDomain = "APLAFL"; String actionPriority = "Routine";ENOVIA newAction = chgMgmtWrapper.createAction( actionID, actionDomain, actionPriority);String[] newActionUUIDs = chgMgmtWrapper.getENOVIA_Action_DesignUUIDs(newAction); if (newActionUUIDs.length != 1) { throw new Exception("Failed to create action" + newActionUUIDs); }// keep this for now /// String newActionUUID = newActionUUIDs[0]; // keep this for now ///CAAENOVWSUtils.displayResults(newAction, 1);// ------------------------------------------------------------ // Step 4 - Change management use case : Create Document // ------------------------------------------------------------System.out.println("--------------------------------------------------------------------------------"); System.out.println("STEP 4: Creating document"); System.out.println("--------------------------------------------------------------------------------");String docId1 = "CAR Owners manual" + clientId; String docName1 = "CAA Client" + docId1; String docDomain = "DOCDIR";ENOVIA createDocResultSet1 = cntMgmtWrapper.createDocument( docId1, docName1, docDomain);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);// ------------------------------------------------------------ // Step 5 - Change management use case : Create PV // ------------------------------------------------------------ System.out.println("--------------------------------------------------------------------------------"); System.out.println("STEP 5: Creating PV"); System.out.println("--------------------------------------------------------------------------------");String envDomain = "PRODUCT";String configurable = "FALSE"; String partNumber1 = "CAR Axle" + clientId;String[] partNumbers = { partNumber1 };// Create the one part references ENOVIA createPartRefResultSet = prodStructWrapper.createPartRef(partNumbers, envDomain, configurable);String[] partRefUUIDs = prodStructWrapper.getENOVIA_VPMPartVersionUUIDs(createPartRefResultSet); if (partRefUUIDs.length > 1) { throw new Exception( "Invalid state: more than 1 part references were returned"); } else if (partRefUUIDs.length != 1) { throw new Exception("Failed to create the 1 part references"); } String partRefUUID1 = partRefUUIDs[0];CAAENOVWSUtils.displayResults(createPartRefResultSet, 1);// ------------------------------------------------------------ // Step 6 - Change management use case : Add Affected Object // ------------------------------------------------------------ System.out.println("--------------------------------------------------------------------------------"); System.out.println("STEP 6: Add Affected Object"); System.out.println("--------------------------------------------------------------------------------");String[] inputAO = {partRefUUID1}; String[] outputAO = {docUUID1};chgMgmtWrapper.addAffectedObject(newActionUUID,inputAO,outputAO);// ------------------------------------------------------------ // Step 7 - Get affected objects // ------------------------------------------------------------ System.out.println("--------------------------------------------------------------------------------"); System.out.println("STEP 7: Getting affected objects"); System.out.println("--------------------------------------------------------------------------------");String[] objTypes = null;ENOVIA affectedObjectsResultSet = chgMgmtWrapper.getAffectedObjects(newActionUUID, objTypes, null);CAAENOVWSUtils.displayResults(affectedObjectsResultSet, 2);String[] affectedObjectUUID = chgMgmtWrapper.getENOVIA_Input_Associated_ObjectUUIDs(affectedObjectsResultSet);// ------------------------------------------------------------ // Step 8 - Change management use case : Remove Affected Object // ------------------------------------------------------------ System.out.println("--------------------------------------------------------------------------------"); System.out.println("STEP 8: Remove Affected Object"); System.out.println("--------------------------------------------------------------------------------");chgMgmtWrapper.removeAffectedObject(newActionUUID,affectedObjectUUID);// ------------------------------------------------------------ // Step 9 - Get affected objects // ------------------------------------------------------------ System.out.println("--------------------------------------------------------------------------------"); System.out.println("STEP 9: Getting affected objects"); System.out.println("--------------------------------------------------------------------------------");//String[] objTypes = null;ENOVIA affectedObjectsResultSet1 = chgMgmtWrapper.getAffectedObjects(newActionUUID, objTypes, null); CAAENOVWSUtils.displayResults(affectedObjectsResultSet1, 1); success = true; } catch (CATServiceExceptionType e) { exception = e; } catch (Exception e) { exception = e; } finally { // ------------------------------------------------------------ // Step Final - Terminate opened session // ------------------------------------------------------------ System.out.println("--------------------------------------------------------------------------------"); System.out.println("STEP Final : Terminating opened session with ENOVIA LCA V5"); System.out.println("--------------------------------------------------------------------------------"); // The session must be closed even if a call to a method on the // ENOVWSChgMgmtCpp 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.getMessage()); 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
|
<Install>
: the root directory where the CAA CD-ROM is installed,
<Source>
: \CAAENOVWS.edu\CAAENOVWSAxis1_3Client.mj\src,
<Package>\com\dassault_systemes\caaenovws\caaenovwsaxis1_3client
.
[Top]
This use case explains how to use the Java client binding generated using the Axis WSDL2Java emitter in order to consume the ENOVWSChgMgmtCpp CAA Web service. It also gives an overview of the methods available for ENOVWSChgMgmtCpp web services:
createAction
: Creates action(s)
from input replica and returns the created action Attributes-Values in
output replica. getAffectedObjects
:
Returns a list of objects that are affected by an Engineering Change/Action. [Top]
[6] | Consuming ENOVWSProdStructCpp CAA Web Service |
[7] | Consuming ENOVWSCntMgmtCpp CAA Web Service |
[Top] |
Version: 1 [June 2005] | Document created |
Version: 2 [Feb 2006] | Document updated |
[Top] |
Copyright © 1994-2006, Dassault Systèmes. All rights reserved.