Microsoft KB Archive/173340: Difference between revisions
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 | 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 === | ||
"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 | 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 | <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 | <pre class="codesample"> <html> | ||
<head | <head> | ||
<title | <title>MQJava</title> | ||
</head | </head> | ||
<body | <body> | ||
<hr | <hr> | ||
<applet | <applet | ||
code=MQJava.class | code=MQJava.class | ||
name=MQJava | name=MQJava | ||
width=320 | width=320 | ||
height=240 | height=240 > | ||
</applet | </applet> | ||
<hr | <hr> | ||
<a href= | <a href="MQJava.java">The source.</a> | ||
</body | </body> | ||
</html | </html> | ||
</pre></li> | </pre></li> | ||
<li>Run | <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 | 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( | qinfo.putPathName(".\\qJava"); | ||
isTransactional = new Variant(); | isTransactional = new Variant(); | ||
isTransactional.putBoolean(false); | isTransactional.putBoolean(false); | ||
Line 120: | Line 120: | ||
<br /> | <br /> | ||
* | * "MSMQ Guide'\MSMQ ActiveX Support" | ||
* | * "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:
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>
- 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. Include the following lines near the top of your .java file created by the wizard:
import mqoa.* ; import com.ms.com.Variant;
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