Tuesday August 25, 2009
TOTD #98: Create a Metro JAX-WS Web service using GlassFish Tools Bundle for Eclipse
Now that you've installed GlassFish Tools Bundle for Eclipse 1.1, lets use this bundle to create a simple Metro/JAX-WS compliant Web service and deploy on GlassFish. These steps will work with either Eclipse 3.4.2 or 3.5 with WTP Java EE support.


public String sayHello(String name) {
return "Hello " + name + "!!";
}










Posted by Arun Gupta in webservices | Comments[2]
|
|
|
|
|
Wednesday February 18, 2009
India has always had the largest number of attendees of all the Tech
Days, and this time is certainly no exception. 10,000+ attendees, the
passion for technology, the eagerness to share their work, and
everything else makes it certainly one of the most exciting venues for
Tech Days.
The Hyderabad
International Airport is certainly very impressive - big,
clean, and very 21st centurisque with a 8-lane freeway connecting to
the main city.
See a short video as the attendees were allowed to enter the Hyderabad International
Convention Center (the venue for Tech Days):
I got a chance to talk to the General Manager of the convention center
and very happy to
know that similar convention centers are planned for Pune (1/2 the size
of existing one), Mumbai (4x), and
Bangalore (2x) in the near future.
As part of the opening, there was an excellent performance by an
11-year old percussionist, enjoy the video here:
Absolutely stunning performance!
It was funny, I was standing right
next to the boy's parents while recording the video. Apparently the boy
was allotted 10 minutes and the parents were trying their best to
distract the boy right at the beginning of 11th minute :)
I presented on:
Monday November 10, 2008
GlassFish @ Silicon Valley Code Camp 2008 - Trip Report
| 1400 registrations, 112 sessions, free pizza, a
barbecue on Saturday
night, raffles and lot more - that is Silicon Valley
Code Camp. Jitu, Jiandong, Jacob, and I presented on GlassFish at Silicon Valley Code Camp over the weekend. The event had higher attendance (close to 500) than last year and certainly is a great networking event for the local community. |
Friday October 17, 2008
SOAP and REST - both equally important to Sun
"Sun moving away from SOAP to embrace REST" is the misleading title
of an article recently published in SD
Times. The article provides a good introduction to JAX-RS and
Jersey. But I really wonder what motivated the author of this
article to use this title. This blog, hopefully, provides a better
context.
Jersey is
the Reference Implementation of Java API for RESTful Web Services
(JAX-RS, JSR
311)
and was released earlier this week. The headline indicates that Sun is
leaving SOAP and will support REST. The debate between
REST and SOAP is not new and there are religious camps on both sides
(even within Sun).
And that's completely understandable because each technology has its
own merits and demerits. But just because a new JSR aimed to make
RESTful Web services easy in
the Java platform is released, it does not mean Sun Microsystems is
leaving existing technology in trenches.
The addition of Jersey to Sun's software portfolio makes the Web
services stack from GlassFish community a more compelling and
comprehensive offering. This is in contrast to "moving away"
from SOAP as indicated by the title. As a matter of fact, Jersey will
be included as part of Metro
soon,
the Web Services stack of GlassFish. And then you can use JAX-WS (or
Metro) if you like to use SOAP or JAX-RS (or Jersey) if you prefer
RESTful Web
services. It's all about a offering choice to the community instead of
showing a direction.
Here are some data points for JAX-WS:
Posted by Arun Gupta in webservices | Comments[9]
|
|
|
|
|
Tuesday August 12, 2008
LOTD #1: Using Silverlight to access GlassFish Metro and JAX-WS Web service endpoints
Following TOTD
(Tip Of The Day) pattern, I'm
starting LOTD (Link
Of The
Day) series
today. These are light-weight entries with generally a single line
description and links to other
blogs/articles/tips/whitepapers/screencasts/etc.
Let's start with three recent entries on MSDN that describe how to
invoke Metro
and JAX-WS
Web service endpoints from Microsoft
Silverlight and .NET:
Posted by Arun Gupta in webservices | Comments[2]
|
|
|
|
|
Thursday July 31, 2008
Why GlassFish Metro over Axis ?
Metro (Web
services stack from GlassFish)
is kicking strong these days - here are two instances!
Posted by Arun Gupta in webservices | Comments[0]
|
|
|
|
|
Thursday July 10, 2008
Getting Started with GlassFish in IntelliJ IDEA
IntelliJ IDEA
7.0.x include plugins
that provide support for configuring GlassFish.
This blog provides clear instructions on how to get started by
developing and deploying a JSP, Servlet and Web services using
GlassFish in IntelliJ. The instructions are using IntelliJ 7.0.3 Build
#7757 (with no additional plugins).


















