CAA Web Services Home

 

Consuming the ENOVWSChgMgmtCpp CAA Web Service

Using the ENOVWSChgMgmtCpp CAA Web service for change management
Use Case

Abstract

This article discusses the CAAENOVWSDotNet1_1Client use case. It describes how to use the C# client binding that can be generated using the wsdl.exe utility in order to consume the ENOVWSChgMgmtCpp CAA Web service. It provides a sample usage scenario that demonstrates how to handle lifecycle management.


What You Will Learn With This Use Case

This use case demonstrates how to write a client application that consumes the ENOVWSCntMgmtCpp CAA Web service. It helps you to:

[Top]

The CAAENOVWSDotNet1_1Client Use Case

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

[Top]

What Does CAAENOVWSDotNet1_1Client Do

This use case calls following methods:

[Top]

Where To Find the CAAENOVWSDotNet1_1Client Code

The CAAENOVWSDotNet1_1Client use case is made of several classes located in both CAAENOVWSDotNet1_1Client.m and CAAENOVWSDotNet1_1ClientBase.m modules of the CAAENOVWS.edu framework:

<Install>\CAAENOVWS.edu\CAAENOVWSDotNet1_1Client.m\src
<Install>\CAAENOVWS.edu\CAAENOVWSDotNet1_1ClientBase.m\src

The CAAENOVWSDotNet1_1ClientBase.m module (library) contains the following resources:

<Source>\CAAENOVWSChgMgmtCppProxy.cs
<Source>\CAAENOVWSChgMgmtCppWrapper.cs
<Source>\CAAENOVWSUtils.cs

The CAAENOVWSChgMgmtCppProxy.cs file contains the C# client binding generated using the wsdl.exe utility. A C# client binding consists of a proxy and several types definitions. The CAAENOVWSChgMgmtCppWrapper.cs file contains a class that describes how to configure the generated proxy and how to invoke its methods.

The CAAENOVWSDotNet1_1Client.m module (executable) contains the following resources:

<Source>\CAAENOVWSDotNet1_1Client.cs
<Source>\CAAENOVWSChgMgmtCppUseCase.cs

The CAAENOVWSDotNet1_1Client.cs file contains the main program. It parses the command line inputs and starts up the use case. The CAAENOVWSChgMgmtCppUseCase.cs file contains the sample use case scenario.

[Top]

How to Launch CAAENOVWSDotNet1_1Client

To run the CAAENOVWSDotNet1_1Client use case, you will need to build both CAAENOVWSDotNet1_1ClientBase.m and CAAENOVWSDotNet1_1Client.m modules. The use case code can be built using either the CAA V5 buildtime environment, or Visual Studio .NET 2003 as explained in [1].

You can then execute the command described below:

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

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

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

The same executable is used to launch all of the available ENOVIA CAA Web services use cases. The -t option is used to choose the target use case to run.

When building the modules with the CAA V5 buildtime environment, the CAAENOVWSDotNet1_1Client executable can be launched from the following location:

<Install>\CAAENOVWS.edu\intel_a\code\clr

[Top]

Step-by-step

The following section first explains how to generate the C# client binding for the ENOVWSChgMgmtCpp CAA Web service demonstrated. The remaining sections describe how to configure the generated proxy and how to consume the Web service:

  1. Creating the C# Client Binding
  2. Instantiating and Configuring the Generated Proxy
  3. Creating Action
  4. Adding Affected Objects
  5. Removing Affected Objects
  6. Retrieving Affected Objects
  7. Adding Associated Objects
  8. Removing Associated Objects
  9. Retrieving AssociatedObjects
  10. Sample Usage Scenario

[Top]

Creating the C# Client Binding

Please refer to [2] for details on how to generate the C# client binding using the wsdl.exe utility.

Here follows a sample command in order to generate the C# client binding for the ENOVWSChgMgmtCpp CAA Web service:

wsdl /namespace:com.dassault_systemes.caaenovws.caaenovwsdotnet1_1clientgen.enovwschgmgmtcpp /username:wpsadmin /password:wpsadmin /out:CAAENOVWSChgMgmtCppProxy.cs http://stophe1dsy.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 ENOVWSChgMgmtCpp CAA Web service has been deployed. The /username and /username options are required to authenticate on the Web server hosting the Web service.

[Top]

Instantiating and Configuring the Generated Proxy

In order to consume an implementation of the ENOVWSChgMgmtCpp CAA Web service deployed on a target Web server, you first need to instantiate the proxy generated using the wsdl.exe utility. This proxy must then 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.

