Arun Gupta, Miles to go ...

Arun Gupta is a technology enthusiast, a passionate runner, and a community guy who works for Sun Microsystems.
« Nikon D80 firmware... | Main | Running Training... »

http://blogs.sun.com/arungupta/date/20070212 Monday February 12, 2007

Screencast #WS2: Invoking a Web service using NetBeans IDE

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

del.icio.us | furl | simpy | slashdot | technorati | digg |
|
Comments:

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

Posted by Arun Gupta's Blog on February 13, 2007 at 07:39 AM PST #

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

Posted by Andy Webb on February 20, 2007 at 03:48 AM PST #

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

Posted by Nader on February 20, 2007 at 07:58 AM PST #

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

Posted by Arun on February 20, 2007 at 09:52 AM PST #

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.

Posted by Andy on February 21, 2007 at 01:46 PM PST #

apologies! Arun.

Posted by 62.31.19.152 on February 21, 2007 at 02:03 PM PST #

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

Posted by Arun on February 22, 2007 at 09:43 AM PST #

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

Posted by Arun on February 23, 2007 at 03:51 PM PST #

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

Posted by Marc on February 27, 2007 at 08:58 AM PST #

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.

Posted by Arun on March 01, 2007 at 08:52 AM PST #

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

Posted by Arun Gupta's Blog on March 03, 2007 at 07:48 AM PST #

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

Posted by Arun Gupta's Blog on May 23, 2007 at 03:51 PM PDT #

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

Posted by Arun Gupta's Blog on June 14, 2007 at 06:17 AM PDT #

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

Posted by arif mahmood on June 14, 2007 at 10:15 PM PDT #

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

Posted by Arun Gupta's Blog on June 18, 2007 at 05:29 PM PDT #

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.

Posted by arif mahmood on June 18, 2007 at 06:45 PM PDT #

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

Posted by Arun on June 21, 2007 at 05:43 PM PDT #

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

Posted by Arun Gupta's Blog on July 10, 2007 at 12:20 PM PDT #

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

Posted by Arun Gupta's Blog on July 16, 2007 at 03:07 PM PDT #

Screencast #WS2: Invoking a Web service using NetBeans IDE - not running throws error

Posted by Prashant on September 05, 2007 at 09:59 PM PDT #

Prashant, What error do you see ?

Posted by Arun Gupta on September 05, 2007 at 10:03 PM PDT #

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

Posted by Raj Gautam on December 29, 2007 at 03:06 PM PST #

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

Posted by Arun Gupta on January 02, 2008 at 05:31 PM PST #

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

Posted by Brian Kwan on July 09, 2008 at 04:27 AM PDT #

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

Posted by gazduire web on September 10, 2008 at 10:05 AM PDT #

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

Posted by 144.226.173.68 on October 21, 2008 at 11:53 AM PDT #

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

Posted by Arun Gupta on October 21, 2008 at 12:03 PM PDT #

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.

Posted by chandra prakash on November 20, 2008 at 01:25 AM PST #

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 users@metro.dev.java.net for a better response.

Posted by Arun Gupta on November 20, 2008 at 05:14 PM PST #

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

Posted by laptop batteries on November 26, 2008 at 08:36 PM PST #

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?

Posted by Troy on April 01, 2009 at 04:22 PM PDT #

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

Posted by Arun Gupta on April 06, 2009 at 10:54 AM PDT #

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.

Posted by Ibrahim Harfoush on May 11, 2009 at 10:37 AM PDT #

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

Posted by victor lu on June 14, 2009 at 11:27 PM PDT #

Victor, please post your question to users@metro.dev.java.net for a quicker response.

Posted by Arun Gupta on June 15, 2009 at 09:52 AM PDT #

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

Posted by victor lu on June 17, 2009 at 12:44 AM PDT #

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.

Posted by sai on June 24, 2009 at 02:18 AM PDT #

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 users@metro.dev.java.net.

Posted by Arun Gupta on July 02, 2009 at 10:25 AM PDT #

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

Posted by Dipakkumar Patil on September 01, 2009 at 10:51 PM PDT #

Dipak,

Following up with your comment at:

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

Posted by Arun Gupta on September 02, 2009 at 05:28 AM PDT #

fgxbc aersdfcv xweascvx

Posted by 198.54.223.185 on October 29, 2009 at 02:46 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
« Nikon D80 firmware... | Main | Running Training... »

Valid HTML! Valid CSS!

This is a personal weblog, I do not speak for my employer.