Consuming Web Services in Netbeans - netbeans

I've setup a project in Netbeans 6.5 with some web services that I've created myself and some web services that I've imported from WSDL files. I've setup a couple of desktop application through Netbeans in order to consume these web services. I'm not too sure where to go from here.
I have the GUI setup but not sure how to reference the web services so they can be consumed. I was wondering would anybody be able to guide me through this process or point me in the direction of a relevant tutorial. I'd also like to learn how to consume a web service through a JSP (also created in Netbeans) if possible.
Thanks.

You may find this tutorial useful:
http://netbeans.org/kb/docs/websvc/client.html, but since you are using Netbean 6.5 this may be the correct version:
http://netbeans.org/kb/61/websvc/client.html. As the steps show, it isn't difficult to build a jax-ws client using Netbeans.
But, it depends on what version of Java you are using also, most likely. You may want to download the latest version of jax-ws, if you get errors with your wsdl.
For a JSP, just create a custom tag to call the client.

Related

How to run/debug java web service project in eclipse

I have a Java Web Service project which was just handed over to me by a colleague who just resigned (no one is assisting me in my new company). Im new to Java (J2EE) and my background is .Net + frontend + azure so I am pretty much very confused with setting up and running the java project. Also, Since my background is .Net Im referencing everything with how things work in Visual Studio from running a project, setting up a project to setting up and debugging a WCF project which I realized now is very different from eclipse + java.
I would really appreciate if someone could explain to me how I can run this project which is supposedly a java web service (as I was told)?
First I have a project that is like this:
Im assuming that the project boxed as blue is the webservice (and the rest are just libraries)? Is this correct? if so how do I run and debug the project using eclipse
Second when I click on debug as -> debug on server this is all I see:
Another colleague told me to install JBOSS (I haven't installed a server in eclipse) because that is what they used. Is there good documentation (step-by-step guide) on how to install JBOSS to run in eclipse. Im assuming that JBOSS + eclipse is like IIS express + Visual studio. Are there also other alternatives to JBOSS + eclipse like perhaps tomcat + ecplise that I can configure.
I really really find it hard to setup the java web service project in eclipse I have little to no prior experience with java j2ee programming especially with web services so any clarifications with my questions would be much appreciated. To sum up:
How would I really know that the project is a java webservice?
If so, how do I run the project and host the project using debugging in eclipse with tomcat or jboss?
I would appreciate if anyone can point me to the right direction of figuring out the source code
From here we can only guide you, you will have to go through some tutorials to understand how java projects work.
Your project is a webservice project according to your web.xml file because its having context params for rest.
the context param sets a front url to your webservice which in this case is gametime.
Check these tutorials and you will understand how it works
http://www.mkyong.com/tutorials/jax-rs-tutorials/
Create simple examples given in the above tutorial and then you can execute your's program
Jboss is a application server which we use to run our app.
You can install jboss in eclipse or you can use it externally also.
To install eclipse and jboss you can follow the link
http://theopentutorials.com/tutorials/java-ee/installing-jboss-tools-in-eclipse/
The other option is to download eclipse and jboss seperately
and use them.
Go to jbosshome/bin
If you download both of them seperately
then in that case for jboss
Invoke the add-user.sh or add-user.bat script. ...
Choose to add a Management user. ...
Choose the realm for the user. ...
Enter the desired username and password. ...
Choose whether the user represents a remote JBoss Enterprise Application Platform 6 server instance. ...
Enter additional users. ...
Create users non-interactively.
After this go to eclipse and follow steps of below link to add jboss to eclipse
http://www.mastertheboss.com/eclipse/jboss-eclipse/jboss-and-eclipse
A Java web application among other things has a predefined directory structure including folders named WEB-INF, WEB-CONTENT etc.
On how to deploy a web application to Tomcat via Eclipse you can follow the steps in this tutorial.

difficulty in deploying struts 2 application

I am a beginner with struts2 and I have few struts2 projects downloaded from a website, but they all are created as simple java projects and not as web-projects, so I am unable to deploy them on my Tomcat or JBoss AS server through Eclipse.
How can simple java projects be deployed on a Java EE server?
Your best bet is download sample applications from Struts2 official sites and deploy them on any of the server of your choice.
Those sample application comes with all required dependencies as well will give you idea about structuring of S2 application as well flow and configurations
I created a structure similar to the one shown on website and manually added all the files required and it worked.

Eclipse BPEL web service deployment testing

I have created a BPEL project in eclipse using BPEL visual designer. After deployment, i can right click on .wsdl file and choose Web services >> Test with web services explorer.
This opens up a window in eclipse itself.
Is there a way to do this in browser (chrome etc..) ?
Also, i know this is pretty basic, but how to use the generated wsdl and Bpel(like how to deploy in server(in my localhost) for instance ). Any links on basics would be of great help.
I don't know a good web-based Web service testing tool. You may give the try-it functionality of WSO2's products a try. In any case, I recommend using SoapUI, which is absolutely awesome for testing Web services.

how to integrate Spring and GWT from 2 different projects

I am tying to integrate a gwt project with my already running spring project.
i am using eclispe, and i have a Spring MVC application that receives JSON requests.
i am using the built in Tomcat to run my MVC application.
now i would like to create a new GWT project and have it communicate with my spring project with JSON.
i understand that they need to run on the same ip and port so i would not have to make cross site communication.
if i try to run my GWT application as run-as->Web application (which is the normal way for the project) on the same port as the Tomcat server i get an error that the address is already in use (which makes sense)
i tried creating a new dynamic web project and make it look the same as the GWT project. even though i am able to run the application, nothing happens, and the "entry point" is not run (i am not getting any errors or anything) it just runs the default HTML welcome file and thats it. with out any GWT.
what am i doing wrong, i am surly misunderstanding something about how all this should work.
can anyone help me out please.
You need to select that you are running on an external server:
That is a question that can't just be answered with yes or no. It all depends on your overall architecture and what you are trying to achieve.
As I said, if it is both the same application I'd recommend to integrate the Spring project into the web project. (and if that's the case, the spring project does not need to be a web project)
If the spring project is its own application and maybe running on a different server, keep them separated. Extend the spring project so it offers the functionality (via ejb or webservice) the gwt-web project needs.
Nevertheless, I recommend you do some reading about how Java EE applications should be designed and what the different tiers (client, server/service, business, etc) are for. Oracle/Sun offers some good articles. For example: http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/ or http://docs.oracle.com/javaee/5/tutorial/doc/bnaay.html#bnabb.