The generated proxy class is used in order to marshall method calls and objects to SOAP requests, and to unmarshall SOAP responses to objects. The following code describes how to instantiate and configure it:

public class CAAENOVWSChgMgmtCppWrapper {
   private const string SERVICE_ID = "urn:com:dassault_systemes:ENOVWSChgMgmtImpl:ENOVWSChgMgmtImpl:ENOVWSChgMgmtCpp";
   private CAAENOVWSChgMgmtCppProxy proxy = null;
   public CAAENOVWSChgMgmtCppWrapper(
	CookieContainer container, 
	string uri, 
	string credUser, 
	string credPwd,
	int timeOut) {
	proxy = new CAAENOVWSChgMgmtCppProxy();
	// Compute the SOAP endpoint URI value that bounds to the deployed implementation of the 
	// ENOVWSChgMgmtCpp CAA Web service
	proxy.Url = uri + "servicerouter?service=" + SERVICE_ID;
	// Required for HTTP session state management
	proxy.CookieContainer = container;
	// Required for the Basic Authentication mechanism
	ICredentials credentials = new NetworkCredential(credUser, credPwd);
	proxy.Credentials = credentials; 
	// Increase the default client time-out
	proxy.Timeout = timeOut;
  }
}

(1): in order to maintain the HTTP session state between successive calls performed using either the same or multiple proxy instances, the CookieContainer property must be set on the proxy. This is mandatory in the context of ENOVIA LCA V5 CAA Web services,
(2): when security is enabled on the remote Web server, it is mandatory to set the Credentials property on the proxy. The values specified must match a valid set of credentials for the Basic Authentication mechanism,
(3): the default timeout value can be increased in order to avoid potential issues at runtime, such as losing the HTTP connection before receiving the SOAP responses. The value specified in the code is in milliseconds.

[Top]

Creating Action

To create action in ENOVIA LCA V5 use the following method, which is available through the generated IChgMgmtWS proxy interface: 

Status createAction(ENOVIA iobjects,
 ENOVIAHolder oObjects) throws RemoteException, CATServiceExceptionType;

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) {
	Console.Out.WriteLine(">>> Invoking 'createAction' on ENOVWSChgMgmtCpp CAA Web service proxy");
	if (actionNumbers == null) {
		throw new ApplicationException("Action number array is null");
	} else if (domain == null) {
		throw new ApplicationException("Environment domain is null");
	} 
	Console.Out.WriteLine("Environment domain: " + domain);
	for (int i = 0; i < actionNumbers.Length; i++) {
		Console.Out.WriteLine("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].Domain = domain;
		actionDesign[i].ENOVIA_AFLActionV_name = actionNumbers[i];
		actionDesign[i].ENOVIA_AFLActionV_priority = priority;
	}
	ENOVIA input = new ENOVIA();
	input.ENOVIA_Action_Design = actionDesign;
	ENOVIA resultSet = null;
	// Invoke method on remote CAA Web service
	try {
		Status status = proxy.CreateAction(input, ref resultSet);
		Console.Out.WriteLine("Status: " + status.Status1);
	} catch (Exception e) {
		throw new Exception("Failed to create action(s)", e);
	}
	// Process output data
	if (resultSet == null) {
		throw new Exception("Failed to create action(s)");
	}
	return resultSet;
  }

}

[Top]

Adding Affected Objects

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) {
	Console.Out.WriteLine(">>> Invoking 'GetAffectedObjects' on ENOVWSChgMgmtCpp CAA Web service proxy");
	if (ecoUUID == null) {
		throw new ApplicationException("Illegal argument: ECO UUID is null"); 
	}
	Console.Out.WriteLine("ECO UUID: {0}", ecoUUID);
	// Create input data
	Identifier ecoId = ToIdentifier(ecoUUID);
	SelectExpression selectExp = new SelectExpression();
	selectExp.Value = selectExpression;
	ENOVIA resultSet = null;
	// Invoke method on remote CAA Web service
	try {
		Status status = proxy.GetAffectedObjects(ecoId, selectExp, objTypes, ref resultSet);
		Console.Out.WriteLine("Status: {0}", status.Status1);
	} catch (Exception e) {
		throw new ApplicationException("Failed to get affected object(s)", e);
	}
	// Process output data
	if (resultSet == null) {
		throw new ApplicationException("Failed to get affected object(s)");
	}
	return resultSet;
  }
}

[Top]

