Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Accessing desktop COM components from Java
It was a long wend here so I took a few hours off from my current
endeavours to see if I could solve the problem of remotely accessing the AVS
Web Service from Java. (See discussion under the "Web Services and COBOL
(Fairly long post, but I don't have time to write a proper article on it)"
thread, in this forum).

I can't... :-)  (Well, not yet, anyway...)

Jimmy Gavan kindly converted my Fujitsu COBOL to MicroFocus COBOL  to do
this, Charlie Hottel was looking at some Java approaches, but has more
serious things on his plate at the moment (hope all is going well, Charlie),
and Frank Swarbrick posted a sample of some Java to access an apache web
service and asked if it would be simpler to use the SOAP COM object, as the
COBOL solutions from Jimmy and myself had done.

I want to get COM accessible from Java anyway (there are thousands of useful
COM/ActiveX/OLE components that are part of the Windows Operating system,
apart from any you may have acquired or written yourself - Check your system
with an Object Browser; you have a large amount of stuff you don't know
you've got, and it can do all kinds of interesting and even exciting
things...)

But I also want to use the SOAP Toolkit COM Component (MSSOAP.SOAPCLient30)
to access the AVS web Service running on a server in San Francisco, remotely
from anywhere on Earth, using Java. (We've already cracked it for MicroFocus
and Fujitsu COBOL, C# is a doddle (although for this I don't use SOAP; my C#
solution uses the preferred DotNET services instead), and Java is a language
that quite a few people may want to use.)

Why use Java to access COM?  Many reasons, some not immediately obvious (it
may be a step towards opening up the mainframe to components - it is no
coincidence I am using an IBM supplied Java software package to do it...)

I also believe that if Java can unlock the SOAP Toolkit by using the
supplied COM components, the resulting Java solution would be very simple.
(It is, I just can't get it to work, at the moment -))

OK, so I had a look around the NET and found IBM's Interface Tool Kit called
"Bridge2Java".  This is a Java app that will analyse the Typelib of a COM
component and generate Java Proxies for it, so it can be accessed easily in
Java. Suspending my skepticism, I downloaded it and pointed it at the AVS
engine, which is a COM server .DLL, written in Fujitsu NET COBOL. It was
blazingly fast and childishly easy to use...impressive. It generated a Java
Package and left it in the directory I had specified. I could hardly wait to
knock up some Java and try it. Here's the code....

// Description: This is a Bridge2Java demo.  Bridge2Java is used to enable
COM interfacing from Java,
//              via the Java JNI. The software is downloadable from IBM and
generates a series of proxy
//              classes for the properties and methods in the  target COM
Typelib.
//              The steps are:
//              1. Generate proxies from the COM Typelib.
//              2. Import the proxies into your Java application
//              3. Write your Java app to use the methods and properties of
the COM component.
//
//              This particular code will use the AVS COM component,
AVSCOMSVR.AVSCOMSVR.3,
//              to access the AVS Engine running on the desktop (Address
Validation Services).
//
//
//
// Author:  Pete Dashwood
//

import AVSCOM4Java.*; //This is the set of proxies generated by Bridge2Java

public class AVSCOMSvrAccess
{
public static void main(java.lang.String[] args) {

AVSCOMSVR objCOMSvr;
String inIB = "This is an invalid interface block"; //Should return
an error...
String outIB = "";
String[] IB = {""};
try
{
// Set up the COM environment. (Thanks IBM!)
com.ibm.bridge2java.OleEnvironment.Initialize();

// Instantiate the COM object.
objCOMSvr = new AVSCOMSVR();
System.out.println("Instantiated COM Component");


IB[0] = inIB;
System.out.println("IB[0]=" + IB[0]);

// invoke the Engine
objCOMSvr.FIB(IB); //Uses "Fill in Blanks" Method of AVS and
passes an Interface Block
outIB = IB[0];

// Show what happened...
System.out.println("Returned from AVSCOMSvr=" + outIB);

} catch (com.ibm.bridge2java.ComException e)
{
System.out.println( "COM Exception:" );
System.out.println( Long.toHexString((e.getHResult())) );
System.out.println( e.getMessage() );

} catch (Exception e)
{
System.out.println("message: " + e.getMessage());
} finally
{
objCOMSvr = null;
com.ibm.bridge2java.OleEnvironment.UnInitialize();
}
}
}

Not a lot of code...

To my amazement, it worked instantly :-)

Here's the output it wrote into the DOS Box I ran it in...

Instantiated COM Component
IB[0]=This is an invalid interface block
Returned from AVSCOMSvr=11111The interface block you have
presented to AVS is incorrectly formatted, or contains
invalid content.
Check the value of the INTERFACE-TYPE field.

This is exactly what it should have returned. The interface block was not
structured correctly, as it was in the COBOL examples, and the
INTERFACE-TYPE field was never set.

So, COM components can be easily accessed on the desktop from Java, using
the Bridge2Java component from IBM.

Next stop, the Web Service, using SOAP...

At the moment I can instantiate the SoapClient object, but when I invoke the
"MSSoapInit" method and provide the necessary WSDL, it gives a COM error...

I'm still trying to understand exactly what this error is trying to tell me,
but it involves the SOAP XML and is several lines long so I'll have another
look at it tomorrow. If I can't get it to work, I'll write it as an Applet
and embed it in a web page... that should do it :-)

Pete.




Report this thread to moderator Post Follow-up to this message
Old Post
Pete Dashwood
06-04-07 11:55 PM


Re: Accessing desktop COM components from Java
On Jun 4, 2:40 pm, "Pete Dashwood"
<dashw...@removethis.enternet.co.nz> wrote:

snipped...

