Microsoft KB Archive/173340: Difference between revisions

From BetaArchive Wiki
m (Text replacement - "<" to "<")
m (Text replacement - """ to """)
 
(One intermediate revision by the same user not shown)
Line 44: Line 44:
== SUMMARY ==
== SUMMARY ==


Using Microsoft Message Queue Server (MSMQ) ActiveX components from Java is similar to using any other ActiveX objects from the Java environment. Following are the basic &quot;getting started&quot; steps with Java and MSMQ ActiveX components.
Using Microsoft Message Queue Server (MSMQ) ActiveX components from Java is similar to using any other ActiveX objects from the Java environment. Following are the basic "getting started" steps with Java and MSMQ ActiveX components.


</div>
</div>
Line 53: Line 53:
=== How to Use ActiveX Components from Microsoft Visual J++ 1.1 ===
=== How to Use ActiveX Components from Microsoft Visual J++ 1.1 ===


&quot;Using Java and COM&quot; topic in Visual J++ Books Online describes how to use COM with Java. Visual J++ 1.1 includes several Java/COM samples.
"Using Java and COM" topic in Visual J++ Books Online describes how to use COM with Java. Visual J++ 1.1 includes several Java/COM samples.
=== What MSMQ ActiveX Components are Available ===
=== What MSMQ ActiveX Components are Available ===


Line 64: Line 64:
=== How To Create an MSMQ Application Using Java Applet Wizard ===
=== How To Create an MSMQ Application Using Java Applet Wizard ===


Here are the basic &quot;getting started&quot; steps with Java and MSMQ ActiveX components using Microsoft Visual J++ 1.1, which is included with Microsoft Visual Studio 97. This project shows how to create an MSMQ queue using Java code:<br />
Here are the basic "getting started" steps with Java and MSMQ ActiveX components using Microsoft Visual J++ 1.1, which is included with Microsoft Visual Studio 97. This project shows how to create an MSMQ queue using Java code:<br />
<br />
<br />


<ol>
<ol>
<li><p>Create a basic Visual J++ project using Java Applet Wizard. Select &quot;As an applet only&quot; in Step 1, &quot;HTML file&quot; in Step 2, &quot;multi-threaded&quot; and &quot;no animation&quot; in Step 3, and then click Finish.<br />
<li><p>Create a basic Visual J++ project using Java Applet Wizard. Select "As an applet only" in Step 1, "HTML file" in Step 2, "multi-threaded" and "no animation" in Step 3, and then click Finish.<br />
<br />
<br />
This creates two source files in the project. One is a .java file for the java class and the other is an .html file for VBScript (given below):</p>
This creates two source files in the project. One is a .java file for the java class and the other is an .html file for VBScript (given below):</p>
<pre class="codesample">      <html&gt;
<pre class="codesample">      <html>
       <head&gt;
       <head>
       <title&gt;MQJava</title&gt;
       <title>MQJava</title>
       </head&gt;
       </head>
       <body&gt;
       <body>
       <hr&gt;
       <hr>
       <applet
       <applet
           code=MQJava.class
           code=MQJava.class
           name=MQJava
           name=MQJava
           width=320
           width=320
           height=240 &gt;
           height=240 >
       </applet&gt;
       </applet>
       <hr&gt;
       <hr>
       <a href=&quot;MQJava.java&quot;&gt;The source.</a&gt;
       <a href="MQJava.java">The source.</a>
       </body&gt;
       </body>
       </html&gt;
       </html>
                     </pre></li>
                     </pre></li>
<li>Run &quot;Java Type Library Wizard&quot; on &quot;Microsoft Message Queue Object Library&quot;:<br />
<li>Run "Java Type Library Wizard" on "Microsoft Message Queue Object Library":<br />
<br />
<br />
The MSMQ installation program creates the registry entries for MSMQ ActiveX components and interfaces so that the typelib gets registered. Before building the project, make sure you run the Java Type Library Wizard from the Tools menu in DevStudio IDE. Select &quot;Microsoft Message Queue Object Library&quot; from the list, which creates the .class files in your Winnt\Java\Trustlib\Mqoa folder. The folder also contains a Summary.txt file that contains information about the Java classes derived from the information in the typelib. Make sure you use the method names given in this file for the interface you are using.</li>
The MSMQ installation program creates the registry entries for MSMQ ActiveX components and interfaces so that the typelib gets registered. Before building the project, make sure you run the Java Type Library Wizard from the Tools menu in DevStudio IDE. Select "Microsoft Message Queue Object Library" from the list, which creates the .class files in your Winnt\Java\Trustlib\Mqoa folder. The folder also contains a Summary.txt file that contains information about the Java classes derived from the information in the typelib. Make sure you use the method names given in this file for the interface you are using.</li>
<li><p>Include the following lines near the top of your .java file created by the wizard:</p>
<li><p>Include the following lines near the top of your .java file created by the wizard:</p>
<pre class="codesample">      import mqoa.* ;
<pre class="codesample">      import mqoa.* ;
Line 101: Line 101:
             Variant isWorldReadable;
             Variant isWorldReadable;
             IMSMQQueueInfo qinfo = (IMSMQQueueInfo)new MSMQQueueInfo();
             IMSMQQueueInfo qinfo = (IMSMQQueueInfo)new MSMQQueueInfo();
             qinfo.putPathName(&quot;.\\qJava&quot;);
             qinfo.putPathName(".\\qJava");
             isTransactional = new Variant();
             isTransactional = new Variant();
             isTransactional.putBoolean(false);
             isTransactional.putBoolean(false);
