Miles to go …

November 26, 2007

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

Filed under: webservices — arungupta @ 5:20 am

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

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot
Related posts:
  1. TOTD #23: JavaFX Client invoking a Metro endpoint
  2. TOTD #22: Java SE client for a Metro endpoint
  3. TOTD #12: Invoking a Java EE 5 Web service endpoint from JRuby
  4. TOTD #98: Create a Metro JAX-WS Web service using GlassFish Tools Bundle for Eclipse
  5. TOTD #2: Change the endpoint address on a pre-generated Web services Stub

16 Comments »

  1. 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.

    Comment by Glen — November 26, 2007 @ 1:44 pm

  2. [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…

    Comment by Arun Gupta's Blog — November 28, 2007 @ 7:04 am

  3. 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 :)

    Comment by Arun Gupta — December 16, 2007 @ 9:49 pm

  4. 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.

    Comment by AHurtado — December 17, 2007 @ 3:40 pm

  5. (mutual certificate exchange)

    Comment by AHurtado — December 17, 2007 @ 3:42 pm

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

    http://blogs.sun.com/arungupta/entry/screncast_ws7_secure_and_reliable

    Are you looking for something else ?

    Comment by Arun Gupta — January 3, 2008 @ 6:03 pm

  7. 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).

    Comment by Anonymous — January 4, 2008 @ 4:31 am

  8. Metro has not been tested with .NET 2.0 / WSE. I’d encourage you to post your question to Metro forum at http://forums.java.net/jive/forum.jspa?forumID=46. Hopefully some other user have tried this configuration and can assist you.

    Comment by Arun Gupta — January 4, 2008 @ 6:59 am

  9. 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?)

    Comment by Anonymous — January 9, 2008 @ 10:43 am

  10. 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.

    Comment by Arun Gupta — January 9, 2008 @ 10:46 am

  11. 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="com.business01.service01.ws.serviceclient.reference" 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?

    Thanks.

    Comment by ahurtado — January 12, 2008 @ 2:09 pm

  12. 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.

    Comment by Arun Gupta — February 1, 2008 @ 5:08 pm

  13. 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 ?

    Thanks

    Comment by hany — March 27, 2008 @ 1:06 am

  14. 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?

    Comment by Buddhike de Silva — February 21, 2011 @ 10:03 am

  15. Buddhike,

    That’s correct.

    Comment by Arun Gupta — February 25, 2011 @ 5:15 pm

  16. keyless locks can be rugged as well as these are made out of prime quality other metals that may undergo a variety of essentials as well as the during the worse yet events effect as a result of anybody working to bust as well as enter into. It doesn’t matter your height of safety measures requires there’s a lck which usually holds keyless gain access to for your requirements.

    Comment by Porter Clune — May 25, 2011 @ 11:18 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.
Powered by WordPress