In order to run the SAP adapter sample, follow the instructions
below.
Before you begin
- Make sure you have a clean workspace.
- You need to obtain these files from your SAP server administrator:
- sapidoc3.jar
- sapjco3.dll
- sapjco3.jar
About this task
After you import the sample:To create and run the
SAP adapter sample:
Procedure
- If the Java™ EE icon,
, does not appear in the top right tab of the workspace,
you need to switch to the Java EE perspective. From the menu bar, select .
- The Select Perspective window opens. Select Java EE.
- Click OK. The Java EE perspective opens.
- Add required file dependencies: Drag and drop sapjco.jar, librfr32.dll, and sapjcorfc.dll from your file system to theconnectorModule folder of the CWYAP_SAPAdapter connector project. Add this file
to the classpath. You can do this in the Properties view for the project.
- To associate the sample with your SAP server, you need
to change the connection information in Bean implementation class.
Open up the CustomerImpl.java in a Java editor, change the following section in
the code to use your SAP server connection information.
/**
* @j2c.managedConnectionFactory class="com.ibm.j2ca.sap.SAPManagedConnectionFactory"
* @j2c.managedConnectionFactory-property name="adapterID" value="001"
* @j2c.managedConnectionFactory-property name="applicationServerHost" value="applicationServerHost"
* @j2c.managedConnectionFactory-property name="client" value="001"
* @j2c.managedConnectionFactory-property name="language" value="EN"
* @j2c.managedConnectionFactory-property name="moduleName" value="BAPI"
* @j2c.managedConnectionFactory-property name="password" value="password"
* @j2c.managedConnectionFactory-property name="userName" value="userName"
* @j2c.connectionSpec class="com.ibm.j2ca.sap.SAPConnectionSpec"
* @generated
*/
- Testing the application:
- Select the Servers View, right-click WebSphere® Application Server v7.0, v8.0,
or v8.5and select Start.
- Select . Click Next.
- On the Java bean
selection page, click Browse.
- On the Find J2C Bean page, Type C in the top text field, and CustomerImpl - sample.bapi shows up in the Matching items field. Select CustomerImpl - sample.bapi and click OK.
- Click Next.
- On the Deployment Information page, select Simple JSP, and click Next.
- On the Simple JSP Creation page, click New to launch the Web project wizard.
- On the New Web Project page, type a name in the Project name field (for example, TestWebProject). Ensure
that Target Runtime selected is WebSphere Application Server
v7.0 or v8.0. Select Add project to an EAR, and click Finish.
- On the Simple JSP Creation page, type a name in the
in the JSP folder field (for example, SampleJSP),
and click Finish..
- When the server is started, navigate to your<Web Project>/WebContent/SampleJSP/TestClient.jsp.
Right-click TestClient.jsp and select .
- The application opens in a web browser. Input a value
and click Invoke.