Miles to go …

February 12, 2007

Screencast #WS2: Invoking a Web service using NetBeans IDE

Filed under: webservices — arungupta @ 8:00 am

In the second part of the screen cast series (part 1), I show the various ways by which NetBeans IDE can invoke a Web service endpoint. The first part showed only the default way to invoke the endpoint, but this screen cast shows two additional ways.

Enjoy it here.

Feel free to post suggestions on what would you like to see in terms of Web services development using NetBeans.

Technorati: Web services NetBeans GlassFish WSIT JAX-WS screencast

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot
Related posts:
  1. Screencast #WS3: Reliable and Interoperable Web service using WSIT plug-in, NetBeans and GlassFish
  2. Screencast #WS1: Web services development using NetBeans IDE and GlassFish
  3. Creating and Invoking a Web service using GlassFish in NetBeans, IntelliJ, and Eclipse – Part 3
  4. Screencast #WS7: Secure and Reliable Web service using Metro/GlassFish and NetBeans IDE 6
  5. Screencast #WS4: How to install WSIT plug-in on NetBeans IDE 5.5.1 using Update Center ?

46 Comments »

  1. [Trackback] GlassFish v2 M4 and Windows Vista were released two weeks ago. I installed GlassFish M4 on my machine and Vista Enterprise on a different machine. In this blog, I explain the steps followed to invoke a Web service deployed on…

    Comment by Arun Gupta's Blog — February 13, 2007 @ 7:39 am

  2. Would you consider producing a simple tutorial on utilising the bundled derby database within a web service built from jsp’s?
    Thanks.
    Andy Webb
    BSc Hons Computing with Networks
    Sheffield Hallam University

    Comment by Andy Webb — February 20, 2007 @ 3:48 am

  3. Excellent, short and to the point presentation – Thank you Arun.

    Comment by Nader — February 20, 2007 @ 7:58 am

  4. Andy,

    I’ll post a list of screen casts that are planned for the next few weeks. I’ll add the tutorial to use bundled derby database to the bottom of that list. It might get done sooner :)

    Nader,

    Glad that you liked the screencast. Feel free to leave comments if you would like to see any other screen casts.

    -Arun

    Comment by Arun — February 20, 2007 @ 9:52 am

  5. Evening gupta,
    I used your tutorial this evening to create a stub based on an DataSet returned from a .NET web service (System.Data.Dataset). It fell over. It apears there is a problem in the M$ generated WSDL.
    For something so popular and highly utilised in the .NET world as a DataSet, its a shame wsimport can’t be in some way made aware of these types.
    If you have any comments on the matter I would be very interested in reading them. So far I have only been able to find:
    http://forums.java.net/jive/message.jspa?messageID=201229
    Thanks
    Andy.

    Comment by Andy — February 21, 2007 @ 1:46 pm

  6. apologies! Arun.

    Comment by Anonymous — February 21, 2007 @ 2:03 pm

  7. Andy, I posted a new thread describing your problem.
    http://forums.java.net/jive/thread.jspa?threadID=23398
    Please follow it there.

    Comment by Arun — February 22, 2007 @ 9:43 am

  8. Andy,
    I’ll work on a screencast that shows how bundled Derby database can be used. But in the meanwhile see the following article that shows how to use Derby database with NB 5.5:
    http://www.netbeans.org/kb/55/derby-demo.html
    -Arun

    Comment by Arun — February 23, 2007 @ 3:51 pm

  9. Arun,
    Would it be possible to create a screencast surrounding a Notification-based Web Service?

    Comment by Marc — February 27, 2007 @ 8:58 am

  10. Marc, By notification-based Web service if you mean supporting http://www.w3.org/TR/wsdl#_notification style of operation, then JAX-WS does not support it. There is no support for WS-Eventing in WSIT as well.

    Comment by Arun — March 1, 2007 @ 8:52 am

  11. [Trackback] I downloaded NetBeans 6.0 daily build from http://www.netbeans.info/downloads/dev.php. The installation went pretty smooth and so after every thing was done, I started the IDE. Before I could do anything in the IDE, an error message window popped up NP…

    Comment by Arun Gupta's Blog — March 3, 2007 @ 7:48 am

  12. [Trackback] Web Services Interoperability Technology (WSIT, aka Project Tango), integrated in GlassFish V2 builds, provides a implementation of key enterprise Web services specifications and enables first-class interoperability with .NET 3.0 framework. However if…

    Comment by Arun Gupta's Blog — May 23, 2007 @ 3:51 pm

  13. [Trackback] A short tutorial from the community on how to develop Web services using NetBeans 6 M9 on Sun Java System Application Server 9.0. You can very well use the exact same steps to deploy this Web service on GlassFish V2….

    Comment by Arun Gupta's Blog — June 14, 2007 @ 6:17 am

  14. I have a .NET webservice that return Dataset. How can you call a webservice that return .NET DATASET from JAVA?

    Comment by arif mahmood — June 14, 2007 @ 10:15 pm

  15. [Trackback] Fabian explained how WSIT features can be configured on Java SE 6 Endpoint API exposed as part of JAX-WS 2.1. In this blog, I start with a Reliable Messaging-enabled endpoint developed using NetBeans IDE 5.5.1 and WSIT plug-in and then…

    Comment by Arun Gupta's Blog — June 18, 2007 @ 5:29 pm

  16. I understand your answer. But I am asking about the Dataset in .NET. .Net webservice can have Dataset as an argument but Dataset is not a type in Java. Then when Java read the .NET webservice how can it interpret .NET dataset to Java type.
    I need an example.

    Comment by arif mahmood — June 18, 2007 @ 6:45 pm

  17. Arif, I started a new thread at and this might serve an answer for you:
    https://wsit.dev.java.net/servlets/ReadMsg?list=dev&msgNo=1273

    Comment by Arun — June 21, 2007 @ 5:43 pm

  18. [Trackback] GlassFish V2 beta3 is now available. I take this opportune moment for a follow up entry showing how a Reliable WSIT endpoint can be invoked from WCF client and vice versa. WSIT is already integrated in GlassFish V2. The first…

    Comment by Arun Gupta's Blog — July 10, 2007 @ 12:20 pm

  19. [Trackback] Java API for XML Web Services (JAX-WS) provides a complete API to develop and invoke Web services over multiple transports (for example HTTP). NetBeans IDE provides first-class support for developing and invoking a JAX-WS based Web service. The missin…

    Comment by Arun Gupta's Blog — July 16, 2007 @ 3:07 pm

  20. Screencast #WS2: Invoking a Web service using NetBeans IDE – not running throws error

    Comment by Prashant — September 5, 2007 @ 9:59 pm

  21. Prashant, What error do you see ?

    Comment by Arun Gupta — September 5, 2007 @ 10:03 pm

  22. Your screen cast are simple easy to understand, wonderful.
    Will you please consider explaining in more detail how to return complex type dataset from webservice in netbeans invironment. it would be of great help for many netbeans user. I have not found solution to this problem in any blog.

    thanking you

    raj

    Comment by Raj Gautam — December 29, 2007 @ 3:06 pm

  23. Raj, By a complex data set you mean a JavaBean with multiple getter/setter where each could be a Bean ? The Tester app that comes with GlassFish support only primitive data types. You’ll need to create a JSP/Servlet/JavaSE client as described at:

    http://www.netbeans.org/kb/60/websvc/jax-ws.html

    Comment by Arun Gupta — January 2, 2008 @ 5:31 pm

  24. You cast gave me a clear picture and concept on how web service work and apply in Netbeans in a minute.

    I am now exploring how to return complex types, e.g. Vector, ArrayList from Web Services which could be understand by ASP .NET. Noted you mentioned do it using Java Bean, would you elaborate the details or giving URLs about that.

    Thank you for your great help.

    Brian

    Comment by Brian Kwan — July 9, 2008 @ 4:27 am

  25. I use java for xml.Can i do something with apx?

    Comment by gazduire web — September 10, 2008 @ 10:05 am

  26. Hello Arun,

    Thank you for the wonderful tutorial. To consume a web service we create a web client from WSDL and consume it. Let’s say I have two web services ws1 and ws2 and if I want to invoke ws2 in ws1 do I need to create a web service client in ws1 using ws2 WSDL?

    Thanks,
    nimdhar

    Comment by Anonymous — October 21, 2008 @ 11:53 am

  27. Yep, generate clients for WS2 and make them available in WS1 classpath.

    Comment by Arun Gupta — October 21, 2008 @ 12:03 pm

  28. Hi Arun

    Currently I’m working with an application where I’m trying to access WCF services(.net plateform) by java. I’ve configure with Eclipse IDE and with web services explorer when I’m passing WSDL URL it is fatching all running services and built in methods. The issue is I’m able to access and get return by those methods which are using primitive data types like String, Integer etc. But not able to access arraylist Dictionary and Hashtable. Can you suggest me, is java support .net compatibility with these collection types? If yes how I can achive this. Please suggest I’ll be great thankful to you.

    Comment by chandra prakash — November 20, 2008 @ 1:25 am

  29. chandra prakash, there is no standard schema for these collection types and that’s what makes them less compatible. I’d recommend to ask your question to for a better response.

    Comment by Arun Gupta — November 20, 2008 @ 5:14 pm

  30. I’ll post a list of screen casts that are planned for the next few weeks. I’ll add the tutorial to use bundled derby database to the bottom of that list. It might get done sooner :)

    Comment by laptop batteries — November 26, 2008 @ 8:36 pm

  31. Just the information I needed. However, when I apply the command line client example to my situation which has a BEA webLogic server that requires authentication, NetBeans is unable to retrieve the WSDL. NetBeans does prompt me for a username and password, but it never resolves. If I go to a browser on the same machine as NetBeans those user/pass credentials work great. What might be the problem?

    Comment by Troy — April 1, 2009 @ 4:22 pm

  32. Troy, can you post your question to or (http://www.netbeans.org/community/lists/top.html#top).

    Comment by Arun Gupta — April 6, 2009 @ 10:54 am

  33. Could you tell me where I can download songs/file for my old GEM WS2 keyboard, please? I know its too old but I love it so much, and how can I connect it to the compuer? what is the software that can do this connection, many thanks to you.

    Comment by Ibrahim Harfoush — May 11, 2009 @ 10:37 am

  34. Hi Arun,

    I actually do development in C# .net. Lately I had a need to test if I can call a .Net webservice from Java app or JSP page. Your screencast ws2 has been very useful for me and I was able to create reference of my .Net webservice in a simple Java app in Netbeen 5.5.1 where I can see all the methods that exposed by the .net webservice. However I run the Java app the result was not what I expected and I appreciate if you can help.
    Basically, the .net webservice exposes a method GetDeviveDataString(string, string, string) that access sql server and returns a string representation of the dataset (each record is formatted as CSV string and ended with a new line ‘\n’) and this has been tested with a ASP.net page okay.
    The java app (which I followed your webcast) when examined has the following line
    Client.TestX0020ServiceResponse result = port.getDeviceDataStringTest(parameters);
    I tried to replace the ‘parameters’ with appropriate string values then the app would compile with error!
    Now I then have another method exposed by the same webservice which does not require any parameter and return a string "Hello world". With this simple method, when called from the java app only return the actual name of the method itself :

    Result = Client.TestX0020ServiceResponse@1d0fafc

    I have 2 questions
    1) How do I pass parameters to a parameterised .net webservice method in Netbeans 5.5.1

    2) How do I retrieve the correct output of .net service method instead of its name in java app created in Netbean 5.5.1

    As I am new and not quite familiar with Java world, your help is greatly appreciated.

    Thanks in advance

    Comment by victor lu — June 14, 2009 @ 11:27 pm

  35. Victor, please post your question to for a quicker response.

    Comment by Arun Gupta — June 15, 2009 @ 9:52 am

  36. Arun,
    By the way I had these issues resolved.
    It turned out that it was the way Netbeans generated the code from WSDL file which I assumed to give me the expected results but clearly it did not! Nonetheless I start to like using netbeans. Very nice IDE indeed. ;-) .
    Adding required parameters to the WS method, one needs to do the following:

    //This was generated by netbeans
    testwsfromdotnet.GetX0020DeviceX0020DataX0020AsX0020ByteX0020ArrayResponse rawResult = port.getDeviceDataByteArray(params);

    //This need to be added as required
    parameters.setDeviceDsn("3811080007");
    parameters.setStartDate("2009-05-04 07:02:16");
    parameters.setEndDate("2009-05-04 12:17:33");

    After that, the result that was generated by Netbean needed to processed further :

    //This was generated by netbeans
    testwsfromdotnet.GetX0020CompressedX0020DeviceX0020DataX0020AsX0020AX0020ByteX0020ArrayX0020Response compressResult = port.getCompressedDeviceDataByteArray(parameters);

    //This MUST be added to get the expected result
    byte[] compressedData = compressResult.getGetX0020CompressedX0020DeviceX0020DataX0020AsX0020AX0020ByteX0020ArrayX0020Result();

    So at the end, I have learned a great deal of interoperate between Java app/JSP and .Net Webservice.

    Thanks for the webcasts. Cheers

    Comment by victor lu — June 17, 2009 @ 12:44 am

  37. Hi Arun,

    I am new to web services.

    As a beginner your screencasts helped me a lot to create a simple web service and a web service client using NetBeans.

    Do you have any screencasts which show how to connect to database and use simple SQL statments in a web service?

    Appreciate your help.

    Thanks!
    Sai.

    Comment by sai — June 24, 2009 @ 2:18 am

  38. Sai,

    A JPA Persistence Unit can be easily created as described at:

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

    Then you can use the generated POJO classes and JPQL to query the database from your Web service class.

    Feel free to follow up on .

    Comment by Arun Gupta — July 2, 2009 @ 10:25 am

  39. Sir,

    I m a beginner in the J2EE I need your guidance.

    I have seen few of your screencast which helped a lot.

    but after #ws3 i was unable to get the concepts.

    I ws in the search of something which could explain the webservices and it developement in deatails and in easy language.

    I use netbeans tool, awaiting your response.

    regards,
    Dipakkumar

    Comment by Dipakkumar Patil — September 1, 2009 @ 10:51 pm

  40. Dipak,

    Following up with your comment at:

    http://blog.arungupta.me/2009/09/gmail-down-502-server-error/comment-page-1/#comment-8758

    Comment by Arun Gupta — September 2, 2009 @ 5:28 am

  41. I am new to web services.

    As a beginner your screencasts helped me a lot to create a simple web service and a web service client using NetBeans.

    Do you have any screencasts which show how to connect to database and use simple SQL statments in a web service?

    Appreciate your help.

    Comment by louis vuitton — November 18, 2009 @ 10:47 pm

  42. Louis,

    http://blogs.sun.com/arungupta/entry/screencast_29_web_service_using explains how to query a database in a Web service.

    Comment by Arun Gupta — February 23, 2010 @ 5:07 pm

  43. Hello,
    I am having a Java SSL enabled web service. i am using the wsdl of thos web service to add reference in a Asp.Net(VB) Client and consume the web service. I am not able to do this. Any suggestions??
    Regards,
    Vineeth

    Comment by Vineeth Vasudevan — April 7, 2010 @ 8:27 am

  44. Vineet,

    Not familiar with ASP.Net but you need to check if their client tool can import a WSDL from SSL endpoint. Try posting this question to their user’s forum.

    Read some more discussion at:

    http://old.nabble.com/jax-ws-over-https—ssl-td20561199.html

    Comment by Arun Gupta — April 7, 2010 @ 9:17 pm

  45. As a beginner your screencasts helped me a lot to create a simple web service and a web service client using NetBeans.

    Comment by coursework help — January 5, 2011 @ 3:29 am

  46. I think net beams is very good innovation and thank you for your work!

    Comment by coursework help — January 5, 2011 @ 3:30 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