Removing Affected Objects

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,
  Identifier[] iObjIds) throws RemoteException, CATServiceExceptionType;

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) {
	Console.Out.WriteLine(">>> Invoking 'removeAffectedObjects' on ENOVWSChgMgmtCpp CAA Web service proxy");
	if (actionUUID == null) {
		throw new ApplicationException("Action UUID is null");
	}
	Console.Out.WriteLine("Action UUID: " + actionUUID);
	// Create input data
	Identifier actionID = ToIdentifier(actionUUID);
	Identifier[] affectedObjIDs = ToIdentifierArray(affectedObjUUIDs);
		
	// Invoke method on remote CAA Web service
	try {
		Status status = proxy.RemoveAffectedObject(actionID,
							affectedObjIDs);
		Console.Out.WriteLine("Status: " + status.Status1);
	} catch (Exception e) {
		throw new Exception("Failed to remove affected object(s)", e);
	}		
  }
}

[Top]

Retrieving Affected Objects

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,
  SelectExpression iSelect,
  StringArrayType iObjTypes,
  ENOVIAHolder oResult) throws RemoteException, CATServiceExceptionType;

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 [3] 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) {
	Console.Out.WriteLine(">>> Invoking 'GetAffectedObjects' on ENOVWSChgMgmtCpp CAA Web service proxy");
	if (ecoUUID == null) {
		throw new ApplicationException("Illegal argument: ECO UUID is null"); 
	}
	Console.Out.WriteLine("ECO UUID: {0}", ecoUUID);
	// Create input data
	Identifier ecoId = ToIdentifier(ecoUUID);
	SelectExpression selectExp = new SelectExpression();
	selectExp.Value = selectExpression;
	ENOVIA resultSet = null;
	// Invoke method on remote CAA Web service
	try {
		Status status = proxy.GetAffectedObjects(ecoId, selectExp, objTypes, ref resultSet);
		Console.Out.WriteLine("Status: {0}", status.Status1);
	} catch (Exception e) {
		throw new ApplicationException("Failed to get affected object(s)", e);
	}
	// Process output data
	if (resultSet == null) {
		throw new ApplicationException("Failed to get affected object(s)");
	}
	return resultSet;
  }
}

[Top]

Adding Associated Objects

To add associated objectsin ENOVIA LCA V5 use the following method, which is available through the generated IChgMgmtWS proxy interface: 

Status addAssocitedObjects(Identifier 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) {
	Console.Out.WriteLine(">>> Invoking 'addAssociatedObjects' on ENOVWSChgMgmtCpp CAA Web service proxy");
	if (actionUUID == null) {
		throw new ApplicationException("Action UUID is null");
	}
	Console.Out.WriteLine("Action UUID: " + actionUUID);
	// Create input data
	Identifier actionID = ToIdentifier(actionUUID);
	Identifier toAssociateObjIDs = ToIdentifier(toAssociateObjUUID);
	Identifier[] modIDs = ToIdentifierArray(modUUIDs);
	// Invoke method on remote CAA Web service
	try {
		Status status = proxy.AddAssociatedObject(actionID,
							toAssociateObjIDs,
							modIDs);
		Console.Out.WriteLine("Status: " + status.Status1);
	} catch (Exception e) {
		throw new Exception("Failed to add associated object(s)", e);
	}	
  }
}

[Top]

Removing Associated Objects

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)  {
	Console.Out.WriteLine(">>> Invoking 'addAssociatedObjects' on ENOVWSChgMgmtCpp CAA Web service proxy");
	if (actionUUID == null) {
		throw new ApplicationException("Action UUID is null");
	}
	Console.Out.WriteLine("Action UUID: " + actionUUID);
	// Create input data
	Identifier actionID = ToIdentifier(actionUUID);
	Identifier[] objsToRemoveIDs = ToIdentifierArray(objsToRemove);
	// Invoke method on remote CAA Web service
	try {
		Status status = proxy.RemoveAssociatedObject(	actionID,
								objsToRemoveIDs);
		Console.Out.WriteLine("Status: " + status.Status1);
	} catch (Exception e) {
		throw new Exception("Failed to remove associated object(s)", e);
	}	
  }
}

[Top]