|
java.io.PrintWriter out = response.getWriter(); try { out.println("<html>"); out.println("<head>"); out.println("<title>Servlet NewServlet</title>"); out.println("</head>"); out.println("<body>"); out.println("<h1>Servlet NewServlet at " + request.getContextPath () + "</h1>"); out.println("</body>"); out.println("</html>"); } finally { out.close(); } |
| doGet(request, response); |







|
client.HelloWorld service = new
client.HelloWorldService().getHelloWorldPort(); //invoke business method System.out.println(service.sayHelloWorldFrom("Duke")); |

Posted by Arun Gupta in webservices | Comments[10]
|
|
|
|
|
Wednesday July 09, 2008
GlassFish Family in Readers Choice Awards 2008 Finalists
2008
Readers Choice Awards from SYS-CON SOA World Magazine
are announced. There are quite a few projects from GlassFish and sister
communities. The nominations are:
![]() |
|
Posted by Arun Gupta in General | Comments[0]
|
|
|
|
|
Saturday April 05, 2008
GlassFish Metro Web Services Training Course
Interested
in understanding the nitty gritty details of how Metro in GlassFish
provides Secure, Reliable, Transactional and .NET 3.0 interoperable Web
services ? You can certainly read all about it in Metro Users Guide,
post questions to Metro
Forum, subscribe to Metro Blogs
or The
Aquarium.
![]() |
But now there is a new 5 hours Web-based course, WTMB-SAS-1500,
from Sun Training.
The course content is organized in 5 different modules:
|
Posted by Arun Gupta in webservices | Comments[7]
|
|
|
|
|
Tuesday April 01, 2008
BizTalk Services SDK, GlassFish and Metro
Microsoft BizTalk R11
CTP was released last week and now contains a sample that is
based on GlassFish,
Metro and NetBeans. Even though
today is April 1st, this is not intended to be an April
Fool's Day joke. Read more about the sample in this blog
entry. The relevant bits from the entry are quoted below:
The sample shows how to
use the BizTalk Services Identity Security Token Service (STS) to
secure the communication between a Java client and a Java service
providing federated authentication and claims-based authorization. The
sample, which you can find in
./Samples/OtherPlatforms/StandaloneAccessControl/JavaEE5 once you
installed the SDK, is a pure
Java sample not requiring any of our bits on either the
service or client side. The interaction
with our services is purely happening on the wire.
The Metro team over at
Sun Microsystems has made
a very significant contribution to making this all work.
Before we started making changes to accommodate Java, there would have
been very little hope for anyone to get this seemingly simple scenario
to work. We had to make quite a few changes even though our service did
follow the specs.
As a result of this
collaboration, Metro
1.2 is going to
be a better and more interoperable release for the Sun's customers and
the greater Java community and BizTalk Services as well as
our future identity products will be better and more interoperable,
too. Win-Win. Thank you,
Sun.
Thank you Microsoft for adding this sample to the BizTalk Services SDK.
Metro team demonstrated a similar
demo at JavaOne
2007. The demo shows how an Excel 2007 client can invoke a
secure and reliable endpoint deployed on GlassFish. The entire source
code for the sample, along with instructions to build, are available here.
This is possible today because of our participation in previous 6
plugfests (Mar
2008, Nov
2007, Jul
2007, Oct
2006, Mar
2006, Nov
2005) hosted by Microsoft.
Technorati: glassfish netbeans
metro webservices
biztalk
microsoft
interoperability
Posted by Arun Gupta in webservices | Comments[3]
|
|
|
|
|
Monday March 31, 2008
Slides for St Louis & Kansas City Developer Update Meetings
I presented on GlassFish
and Metro
in Developer Update meetings in St
Louis & Kansas
City. The slides are available here.
The demos shown in the talk can be seen at:
| Event | City | Date |
| The Server Side Java Symposium | Las Vegas | Mar 26, 2008 |
| Ajax World East 2008 Day 2, Day 1 | New York | Mar 18-19, 2008 |
| SD West 2008 | Santa Clara | Mar 6, 2008 |
| GlassFish Day | Hyderabad, India | Feb 29, 2008 |
| Sun Tech Days - Day 2, Talent Show, Day 1 | Hyderabad, India | Feb 27-28, 2008 |
| acts_as conference - Day 2, Day 1 | Orlando | Feb 8-9, 2008 |
| South Bay Ruby Meetup | Mountain View | Jan 30, 2008 |
Posted by Arun Gupta in webservices | Comments[3]
|
|
|
|
|
Tuesday March 25, 2008
Rails powered by GlassFish & jMaki @ The Server Side Java Symposium, Las Vegas - Mar 26, 2008
If you want to learn more about:
| Date: | Mar 26, 2008 |
| Time: | 2:30 - 3:30pm |
| Track: | Language & Coding |
| Title: | Rails powered by GlassFish & jMaki |
Posted by Arun Gupta in web2.0 | Comments[1]
|
|
|
|
|
Sunday March 16, 2008
Travel Schedule - Next 5 weeks
Here is my travel schedule for next 5 weeks:
| Mar 17-21 | Ajax World, New York | Web Application Development using jMaki |
| Mar 25-26 | The Server Side Java Symposium, Las Vegas | Rails powered by GlassFish & jMaki |
| Mar 27 | Developer Update, St Louis Westport DoubleTree, FREE event | Open Source Web Services stack in GlassFish |
| Mar 28 | Developer Update, Kansas City, FREE event | Rich Internet Applications and GlassFish |
| Apr 16-19 | FISL, Brazil | Web 2.0 Application Development
using jMaki and Asynchronous Ajax for Revolutionary Web Applications |
Posted by Arun Gupta in General | Comments[2]
|
|
|
|
|
Thursday January 31, 2008
TOTD #23: JavaFX Client invoking a Metro endpoint
This TOTD is inspired by Learning JavaFX Script - Part 3. The original article explains how to invoke a Web service from a JavaFX client using NetBeans 5.5.1 and GlassFish v1. Newer version of both NetBeans and GlassFish are available since the article was written. This TOTD (tip of the day) explains how to invoke a Metro endpoint deployed on GlassFish v2 from a JavaFX client - all using NetBeans 6.
Java Class Library" as
shown below:
Finish".MetroClientLibrary" as shown
below:
Finish".New",
"Web Service Client...".Browse..." button next to "Project"
radio button and select the deployed Web service from Metro endpoint
project. If the Web service is deployed on a different machine then you
may specify the WSDL URL. Specify the package name "client"
as shown below:
Finish".Build". This generates a JAR file
that will be utilized later. The location of this jar file is shown in
the Output console. In our case, it is C:\workarea\samples\javafx\MetroClientLibrary\dist\MetroClientLibrary.jar.New Project" and entering the values
as shown below:
Next >" and enter the values as shown below:
Finish".Properties",
"Libraries", "Add JAR/Folder" and select the
JAR file created in "MetroClientLibrary" project as shown
below:
OK".metroclient.Main.fx file, replace "// place
your code here" with the following code:import java.lang.*;
import javafx.ui.*;
import client.NewWebServiceService;
import client.NewWebService;
class InputModel {
attribute name: String?;
}
var inputModel = InputModel { };
var nameField = TextField { };
nameField.action = operation() {
inputModel.name = nameField.value;
};
class ButtonClickModel {
attribute result: String;
}
var model = new ButtonClickModel();
Frame {
title: "JavaFX Client -> Metro endpoint"
width: 350
height: 200
content: GridPanel {
rows: 3
vgap: 5
cells:
[SimpleLabel {
text: "Name :
"
},
nameField,
SimpleLabel {
text: "Result
from endpoint : "
},
Label {
text: bind "{model.result}"
},
Button {
text: "Invoke
Web Service!"
action:
operation() {
do {
try {
var service: NewWebServiceService = new NewWebServiceService();
var port: NewWebService = service.getNewWebServicePort();
var name: String = "{nameField.value}";
var result: String = port.sayHello(name);
System.out.println("response: {result}");
model.result = result;
} catch (e:Exception) {
System.out.println("exception: {e}");
}
}
}
}
]
}
visible: true
};MetroClient")
and select "Run Project". The following window is
displayed:
Duke" in the text box and click on "Invoke
Web Service!" button to see the result as shown below:
After following these steps, you have created a JavaFX client that can invoke a Metro endpoint project deployed on GlassFish - all using NetBeans IDE.
Now Metro provides secure, reliable, transactional and .NET 3.0 interoperable Web service. Have you tried/used any of those features in Metro ?
Please leave suggestions on other TOTD that you'd like to see. A complete archive is available here.
Technorati: totdd javafx metro glassfish netbeans webservices
Posted by Arun Gupta in webservices | Comments[13]
|
|
|
|
|
Friday January 25, 2008
TOTD #22: Java SE client for a Metro endpoint
Metro is the Web services stack in GlassFish. It is your one-stop shop from a simple Hello World to Secure, Reliable, Transactional and .NET 3.0 interoperable endpoint. Metro Tooling is provided by NetBeans and other options are explained here.
Screencast #ws7 describes how a Metro endpoint can be easily created and deployed on GlassFish and invoked from a Web client using NetBeans IDE. This TOTD (as requested here and here) describes how a Secure and Reliable Metro endpoint can be invoked using a Java SE client.
Here is my environment:
Let's get started.
Java/Java
Application. Name the project as "SEClient" and take all other
defaults.New", "Web Service
Client...".Browse..." button next to "Project" radio button and
select the deployed Web service endpoint.client" and click on "Finish".Properties", "Libraries", "Add
JAR/Folder" and add "webservices-rt.jar" from the "lib" directory of GlassFish
installation. Click on "OK".Web Service References" node in the project and drag the
leaf node in the "main" method of "Main.java" of the client project.name" to "Duke".Run". This will build the
project, invoke the endpoint and show the results in Output window as
"Hello Duke".====[com.sun.xml.ws.assembler.server:request]====
<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:sayHello xmlns:ns2="http://server/">
<name>Duke</name>
</ns2:sayHello>
</S:Body>
</S:Envelope>
============
====[com.sun.xml.ws.assembler.server:response]====
<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:sayHelloResponse xmlns:ns2="http://server/">
<return>Hello Duke</return>
</ns2:sayHelloResponse>
</S:Body>
</S:Envelope>
============Web
Service References", right-click and select "Refresh Client".Confirm Client Refresh" window, select "Also
replace local wsdl file with original WSDLs located at:" checkbox
and click on "Yes".Run". This will build the
project, invoke the endpoint and show the results in Output window as
"Hello Duke".====[com.sun.xml.ws.assembler.server:request]====
<?xml version="1.0" ?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Header>
<To xmlns="http://www.w3.org/2005/08/addressing">http://localhost:8080/SEEndpoint/HelloServiceService</To>
<Action xmlns="http://www.w3.org/2005/08/addressing">http://schemas.xmlsoap.org/ws/2005/02/rm/CreateSequence</Action>
<ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
<Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
</ReplyTo>
...Web
Service References", right-click and select "Refresh Client".Confirm Client Refresh" window, select "Also
replace local wsdl file with original WSDLs located at:" checkbox
and click on "Yes".Web Service References"
node, select "Edit Web Service Attributes" and select "Use
development defaults". This will ensure that client and endpoint
security credentials match.Source Packages", "META-INF" and
open "HelloServiceService.xml". The name of this file is
derived from the service name at the endpoint and may be different.
Specify the location of trust store by adding the following attributes
to "sc:KeyStore" element:location="C:\testbed\glassfish\final\glassfish\domains\domain1\config\cacerts.jks"
type="JKS" storepass="changeit"<sc:TrustStore wspp:visibility="private" peeralias="xws-security-server"
location="C:\testbed\glassfish\final\glassfish\domains\domain1\config\cacerts.jks"
type="JKS" storepass="changeit"/>Run". This will build the
project, invoke the endpoint and show the results in Output window as
"Hello Duke".====[com.sun.xml.ws.assembler.server:request]====
<?xml version="1.0" ?>
<S:Envelope
xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
xmlns:exc14n="http://www.w3.org/2001/10/xml-exc-c14n#">
<S:Header>
<To xmlns="http://www.w3.org/2005/08/addressing" wsu:Id="5006">http://localhost:8080/SEEndpoint/HelloServiceService</To>
<Action xmlns="http://www.w3.org/2005/08/addressing" wsu:Id="5005">http://server/HelloService/sayHelloRequest</Action>
<ReplyTo xmlns="http://www.w3.org/2005/08/addressing" wsu:Id="5004">
<Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
</ReplyTo>
<MessageID xmlns="http://www.w3.org/2005/08/addressing"
wsu:Id="5003">uuid:bb0e9571-a773-49bb-bad0-20a01d3af9f1</MessageID>
<wsse:Security S:mustUnderstand="1">
<wsu:Timestamp
xmlns:ns10="http://www.w3.org/2003/05/soap-envelope" wsu:Id="3">
<wsu:Created>2008-01-23T20:13:28Z</wsu:Created>
...If you are using JDK version prior to Java SE 6 U4, then need to override the JAX-WS and JAXB API as described here. Java SE 6 U4 already includes JAX-WS and JAXB 2.1 APIs which are required for the Metro client to work.
Please leave suggestions on other TOTD that you'd like to see. A complete archive is available here.
Technorati: totd webservices metro glassfish netbeans javase
Posted by Arun Gupta in webservices | Comments[18]
|
|
|
|
|
Today's Page Hits: 2667
Total # blog entries: 1002