Line 120: Line 120:
<br />
<br />


* &quot;MSMQ Guide'\MSMQ ActiveX Support&quot;
* "MSMQ Guide'\MSMQ ActiveX Support"
* &quot;Using MSMQ'\'Using the ActiveX Components&quot;
* "Using MSMQ'\'Using the ActiveX Components"


(c) Microsoft Corporation 1997, All Rights Reserved. Contributions by Syed Yousuf, Microsoft Corporation
(c) Microsoft Corporation 1997, All Rights Reserved. Contributions by Syed Yousuf, Microsoft Corporation

Latest revision as of 11:06, 21 July 2020

Article ID: 173340

Article Last Modified on 8/28/1999



APPLIES TO

  • Microsoft Message Queue Server 1.0



This article was previously published under Q173340

SUMMARY

Using Microsoft Message Queue Server (MSMQ) ActiveX components from Java is similar to using any other ActiveX objects from the Java environment. Following are the basic "getting started" steps with Java and MSMQ ActiveX components.

MORE INFORMATION

How to Use ActiveX Components from Microsoft Visual J++ 1.1

"Using Java and COM" topic in Visual J++ Books Online describes how to use COM with Java. Visual J++ 1.1 includes several Java/COM samples.

What MSMQ ActiveX Components are Available

Read the information in MSMQ SDK, especially the following topics:

  • MSMQ Guide\MSMQ ActiveX Support
  • Using MSMQ\Using the ActiveX Components

How To Create an MSMQ Application Using Java Applet Wizard

Here are the basic "getting started" steps with Java and MSMQ ActiveX components using Microsoft Visual J++ 1.1, which is included with Microsoft Visual Studio 97. This project shows how to create an MSMQ queue using Java code:

  1. Create a basic Visual J++ project using Java Applet Wizard. Select "As an applet only" in Step 1, "HTML file" in Step 2, "multi-threaded" and "no animation" in Step 3, and then click Finish.

    This creates two source files in the project. One is a .java file for the java class and the other is an .html file for VBScript (given below):

          <html>
          <head>
          <title>MQJava</title>
          </head>
          <body>
          <hr>
          <applet
              code=MQJava.class
              name=MQJava
              width=320
              height=240 >
          </applet>
          <hr>
          <a href="MQJava.java">The source.</a>
          </body>
          </html>
                        
  2. Run "Java Type Library Wizard" on "Microsoft Message Queue Object Library":

    The MSMQ installation program creates the registry entries for MSMQ ActiveX components and interfaces so that the typelib gets registered. Before building the project, make sure you run the Java Type Library Wizard from the Tools menu in DevStudio IDE. Select "Microsoft Message Queue Object Library" from the list, which creates the .class files in your Winnt\Java\Trustlib\Mqoa folder. The folder also contains a Summary.txt file that contains information about the Java classes derived from the information in the typelib. Make sure you use the method names given in this file for the interface you are using.
  3. Include the following lines near the top of your .java file created by the wizard:

          import mqoa.* ;
          import com.ms.com.Variant;
                        
  4. Add the following method to create an MSMQ queue:

          public void CreateQueue()
             {
                Variant isTransactional;
                Variant isWorldReadable;
                IMSMQQueueInfo qinfo = (IMSMQQueueInfo)new MSMQQueueInfo();
                qinfo.putPathName(".\\qJava");
                isTransactional = new Variant();
                isTransactional.putBoolean(false);
                isWorldReadable = new Variant();
                isWorldReadable.putBoolean(false);
                qinfo.Create(isWorldReadable, isTransactional);
             }
                        

Call the method CreateQueue() from Init() method and run MSMQ Explorer to verify that the queue has been created. If the queue already exists (if you run it twice), you will get a Java exception dialog box on the Web page.

REFERENCES

For more information, see the following topics in MSMQ SDK:

  • "MSMQ Guide'\MSMQ ActiveX Support"
  • "Using MSMQ'\'Using the ActiveX Components"

(c) Microsoft Corporation 1997, All Rights Reserved. Contributions by Syed Yousuf, Microsoft Corporation

Keywords: kbhowto kbfaq KB173340