You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Eric BELLARD <eb...@improve.fr> on 2002/10/17 14:52:21 UTC

How to use the Java2WSDL class inside a java program

Hi,

I'm building a Axis plugin for the IDE eclipse and I've got some problems.
One of the functionnality I'd like to include in the plugin is to 
generate a WSDL file from a selected Java class.
I'd like to use the Java2WSDL class for that.
I'd like to execute the method run of the Java2WSDL class. The problem 
with this method is that it's not that, it proceeds a "System.exit(1)" 
and it kills my eclipse!

The only way I see is to use a "Runtime.getRuntime().exec(...)" to 
execute a command like that:

Is there a way to walk around?
Is there plan to change the implementation of the Java2WSDL class to be 
easily used by another classes?

Thanks in advance.


Re: How to use the Java2WSDL class inside a java program

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Grant Echols (JanusLogix)" <ge...@januslogix.com>
To: <ax...@xml.apache.org>
Sent: Thursday, October 17, 2002 12:57 PM
Subject: Re: How to use the Java2WSDL class inside a java program


> Steve,
>
> I couldn't agree more! - main() should do a System.exit() so that its
> results can be tested.
>
> However, the System.exit() isn't coming from main(), its being called from
> inside the run(String[] args) method. If this had only done a return with
a
> result code then the main() could easily have done the System.exit() with
> the return code and we could be using the run method. This would give me a
> method I could call from inside my tool (as others are also trying to do)
> and yet would still return the results to Ant, batch file, whatever.
>
> I'm sorry this was taken as just complaining. I'd prefer that it generated
> some action to improve the code that appears to be biting more than just
me.
> If this isn't the open source way then I admit I'm a newbie and just
trying
> to get my job done.
>
> Thanks,
>
> Grant
>

I see your point. But just talk to the Emitter class and be done with it, in
my opinion. You get better error handling that way.


Re: How to use the Java2WSDL class inside a java program

Posted by "Grant Echols (JanusLogix)" <ge...@januslogix.com>.
Steve,

I couldn't agree more! - main() should do a System.exit() so that its
results can be tested.

However, the System.exit() isn't coming from main(), its being called from
inside the run(String[] args) method. If this had only done a return with a
result code then the main() could easily have done the System.exit() with
the return code and we could be using the run method. This would give me a
method I could call from inside my tool (as others are also trying to do)
and yet would still return the results to Ant, batch file, whatever.

I'm sorry this was taken as just complaining. I'd prefer that it generated
some action to improve the code that appears to be biting more than just me.
If this isn't the open source way then I admit I'm a newbie and just trying
to get my job done.

Thanks,

Grant

----- Original Message -----
From: "Steve Loughran" <st...@iseran.com>
To: <ax...@xml.apache.org>
Sent: Thursday, October 17, 2002 11:04 AM
Subject: Re: How to use the Java2WSDL class inside a java program


>
> ----- Original Message -----
> From: "Grant Echols (JanusLogix)" <ge...@januslogix.com>
> To: <ax...@xml.apache.org>
> Sent: Thursday, October 17, 2002 8:24 AM
> Subject: Re: How to use the Java2WSDL class inside a java program
>
>
> > That problem has bitten me too. We want to do a dynamic publish which we
> try
> > to use the Java2WSDL and WSDL2Java so we get a deploy.wsdd file. We
found
> a
> > couple of things that seemed to help. The biggest is we load a custom
> > SecurityManager just before running the .main() methods. The primary
> > objective of the custom SecurityManager is to reject any attempts at
> running
> > System.exit(). What you'll get is an exception thrown when the
> System.exit()
> > method gets invoked.
> >
> > To clean up the exception caused by the SecurityManager we wrote a
> > PrintStream that swallows the exception. This enabled us to essentially
> call
> > the two utilities inside our JVM without having them shut us down.
> >
> > Note: this is a hack and the real solution would be for Axis to stop
> making
> > the System.exit() call. Instead it should be doing a return...but I
don't
> > know who's listening or if its of significant value so my hack will stay
> in
> > place for a while.
>
> Calling system.exit in a main() app is *exactly* what it should be doing,
so
> your makefiles and shell scripts can see if it worked.
>
> The solution is not to use a wrapper class like the main entry point, or
> even the ant task,  but the stuff one level down that does the work. I.e.
> the solution in the open source world is to look at the source files and
> find out what they do, rather than complain about apparent deficiencies in
> the interface.
>
>
> -steve
>
>


