Hyderabad Jobs Book Website FREE PowerBuilder Training I Love Hyderabad Hyderabad Colleges
Home Business Emails Hyderabad Classifieds Contact Us
7 Wonders of Hyderabad Web Hosting Yellow Pages Our Network

 
Webpowerbuilder.hyderabad-colleges.com

Mastering PowerBuilder

HomePrevious Lesson: Connecting from Client App to Middle Tier App
Next Lesson: CORBA

Testing Distributed Applications

Once you complete both the client and server applications, create the executable file at least for the server application. Before you run the server application, you need to make an entry for your application in the 'services' file located under your MS-Windows installation directory. For our application make the following entry.
PMSServer	11000/tcp

In case 11000 is already existing in the 'services' file on your system, use another number that is not in use. Make sure you hit ENTER button at the end of the above entry in the services file. Please note that, those two entries are separated by a TAB. Now, run the server application first and start the server and run the client application either from the development environment using RUN icon or create executable and run it.

If you have just only one machine and want to test both the client and server applications on the same machine, then you have couple of options. The first one is being to use 'Local' driver in the Connection object. When you do this, Listen() and few other functions will fail and you need to comment them before testing starts. When you use 'Local' driver, PowerBuilder takes care of everything such as listening to the client requests and connecting to the server internally. I believe this may not be a perfect test at all.

The next one is to use 'LocalHost' driver when you test under Windows 95/NT. These two operating systems do maintain a loop-back TCP/IP connection where the local machine acts as the host also. This option is really good for testing distributed PB applications and also when you use personal web servers to create and/or test web applications. To check whether loop-back service is setup or not, open 'hosts' file located under your MS-Windows installation directory and check whether it has the following entry:
127.0.0.1	localhost

If you decide to test using the LocalHost option, replace Winsock with LocalHost in all the code explained so far in this session or in the registry entries for the DPB. Once testing is done, then reverse that and deploy the application. While testing the server application please note that any MessageBox() dialog boxes that you fire in the server code will display on the server machine. Well, here you can see them since both the applications are running on the same machine, however, it will not be possible when you deploy the app. In that case, you may want to write a generic function to write a message to a log file and call that function instead of MessageBox() and check the log file later.

The following listing is from the log file logged when the server started with All=1 trace option. You can see all the server options it is using when it started including the driver, server and service names.
SMI10 Listener  (049A0548): Start Listening: computerName(localhost), serviceName(PMSServer), driverName(WinSock). ... (00000000)
SMI      Property: __DriverName='WinSock'
SMI      Property: __ApplicationName='PMSServer'
SMI      Property: __Location='localhost'
SMI      Property: __Options='BufSize=2,MaxRetry=2,NoDelay=0,RawData=1'
SMI      Property: BufSize='2'
SMI      Property: MaxRetry='2'
SMI      Property: NoDelay='0'
SMI      Property: RawData='1'
SMI   AddRef  SMI_TRACE(02715AF8) refCount(2)
WSD11 AddRef: RefCount for listener object = 1
WSD11 AddRef: RefCount for listener object = 2
WSD11 AddRef: RefCount for listener object = 3
WSD11 AddRef: RefCount for listener object = 4
WSD11 AddRef: RefCount for listener object = 5
SMI10 Listener  (049A0548): Start Listening: computerName(localhost), serviceName(PMSServer), driverName(WinSock). SUCCEEDED (00000000)
DPB30 Listener  (030B5290): Start Listening : application(PMSServer), location(localhost), driver(WinSock). SUCCEEDED (00000000)

The following listing is the server log created when the client application connected to the server. Recall that we have written code to connect to the server from the Application Open event. You can observe that the userid is logged but not the password.
DPB20 Connection(07C50810): ClientConnect   : Administrator(CC304138-A) userId(DBA), connectString(), sessionId(06CC01A0). SUCCEEDED (00000000)
DPB   Release DPB_SESSION_SERVICE(07C50120) refCount(2)
SMI06 Connection(07C50810): Process request Message: (06CC01F8) serviceId(0), sequenceNumber(57). SUCCEEDED (00000000)
SMI01 Connection(07C50810): Create Message: (05C20020), initial size 0 bytes
SMI03 Connection(07C50810): Send Reply Message: (05C20020) sequenceNumber(57) Asynchronous. ... (00000000) WSD08 Send: result = 0
SMI03 Connection(07C50810): Send Reply Message: (05C20020) sequenceNumber(57) Asynchronous. SUCCEEDED (00000000)

