CAA Web Services Home |
|
Consuming the ENOVWSQueryCpp CAA Web ServiceUsing the ENOVWSQueryCpp CAA Web Service for query |
Use Case |
AbstractThis article discusses the CAAENOVWSQueryCppAxis1_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 ENOVWSQueryCpp CAA Web service. It provides a sample usage scenario that demonstrates how to query objects from ENOVIA LCA V5. |
This use case demonstrates how to write a client application that consumes the ENOVWSQueryCpp CAA Web service.
It uses queryCount, queryObjects, getObjects
methods within this service as an example. It helps
you to:
This article also provides guidances 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]
CAAENOVWSQueryCppAxis1_3Client is a use case of the CAAENOVWS.edu framework that illustrates the ENOVWSQueryCpp CAA Web service capabilities.
[Top]
The sample usage scenario delivered with this use case contains the following steps:
[Top]
The CAAENOVWSQueryCppAxis1_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 (+ all related classes)<Source>\<Output-package>\holders\ENOVIAHolder.java (+ all related classes)<Source>\<Output-package>\holders\SessionTokenHolder.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 CAAENOVWSQueryCppWrapper class describes how to configure the generated proxy and how to invoke its methods. The CAAENOVWSQueryCppUseCase class demonstrates a sample use case scenario of the ENOVWSQueryCpp CAA Web service. The CAAENOVWSClient class contains the main program. It parses the command line inputs and starts up the use case.
This use case has a dependency on the CustomSessionHandler class which is available in the CAAJAXRPCHTTPSessionHandler.mj module of the CAAWebServices.edu framework. Please refer to [1] for details on HTTP session management and where to find the related class.
This use case has also a dependency on the CAAENOPosAppBinderImplAxis1_3Client use case in order to manage a session with ENOVIA LCA V5. Please refer to [1] for details on where to find the related code.
[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. If there are no ENOVIA_VPMPartVersion (Parts) in the LCA V5 database then this service returns 0. Otherwise, it returns the count of the number of ENOVIA_VPMPartVersion (Parts) in the LCA V5 database.
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 ENOVWSQueryCpp
|
<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 ENOVWSQueryCpp
|
[Top]
The following section first explains how to generate the Java client binding for the ENOVWSQueryCpp 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 [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 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:ENOVWSQueryImpl:ENOVWSQueryImpl:ENOVWSQueryCpp
|
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 CAAENOVWSQueryCppAxis1_3Client Code".
[Top]
In order to be able to consume the ENOVWSQueryCpp CAA Web service implementation that has been
deployed on a target server, you first need to retrieve an instance of the IQueryWSBindingStub
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 IQueryWSBindingStub
class: IQueryWS
. It
describes the available methods for the remote CAA Web service.
Although the IQueryWSBindingStub
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: ENOVWSQueryCppLocator
. It
implements the ENOVWSQueryCpp
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 CAAENOVWSQueryCppWrapper {
|
(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): in order to maintain the HTTP session state between successive calls performed using distinct
proxy instances, a JAX-RPC custom handler must be configured on the proxy. This is mandatory in the context of
ENOVIA LCA V5 CAA Web services. You can refer to [1] for details,
(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 sample value specified in the code is in
milliseconds.
[Top]
Object counts can be queried from ENOVIA LCA V5 based on search criteria. This can be achieved using the following method, which is available through the generated proxy:
public Status queryCount(SelectExpression iSelect, IntHolder oCount)
|
This method accepts the following parameters:
[in] iSelect
|
The SelectExpression for query. See [5] for details |
[in/out] oCount
|
The count of objects matching the input SelectExpression criteria |
The following code demonstrates the use of the queryCount
method:
public class CAAENOVWSQueryCppWrapper {
|
[Top]
Objects can be queried from ENOVIA LCA V5 based on search criteria. This can be achieved using the following method, which is available through the generated proxy:
public Status queryObjects(SelectExpression iSelect, ENOVIAHolder oResult)
|
The method accepts the following parameters:
[in] iSelect
|
The SelectExpression for query. See [5] for details |
[in/out] oResult
|
The objects matching the input SelectExpression criteria |
The following code demonstrates the use of the queryObjects
method:
public class CAAENOVWSQueryCppWrapper {
|
[Top]
Objects can be retrieved from ENOVIA LCA V5 based on given identifiers. This can be achieved using the following method, which is available through the generated proxy:
public Status getObjects(IdentifierArrayType iIds, ENOVIAHolder oResult)
|
The method accepts the following parameters:
[in] iIds
|
The object identifiers |
[in/out] oResult
|
The objects matching the input identifiers |
The following code demonstrates the use of the getObjects
method:
public class CAAENOVWSQueryCppWrapper {
|
The CAAENOVWSUtils.toIdentifierArray
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]
The following code depends on:
It demonstrates a sample usage scenario for the ENOVWSQueryCpp CAA Web service:
public class CAAENOVWSQueryCppUseCase {
|
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 ENOVWSQueryCppCAA Web service. It also gives an overview of the methods available for that particular CAA Web service:
queryCount
: Get a count of the object(s) matching a given select
expression,
queryObjects
: Retrieve the object(s) matching a given select
expression,
getObjects
: Retrieve the object(s) matching a given set of identifiers.
[Top]
Version: 1 [Apr 2005] | Document created |
Version: 2 [Jan 2006] | Document updated |
[Top] |
Copyright © 1994-2006, Dassault Systèmes. All rights reserved.