Home : J-Integra for .NET : HOWTO : How to Access .NET Objects as Singletons Hosted in IIS
Q55093 - HOWTO: How to Access .NET Objects as Singletons Hosted in IIS

How to Access .NET Objects as Singletons Hosted in IIS

 

This article will help you get started if you are having problems accessing your Singleton object hosted in IIS from your Java client.

As an example, the Accessing .NET Components Hosted in Internet Information Server (IIS) from Java example will be converted to a Singleton to be accessed by the Java client. The first step is to verify that this example works - please follow the instructions provided by the link. Next, to change the example to a Singleton follow the steps below:

  1. Modify web.config located in J-Integra\.NET\examples\java_iis\HelloWorldServer to replace:
    <service>
      <activated type="HelloWorld.HelloWorldClass, HelloWorld"/>
    </service>
    
    with:
    <service>
      <wellknown mode="Singleton" objectUri="HelloWorld.HelloWorldClass.soap" type="HelloWorld.HelloWorldClass, HelloWorld"/>
    </service>
    
    This changes the type of remoting from Client Activated Objects (CAO's) to Server Activated Objects (SAO's). A Singleton in .NET is a type of SAO.


  2. In Janetor, change the Activation Mode to Web Services and the Channel Format to SOAP. Here is a screenshot of the changes to make in Janetor:

     


  3. When accessing SAO's from Java, Ja.NET forms the URL to look for the hosted object as follows:

    http://[URI from Janetor]/[namespace].[class name].soap

    Given the settings in Janetor (see screenshot) and that the namespace is HelloWorld and the class to access is HelloWorldClass, the URL will be:

    http://localhost/HelloWorld/HelloWorld.HelloWorldClass.soap

    This must be reflected in the web.config file - this is the reason why HelloWorld.HelloWorldClass.soap was entered for the objectUri attribute. In general, for Ja.NET to access the SAO, the objectUri attribute in web.config must be of the form:

    [namespace].[class name].soap

That is all there is to it! Try running the client again, and you should get the same results. Both server and client code stays the same - you do not need to modify any code. Also, note that IIS does not need to be restarted after the modifications to web.config.

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 6/23/2006.
Last Modified on 7/10/2006.
Last Modified by No Author Name Available!.
Article has been viewed 6997 times.
Rated 7 out of 10 based on 8 votes.
Print Article
Email Article