The following listing is the server log created when we created ncst_product_master instance on the server.
SMI01 Connection(07C50810): Create Message: (06CC0848), initial size 161 bytes
DPB   AddRef  DPB_SESSION_SERVICE(07C50120) refCount(2)
DPB40 SessionId (06CC01A0): Handle Request: CREATE_INSTANCE(3), streamVer(0). SUCCEEDED (00000000)
DPB   AddRef  DPB_SESSION_SERVICE(07C50120) refCount(3)
DPB   Release DPB_SESSION_SERVICE(07C50120) refCount(2)
SMI06 Connection(07C50810): Process request Message: (06CC0848) serviceId(0), sequenceNumber(59). SUCCEEDED (00000000)
DPB43 SessionId (06CC01A0): Create Object : className(ncst_product_master), instanceId(00000000). ... (00000000)
SMI01 Connection(07C50810): Create Message: (05C20020), initial size 0 bytes
SMI03 Connection(07C50810): Send Reply Message: (05C20020) sequenceNumber(59) Asynchronous. ... (00000000)
WSD08 Send: result = 0
SMI03 Connection(07C50810): Send Reply Message: (05C20020) sequenceNumber(59) Asynchronous. SUCCEEDED (00000000)

The following listing is the server log created when we called of_Retrieve() on the remote object.
SMI06 Connection(07C50810): Process request Message: (06CC0848) serviceId(0), sequenceNumber(61). SUCCEEDED (00000000)
DPB   AddRef  DPB_MARSHALING(05C20A30) refCount(1)
DPB   AddRef  DPB_MARSHALING(05C20A30) refCount(2)
  Read Invoke Request: 316.of_retrieve(LRO)
    Read Reference:
      asClassName():
      Read BLOB: length(0)
DPB48 SessionId (06CC01A0): Invoke        : instanceId(0000013C), of_retrieve(LRO), numArgs(1) SYNCHRONOUS	SUCCEEDED (00000000)
SMI01 Connection(07C50810): Create Message: (05C20730), initial size 0 bytes
  Write Invoke Reply:
    Write LONG: value(5)
    Write Returned Reference Args: (1)
      Write BLOB: length(38788)
SMI03 Connection(07C50810): Send Reply Message: (05C20730) sequenceNumber(61) Asynchronous. ... (00000000)
WSD08 Send: result = 0
SMI03 Connection(07C50810): Send Reply Message: (05C20730) sequenceNumber(61) Asynchronous. SUCCEEDED (00000000)

The first part in the above message has details about the called function and its arguments. You can observe the BLOB object sent to of_Retrieve() has zero bytes. The second part has details about the reply where the BLOB object has about 38K size. The last line has the result of the method invocation.

The following listing is from the server log that was logged in response to the of_Update(). You can see from the listing that the object instance (id 316) is still the same since we haven't destoryed it.
SMI06 Connection(07C50810): Process request Message: (06CC0848) serviceId(0), sequenceNumber(63). SUCCEEDED (00000000)
SMI   AddRef  SMI_TRACE(02715AF8) refCount(6)
DPB   AddRef  DPB_MARSHALING(05C20A30) refCount(1)
DPB   AddRef  DPB_MARSHALING(05C20A30) refCount(2)
  Read Invoke Request: 316.of_update(LRO)
    Read Reference:
      asClassName():
      Read BLOB: length(262)
DPB48 SessionId (06CC01A0): Invoke        : instanceId(0000013C), of_update(LRO), numArgs(1) SYNCHRONOUS SUCCEEDED (00000000)
SMI01 Connection(07C50810): Create Message: (05C20730), initial size 0 bytes
  Write Invoke Reply:
    Write LONG: value(1)
    Write Returned Reference Args: (1)
      Write BLOB: length(164)
SMI03 Connection(07C50810): Send Reply Message: (05C20730) sequenceNumber(63) Asynchronous. ... (00000000)
WSD08 Send: result = 0
SMI03 Connection(07C50810): Send Reply Message: (05C20730) sequenceNumber(63) Asynchronous. SUCCEEDED (00000000)

This section concludes building Distributed PowerBuilder applications using DPB technology. The next section takes you to the next level of n-tier computing using Jaguar Application server, CORBA and SSL protocols.
HomePrevious Lesson: Connecting from Client App to Middle Tier App
Next Lesson: CORBA

Copyright © 1996 - 2006 HamaraShehar.com Pvt. Ltd. All Rights Reserved.
Domain Registration, Website Design, Website Hosting by HamaraShehar.com