Re: How to use the Java2WSDL class inside a java program

Posted by Steve Loughran <st...@iseran.com>.
----- Original Message -----
From: "Grant Echols (JanusLogix)" <ge...@januslogix.com>
To: <ax...@xml.apache.org>
Sent: Thursday, October 17, 2002 8:24 AM
Subject: Re: How to use the Java2WSDL class inside a java program


> That problem has bitten me too. We want to do a dynamic publish which we
try
> to use the Java2WSDL and WSDL2Java so we get a deploy.wsdd file. We found
a
> couple of things that seemed to help. The biggest is we load a custom
> SecurityManager just before running the .main() methods. The primary
> objective of the custom SecurityManager is to reject any attempts at
running
> System.exit(). What you'll get is an exception thrown when the
System.exit()
> method gets invoked.
>
> To clean up the exception caused by the SecurityManager we wrote a
> PrintStream that swallows the exception. This enabled us to essentially
call
> the two utilities inside our JVM without having them shut us down.
>
> Note: this is a hack and the real solution would be for Axis to stop
making
> the System.exit() call. Instead it should be doing a return...but I don't
> know who's listening or if its of significant value so my hack will stay
in
> place for a while.

Calling system.exit in a main() app is *exactly* what it should be doing, so
your makefiles and shell scripts can see if it worked.

The solution is not to use a wrapper class like the main entry point, or
even the ant task,  but the stuff one level down that does the work. I.e.
the solution in the open source world is to look at the source files and
find out what they do, rather than complain about apparent deficiencies in
the interface.


-steve


Re: How to use the Java2WSDL class inside a java program

Posted by "Grant Echols (JanusLogix)" <ge...@januslogix.com>.
That problem has bitten me too. We want to do a dynamic publish which we try
to use the Java2WSDL and WSDL2Java so we get a deploy.wsdd file. We found a
couple of things that seemed to help. The biggest is we load a custom
SecurityManager just before running the .main() methods. The primary
objective of the custom SecurityManager is to reject any attempts at running
System.exit(). What you'll get is an exception thrown when the System.exit()
method gets invoked.

To clean up the exception caused by the SecurityManager we wrote a
PrintStream that swallows the exception. This enabled us to essentially call
the two utilities inside our JVM without having them shut us down.

Note: this is a hack and the real solution would be for Axis to stop making
the System.exit() call. Instead it should be doing a return...but I don't
know who's listening or if its of significant value so my hack will stay in
place for a while.

Hope this helps,

Grant

----- Original Message -----
From: "Eric BELLARD" <eb...@improve.fr>
To: <ax...@xml.apache.org>
Sent: Thursday, October 17, 2002 6:52 AM
Subject: How to use the Java2WSDL class inside a java program


> Hi,
>
> I'm building a Axis plugin for the IDE eclipse and I've got some problems.
> One of the functionnality I'd like to include in the plugin is to
> generate a WSDL file from a selected Java class.
> I'd like to use the Java2WSDL class for that.
> I'd like to execute the method run of the Java2WSDL class. The problem
> with this method is that it's not that, it proceeds a "System.exit(1)"
> and it kills my eclipse!
>
> The only way I see is to use a "Runtime.getRuntime().exec(...)" to
> execute a command like that:
>
> Is there a way to walk around?
> Is there plan to change the implementation of the Java2WSDL class to be
> easily used by another classes?
>
> Thanks in advance.
>
>


Re: How to use the Java2WSDL class inside a java program

Posted by dev <de...@chez.com>.
Bonjour,

Je ne peux pas vous aider sur le sujet par contre
je suis très intéressé par votre plug-in.
Pensez-vous le rendre disponible en open-source?
Comment puis-je me tenir au courant de l'évolution de votre plug-in?

Cordialement
Cédric Trolez.

At 14:52 17/10/02 +0200, you wrote:
>Hi,
>
>I'm building a Axis plugin for the IDE eclipse and I've got some problems.
>One of the functionnality I'd like to include in the plugin is to generate 
>a WSDL file from a selected Java class.
>I'd like to use the Java2WSDL class for that.
>I'd like to execute the method run of the Java2WSDL class. The problem 
>with this method is that it's not that, it proceeds a "System.exit(1)" and 
>it kills my eclipse!
>
>The only way I see is to use a "Runtime.getRuntime().exec(...)" to execute 
>a command like that:
>
>Is there a way to walk around?
>Is there plan to change the implementation of the Java2WSDL class to be 
>easily used by another classes?
>
>Thanks in advance.