JSP client for Axis2 web service in Eclipse

I am new to web services and have managed to convert an Axis1 web service to Axis2. I can get data back from it using the Web Service Explorer with Eclipse. I am using Eclipse 3.6.1, Tomcat 5.5, and Windows XP. Problem is I am missing the JSP client to test with.
When you generate a web service using Eclipse and Axis 1, you get the generic 3-frame JSP test client with the methods on the left, input and results on the right. Can't seem to get this to happen with Axis 2. I have tried the Dynamic Web Project, Web Service, Web Service Client, and Axis2 CodeGen wizards in Eclipse, in various combinations, and all I get is a xxxCallbackHandler.java and xxxStub.java. I am able to test using the Web Service Explorer, but I need the JSP client because we have folks doing testing who aren't developers and don't have Eclipse.
I tried converting the JSP test client from the old Axis 1 service. This didn't go well because there are lots of references to org.apache.axis stuff that isn't part of Axis 2 (or at least reorganized to the point I couldn't find it).
Any suggestions on how to get a JSP client to generate or, if I need to build one, maybe an example? I have Googled to the point where every search I do for jsp, client, webservice, and eclipse, all the results come back purple. Somebody's got to have had this problem before...
If you need some UI tool for testing, I do not necessarily need JSP generated by Axis but can use some tools like SoapUI.
This is their guide how to do functional testing with SoapUI: http://www.soapui.org/Getting-Started/functional-testing.html
I came across the same problem using Eclipse Helios and Indigo on a Win 2003 server. The issue seems to be a bug, see here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=341525.
I am using the Web Services>Create Client wizard to do my testing by letting Eclipse test the client with it's automatically generated JSPs at the end of the wizard.