>
> But I also want to use the SOAP Toolkit COM Component (MSSOAP.SOAPCLient30
)
> to access the AVS web Service running on a server in San Francisco, remote
ly
> from anywhere on Earth, using Java. (We've already cracked it for MicroFoc
us
> and Fujitsu COBOL, C# is a doddle (although for this I don't use SOAP; my 
C#
> solution uses the preferred DotNET services instead), and Java is a langua
ge
> that quite a few people may want to use.)
>
> Why use Java to access COM?  Many reasons, some not immediately obvious (i
t
> may be a step towards opening up the mainframe to components - it is no
> coincidence I am using an IBM supplied Java software package to do it...)
>
> I also believe that if Java can unlock the SOAP Toolkit by using the
> supplied COM components, the resulting Java solution would be very simple.
> (It is, I just can't get it to work, at the moment -))
>

snipped...

Not sure I see any benefit of doing Java2COM to enable your Java apps
to connect to a remote webservice....
Take a look  at:

http://java.sun.com/developer/techn...s/J2EE/j2ee_ws/

Regards

Andrew


Report this thread to moderator Post Follow-up to this message
Old Post
andrewmcdonagh
06-21-07 02:55 AM


Re: Accessing desktop COM components from Java
"andrewmcdonagh" <andrewmcdonagh@gmail.com> wrote in message
news:1182376697.455356.230840@n60g2000hse.googlegroups.com...
> On Jun 4, 2:40 pm, "Pete Dashwood"
> <dashw...@removethis.enternet.co.nz> wrote:
>
> snipped...
> 
>
> snipped...
>
> Not sure I see any benefit of doing Java2COM to enable your Java apps
> to connect to a remote webservice....
> Take a look  at:
>
> http://java.sun.com/developer/techn...s/J2EE/j2ee_ws/
>
> Regards
>
> Andrew

Andrew, it isn't about accessing web services in Java. I agree that's fairly
straightforward.  The whole point is to enable COM components in Java. The
SOAP thing is just ONE spin-off, and an arguably "unnecessary" one. I've
been too busy with other things to pursue this, but I will when I get time.

Pete.
>



Report this thread to moderator Post Follow-up to this message
Old Post
Pete Dashwood
06-21-07 02:55 AM



Hilary Duff Banged & Cum Swallowing!
http://www.videomoviesonline.com/watch?clip=1673286

Halle Berry gone wild!
http://www.videomoviesonline.com/Me...p?movie=1673286

Jennifer Aniston In Black Licking Snatch In Public!
http://www.videomoviesonline.com/Me....asp?id=1673286

Alyssa Milano Dildos Her Pussy!
http://www.videomoviesonline.com/PlayFile?movie=1673286

Jennifer Aniston shows her pinkhole!
http://www.videomoviesonline.com/Pl...peg?vid=1673286

clip free hunter movie xxx osama bin laden game free sex tube video xxx video matura black movie porno
free anime porn video free XXXX home made video porn sexo star video free gay video daddy portland movie listing
angelina jolie porn movie first time video free xxx porn movie download new song usher caseros espaƱa video xxx
video sesso gay gratis big movie tranny sexy britney spears new video home made mature sex video [ur
l=http://allvideodirect.com/free-movie.html]free movie[/url]

hung lyric madonna up[/
url]
[url=http://allvideodirect.com/teen-porn-movie.html]teen porn movie
frog sex movie
britney 
spears blow job
free hentai movie
bangla music video
michael 
jackson moonwalk
xxx amateur movie
live streaming 
video news
ares descargar
 el gratis

Report this thread to moderator Post Follow-up to this message
Old Post
Aberedterha69
06-21-07 01:56 PM


Re: Accessing desktop COM components from Java
On Jun 21, 12:36 am, "Pete Dashwood"
<dashw...@removethis.enternet.co.nz> wrote:
> "andrewmcdonagh" <andrewmcdon...@gmail.com> wrote in message
>
> news:1182376697.455356.230840@n60g2000hse.googlegroups.com...
>
>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>
> Andrew, it isn't about accessing web services in Java. I agree that's fair
ly
> straightforward.  The whole point is to enable COM components in Java. The
> SOAP thing is just ONE spin-off, and an arguably "unnecessary" one. I've
> been too busy with other things to pursue this, but I will when I get time
.
>
> Pete.
>
>

Oh ok ...I understand.

Regards

Andrew
PS: Been ages since I last visited....how's the OO C# going?


Report this thread to moderator Post Follow-up to this message
Old Post
andrewmcdonagh
06-22-07 02:55 AM


Re: Accessing desktop COM components from Java
"andrewmcdonagh" <andrewmcdonagh@gmail.com> wrote in message
news:1182463212.534723.242990@n60g2000hse.googlegroups.com... 
<snipped>
 
>
> Oh ok ...I understand.
>
> Regards
>
> Andrew
> PS: Been ages since I last visited....how's the OO C# going?
>
Brilliant! Best thing I ever did. Whole new world... online video tutorials,
help that actually helps, Intellisense in the IDE (blows me away every day I
use it :-)) and a straightforward, consistent syntax. I am totally sold on
DotNET/Mono and the FCL.

For Web Development (I am currently udertaking a major one to support my
Address Validation Service engine, which is around 4000 lines of OO COBOL
and has integrated seamlessly and (almost :-)) effortlessly with C# through
the Framework Class Library Interop services), I love the autowired event
processing and pre-compiled code-behind pages so that everything runs
securely on the server. I've been looking at AJAX and may use this for the
next project. It certainly seems like a good way to organise and control
client side code.

A very happy bunny :-)!

Pete.



Report this thread to moderator Post Follow-up to this message
Old Post
Pete Dashwood
06-22-07 02:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 03:16 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.