Sunday, April 9, 2017

Testing WTC EJB via other WL Instance

Picking up from http://awgjournal.blogspot.com/2017/04/testing-wtc-endpoint.html where I successfully set up the samples to connect from a local Tuxedo to the TOLOWER ejb service, I now wanted to unit test the ToLower EJB via another WebLogic instance as described at https://community.oracle.com/thread/817839?db=5 This is so that I can test using a Java client as opposed to a C++ Tuxedo client.

I made a copy of C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples\wtc\atmi\simpapp as C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples\wtc\atmi\simpappwl2wl

Then went in and made changes:

1) change files to point the ToLower remote service rather than the ToUpper
2) change paths to point to a different instance -- a WebLogic 11G instance instead of the 12C instance that's hosting the ToLower service.
3) remove references to Tuxedo since this client app will not use it

The diffs are at https://gist.github.com/awgtek/fa6241219b085799574cf3d4f80ea3e9

I changed to and ran
C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples\wtc\atmi\simpappwl2wl>setExamplesEnv.cmd
> ant ejb
I needed to install the EJB jar from the console because autodeploy didn't pick it up from C:\Oracle\Middleware\user_projects\domains\base_domain\autodeploy.
> ant compile.client

Then I set up the WTC access points. I had already started the WL 11G server from eclipse. I loaded http://localhost:7003/console/ created a new WTC Server. Created a local access point: Access Point Name: LocalAccessPoint-0  Access Point ID: TDOM3 network address: //192.168.56.1:5671
created a remote access point: Access Point: RemoteAccessPoint-0  Access Point ID: TDOM2  Local access Point: LocalAccessPoint-0  network Address: //192.168.56.1:5678 (which is the TDOM2 acess point configured on the 12C server).
Created an Imported resource: TOLOWER  Local access Point: LocalAccessPoint-0  Remote Access Point List: RemoteAccessPoint-0 (remote name: blank)

Then on the WebLogic 12C server localhost:7001/console, I added another remote access point: Access Point: RemoteAccessPoint-0  Access Point ID: TDOM3 local access point: MyLclAccessPt  network address: //192.168.56.1:5671  (192.168.56.1 is a localhost virtual IP)
Then I added the TDOM3 local access point name of the other server as a user just as I had added the TDOM1 Tuxedo domain name as a user under Security Realms, Users and Groups, assigning it the administrators group.

back in the command prompt:
C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\exampl
es\wtc\atmi\simpappwl2wl>ant simpapp
Buildfile: build.xml

simpapp:

run_client:
     [java]
     [java] Beginning statefulSession.Client...
     [java]
     [java] Creating Toupper
     [java]
     [java] converting HelloWorld
     [java] converted to: helloworld
     [java]
     [java] End statefulSession.Client...
     [java]

BUILD SUCCESSFUL
Total time: 4 seconds

And Eclipse outputted in the console:
tolower called, converting HelloWorld
About to call tpcall
tpcall successfull!



No comments:

Post a Comment