Retrieving Associated Objects

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,
  SelectExpression iSelect,
  ENOVIAHolder oResult) throws RemoteException, CATServiceExceptionType;

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 [3] 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,
	                                 String selectExpression){
	Console.Out.WriteLine(">>> Invoking 'getAssociatededObjects' on ENOVWSChgMgmtCpp CAA Web service proxy");
	if (actionUUID == null) 
	{
		throw new ApplicationException("ECO UUID is null");
	}
	Console.Out.WriteLine("ACTION UUID: " + actionUUID);
	// Create input data
	Identifier actionId = ToIdentifier(actionUUID);
	SelectExpression selectExp = new SelectExpression();
	selectExp.Value = selectExpression;
	ENOVIA resultSet = null;
	// Invoke method on remote CAA Web service
	try 
	{
		Status status = proxy.GetAssociatedObjects(actionId, selectExp,  ref resultSet);
		Console.Out.WriteLine("Status: {0}", status.Status1);
	} 
	catch (Exception e) 
	{
		throw new ApplicationException("Failed to get associated object(s)", e);
	}
	// Process output data
	if (resultSet == null) 
	{
		throw new ApplicationException("Failed to get associated object(s)");
	}
	return resultSet;
  }
}

[Top]

Sample Usage Scenario

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) {
	bool success = false;
	Exception exception = null;
	enoposapplicationbinderimpl.CAAENOPosApplicationBinderImplWrapper binderWrapper = null;
	enoposapplicationbinderimpl.SessionToken sessionToken = null;
	try {
	// ------------------------------------------------------------
	// Step 1 - Instantiate and configure the proxies
	// ------------------------------------------------------------
	Console.Out.WriteLine("STEP 1: Instantiating and configuring CAA Web services proxies");
		
	// Create a CookieContainer object to maintain the HTTP session state accross proxies
	CookieContainer container = new CookieContainer();
	// Instantiate the wrapper client classes
	int timeOut = 360000;
	binderWrapper = 
	  new enoposapplicationbinderimpl.CAAENOPosApplicationBinderImplWrapper
	  (container, uri, credUser, credPwd, timeOut);
	enovwsquerycpp.CAAENOVWSQueryCppWrapper queryWrapper = 
	  new enovwsquerycpp.CAAENOVWSQueryCppWrapper
	 (container, uri, credUser, credPwd, timeOut);
	enovwschgmgmtcpp.CAAENOVWSChgMgmtCppWrapper chgMgmtWrapper = 
	  new enovwschgmgmtcpp.CAAENOVWSChgMgmtCppWrapper
	  (container, uri, credUser, credPwd, timeOut);
	enovwscntmgmtcpp.CAAENOVWSCntMgmtCppWrapper cntMgmtWrapper = 
	  new enovwscntmgmtcpp.CAAENOVWSCntMgmtCppWrapper
	  (container, uri, credUser, credPwd, timeOut);
	enovwsprodstructcpp.CAAENOVWSProdStructCppWrapper prodStructWrapper = 
	  new enovwsprodstructcpp.CAAENOVWSProdStructCppWrapper
	  (container, uri, credUser, credPwd, timeOut);
	// ------------------------------------------------------------
	// Step 2 - Open session with ENOVIA LCA V5
	// ------------------------------------------------------------
	Console.Out.WriteLine("--------------------------------------------------------------------------------");
	Console.Out.WriteLine("STEP 2: Opening session with ENOVIA LCA V5");
	Console.Out.WriteLine("--------------------------------------------------------------------------------");
	// Get user contexts
	string[] userContexts = binderWrapper.GetUserContexts(enoviaUser);
	Console.Out.WriteLine("Found {0} context(s) in database", userContexts.Length);
	Console.Out.WriteLine("Displaying list of available contexts:");
	for (int i = 0; i < userContexts.Length; i++) {
		Console.Out.WriteLine("Context[{0}]: {1}", i, userContexts[i]);
	}
	// Log in using the first available context
	if (userContexts.Length == 0) {
		throw new ApplicationException("No context found for the user specified");
	}
	sessionToken = binderWrapper.Login(userContexts[0]);
	// ------------------------------------------------------------
	// Step 3 - Change management use case : Create Action
	// ------------------------------------------------------------
	Console.Out.WriteLine("--------------------------------------------------------------------------------");
	Console.Out.WriteLine("STEP 3: Creating Action");
	Console.Out.WriteLine("--------------------------------------------------------------------------------");
	long t=System.DateTime.Now.Ticks;        
	String uniqueStr = t.ToString();
	String carAction = "Action design CAR" + uniqueStr;
	String[] actionID = {carAction};
	actionID[0] = carAction;
	String actionDomain = "APLAFL";
	String actionPriority = "Routine";
			
	enovwschgmgmtcpp.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);
	}
		
	String newActionUUID = newActionUUIDs[0];
 			
	CAAENOVWSUtils.DisplayResults(newAction, 1);
	// ------------------------------------------------------------
	// Step 4 - Change management use case : Create Document
	// ------------------------------------------------------------
	Console.Out.WriteLine("----------------------------------------------------------------------------");
	Console.Out.WriteLine("STEP 4: Creating  document");
	Console.Out.WriteLine("----------------------------------------------------------------------------");
	String docId1 = "CAR Owners manual" + uniqueStr;
	String docName1 = "CAA Client" + docId1;
	String docDomain = "DOCDIR";
	enovwscntmgmtcpp.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
	// ------------------------------------------------------------
	Console.Out.WriteLine("-----------------------------------------------------------------------------");
	Console.Out.WriteLine("STEP 5: Creating  PV");
	Console.Out.WriteLine("-----------------------------------------------------------------------------");
			
	String envDomain = "PRODUCT";
	String configurable = "FALSE";
	String partNumber1 = "CAR Axle" + uniqueStr;
	String[] partNumbers = { partNumber1 };
	// Create the one part references
	enovwsprodstructcpp.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
	// ------------------------------------------------------------
	Console.Out.WriteLine("----------------------------------------------------------------------------");
	Console.Out.WriteLine("STEP 6: Add Affected Object");
	Console.Out.WriteLine("----------------------------------------------------------------------------");
			
	String[] inputAO = {partRefUUID1};
	String[] outputAO = {docUUID1};
			
	chgMgmtWrapper.AddAffectedObject(newActionUUID,inputAO,outputAO);	
		
        Console.Out.WriteLine("----------------------------------------------------------------------------");
	Console.Out.WriteLine("STEP 7: Getting affected objects");
	Console.Out.WriteLine("------------------------------------------------------------------------------");
        String[] objTypes = null;
	
	enovwschgmgmtcpp.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
	// ------------------------------------------------------------
	Console.Out.WriteLine("--------------------------------------------------------------------------------");
	Console.Out.WriteLine("STEP 8: Remove Affected Object");
	Console.Out.WriteLine("--------------------------------------------------------------------------------");
			
	chgMgmtWrapper.RemoveAffectedObject(newActionUUID,affectedObjectUUID);	       
			
	// ------------------------------------------------------------
	// Step 9 - Get affected objects
	// ------------------------------------------------------------
	Console.Out.WriteLine("--------------------------------------------------------------------------------");
	Console.Out.WriteLine("STEP 9: Getting affected objects");
	Console.Out.WriteLine("--------------------------------------------------------------------------------");
	enovwschgmgmtcpp.ENOVIA affectedObjectsResultSet1 = 
				                    chgMgmtWrapper.GetAffectedObjects(newActionUUID,
									objTypes,null);
	CAAENOVWSUtils.DisplayResults(affectedObjectsResultSet1, 1);			    
	success = true;
	} catch (Exception e) {
		exception = e;
	} finally {
	// ------------------------------------------------------------
	// Step 10 - Terminate opened session
	// ------------------------------------------------------------
	Console.Out.WriteLine("--------------------------------------------------------------------------------");
	Console.Out.WriteLine("STEP 10: Terminating opened session with ENOVIA LCA V5");
	Console.Out.WriteLine("--------------------------------------------------------------------------------");
	// The session must be closed even if a call to a method on the ENOVWSQueryCpp 
	// CAA Web service fails
	binderWrapper.Logout(sessionToken);
	}
			
	if (success) {
		Console.Out.WriteLine("================================================================================");
		Console.Out.WriteLine("Use case execution successful");
		Console.Out.Flush();
		Console.Out.Close();
		Environment.Exit(0);
	} else {
		Console.Out.Flush();
		Console.Out.Close();
		Console.Error.WriteLine("================================================================================");
		Console.Error.WriteLine("Use case execution failed");
		Console.Error.WriteLine(exception.Message);
		Console.Error.WriteLine("Details:");
		if (exception.InnerException != null) {
			Console.Error.WriteLine(exception.InnerException); // handles ApplicationException launched from the use case
		} else {
			Console.Error.WriteLine(exception); // handles unexpected exception
		}
		Console.Error.Flush();
		Console.Error.Close();
		Environment.Exit(-1);
	}
  }
}
 

The CAAENOVWSUtils.DisplayResults method can be found at:

<Source>\CAAENOVWSUtils.cs

[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 ENOVWSChgMgmtCpp CAA Web service. It also gives an overview of the methods available for ENOVWSChgMgmtCpp web services:

[Top]


References

[1] Building and Launching a CAA Web Service Use Case
[2] Generating a C# Client Binding
[3] Using SelectExpression
[4] Consuming the ENOPosApplicationBinderImpl CAA Web Service
[5] Consuming the ENOVWSProdStructCpp CAA Web Service
[6] Consuming the ENOVWSCntMgmtCpp CAA Web Service
   
[Top]

History

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

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