users@glassfish.java.net

RE: How to write a standalone application client w/glassfish given a WSDL?

From: Alex Sherwin <alex.sherwin_at_acadiasoft.com>
Date: Mon, 29 Sep 2008 16:11:31 -0400

Here is a basic way to call a web service if you know the wsdl url, the wsdl namespace and wsdl qname (namespace and qname are probably static, this way you can dynamically configure the url to call inside your application to avoid hard-coding).


/* Call WebService */
final SomeServiceService wsservice = new SomeServiceService(new URL("http://url.to.wsdl/?wsdl", new QName("wsdl namespace", "wsdl qname")));
final SomeService wsport = wsservice.getSomeServicePort();

try {
  wsport.callWebServiceFunction();
} catch (AnyWebServiceExceptionsThrown e) {
  // to stuff
}


Alex Sherwin
alex.sherwin_at_acadiasoft.com

-----Original Message-----
From: glassfish_at_javadesktop.org [mailto:glassfish_at_javadesktop.org]
Sent: Monday, September 29, 2008 3:28 PM
To: users_at_glassfish.dev.java.net
Subject: How to write a standalone application client w/glassfish given a WSDL?

Hi all,

I'm having some trouble finding documentation which will help me write a standalone web services client using the GlassFish libraries. I have downloaded GlassFish Server v2 UR2. I have already generated the client class files via:

wscompile -gen config.xml

I get a whole bunch of classes, including:

MyServices.class
MyServicesService.class
MyServicesService_Impl.class
MyServices_Stub.class

My questions are:

(1) Assuming MyServices has a method void ping(void), what's the full code for a standalone client that calls the ping method?

(2) Which of the GlassFish jars must I include with the standalone client?

Thanks!

--Rob
[Message sent by forum member 'autophile' (autophile)]

http://forums.java.net/jive/thread.jspa?messageID=302414

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
For additional commands, e-mail: users-help_at_glassfish.dev.java.net