TOTD #19: How to Add Metro Quality-of-Service to Contract-First Endpoint ?

This TOTD explains how to add Reliability and Security to a Contract-First Endpoint using NetBeans IDE.

In the Contract-First, the contract, i.e. the WSDL, is defined first as opposed to starting from Java. The Metro programming model starts with a Java Service Endpoint Interface (SEI) and uses Web Service Designer to specify Security, Reliability and Transactions support. This blog uses the WSDL bundled with the fromwsdl sample of Metro download and adds Quality-of-Service attributes to it.

Here are the steps to enable Reliable Messaging to Contract-First endpoint:

  1. In a new Web project, right-click and select "Web Service from WSDL..." as shown below:

  2. Specify the Web Service Name, package name and chose the location of the WSDL as shown below:

    The Web Service port name is chosen for you. Alternatively, you can click on "Browse..." button next to "Web Service Port:" and select the appropriate port.
  3. Click on "Finish" and the Web Services Designer is shown as shown below:

  4. Right-click on the Project and select on "Undeploy and Deploy" to deploy the project.
  5. Expand the "Web Services" tree, select the newly added Web service and right-click on "Test Web Service". The Tester page is shown in a browser with links to the packaged WSDL file and text boxes and buttons to invoke the Web service.
  6. In the Web Services Designer, select "Reliable Message Delivery".
  7. Right-click on the project, select "Clean" to clean all the generated files. Again right-click on the project and then select "Undeploy and Deploy" to deploy the project again.
  8. As in step 5 above, test the Web service. The packaged WSDL now contains the appropriate policy assertions and Reliable Message Delivery is enabled on the endpoint.

As described in screencast #ws7, Security can be added to a Contract-First endpoint using the steps listed above.

Please leave suggestions on other TOTD that you'd like to see. A complete archive is available here.

Technorati: totd glassfish webservices netbeans metro wsdl reliability contractfirst


Arun, TOTD request. It would be nice if you could provide sample code to let us know how we can test that WSRM is actually working. Two scenarios: (1) a client request when the service is down, such that when the service is reactivated it will get the SOAP Request, and (2) the server response when the client is down, such that when the client is reactivated it will get the SOAP response. Thanks, Glen.

Posted by Glen on November 26, 2007 at 05:44 AM PST #

[Trackback] I presented on Metro, jMaki and JRuby-on-GlassFish at a partner meeting on Nov 21 in Toronto and Montreal (yeah, both cities in the same day). That makes it 3 cities (the first one being Seattle) total for now! I've...

Posted by Arun Gupta's Blog on November 27, 2007 at 11:04 PM PST #

Glen, In order to test WSRM, pull the ethernet cable out of your Web service endpoint box, monitor the messages (specifically the message id & ack receipts). I'll hopefully show this in one of my talks :)

Posted by Arun Gupta on December 16, 2007 at 01:49 PM PST #

What about the wsit plugin (web service-client options) over NetBeans 6.0?;I have been trying several versions of netbeans 6, but no one of them has the wsit configuration options for the client.

Posted by AHurtado on December 17, 2007 at 07:40 AM PST #

(mutual certificate exchange)

Posted by AHurtado on December 17, 2007 at 07:42 AM PST #

The client options can be accessed using the same "Edit Web Service Attributes" as shown starting 11:20 in the screencast at:

Are you looking for something else ?

Posted by Arun Gupta on January 03, 2008 at 10:03 AM PST #

Yes i've looking this screencast, but it presents some difficults when it works connecting a client with a soap-1.2 server endpoint; the end-point is implemented in .net 2.0 with wse (web services enhancements 3.0).

Posted by guest on January 03, 2008 at 08:31 PM PST #

Metro has not been tested with .NET 2.0 / WSE. I'd encourage you to post your question to Metro forum at Hopefully some other user have tried this configuration and can assist you.

Posted by Arun Gupta on January 03, 2008 at 10:59 PM PST #

Thanks for your answer Arun, and I have one more dude too: at this time is recommended to use the nb6 integrated with the wsit plugin, or is better to use nb5.5.1 and update the wsit plugin (it is, has the plugin in netbeans 6 all the features of the 5.5.1 version?)

Posted by guest on January 09, 2008 at 02:43 AM PST #

It is certainly recommended to use NB 6.0 with integrated WSIT (now called Metro) plug-in. If any updates are available, they will be there in NB plug-in manager. NB 6.0 integrated plug-in has all the functionality in NB 5.5.1 WSIT plugin.

Posted by Arun Gupta on January 09, 2008 at 02:46 AM PST #

Arun, I have found too that in nb 6.0 (and nb5.0) when my wsdl has a soap-1.2 declaration, it generates a warning:

[WARNING] SOAP port "WsEntidad1": uses a non-standard SOAP 1.2 binding.

References founded in internet says that i need to enable the "-extension" option in wsimport, but this is already enabled in the build file runned in background for the metro plugin (file nbproject/jaxws-build.xml, section:
<wsimport xendorsed="true" package="" verbose="true" sourcedestdir="${build.generated.dir}/wsimport/client" extension="true" destdir="${build.generated.dir}/wsimport/binaries" wsdl="${basedir}/${conf-dir}xml-resources/web-service-references/ServiceContract/wsdl/ServiceContract.wsdl" wsdlLocation="file:/C:/.applications/s21.eTrans6.Applications/App16.Metro/Service02.Client01.Java/ServiceContract.wsdl" catalog="catalog.xml"/>
... ).

+ At this time is metro supporting the soap-1.2 binding (for web service client and server development)?
+ where can i found more information about this warning?
+ does this warning affects the functionality of the generated client?


Posted by ahurtado on January 12, 2008 at 06:09 AM PST #

Metro very well supports SOAP 1.2.
This warning message is thrown because it uses a non-standard way to describe the binding in the WSDL.
This binding enables the client to send SOAP 1.2 messages, no side effect on the generated client.

Posted by Arun Gupta on February 01, 2008 at 09:08 AM PST #

I donot want to use the extension option since it will genereate a non portable client.
How can I change the binding to be a standard one ?
How can I get more information about which part of my wsdl violate the standard ?


Posted by hany on March 26, 2008 at 06:06 PM PDT #

Hi Arun,

"This warning message is thrown because it uses a non-standard way to describe the binding in the WSDL."

You mean, this is because WSDL specification only includes a binding SOAP 1.1?

Posted by Buddhike de Silva on February 21, 2011 at 02:03 AM PST #


That's correct.

Posted by Arun Gupta on February 25, 2011 at 09:15 AM PST #

Post a Comment:
Comments are closed for this entry.

profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.

Java EE 7 Samples

Stay Connected


« July 2016