How to wadl2java these days? - java

I have real difficulty finding commandline tool to convert WADL to java. No matter how much I try to google, follow blogs or java.net doc, there is no real download link. (links are broken or obsolete).
What particular vendor, community group is supplying this tool ? Does free download link exist ?
The generated code should be able to reconstruct POJOs from XML responses and survive inside Tomcat 7.
Thank you
Answer: (this works only after June 2011):
Take Apache-CXF-2.4.1.zip (not any of the earlier versions)
Extract it to root folder
Take Apache-CXF-2.4.1.src.zip
Search for folder named distribution inside src
Extract ditribution folder and merge it with no overwrites to root folder
goto bin and spot the wadl2java.bat
run wadl2java.bat from command prompt
continue with no brainer details

Apache CXF recently added support for WADL-first development of REST services. For more background information on its wadl2java tool, this blog entry by one of the CXF committers should help.

I had some trouble using the CXF 2.5.4 wadl2java tool. It kept complaining of a missing "resources" element in my WADL file, even though it contained one.
wadl.java.net has a download of wadl2java that worked for me.

Just to give an update with CXF version 3.2.1 it worked for me.
Steps are
Download anywhere
Unzip
Go to /bin
Run wadl2java to get the usage
Run wadl2java -p com.x.y.z wadl-file.xml to generate your classes in current directory.
By the way I noticed that it created a class with a space in the name and also created classes with name starting with digits :)

As of Apache CXF version 2.7.11 just download the binary zip / tar.gz, set CXF_HOME env-var to /path/to/apache-cxf-x.y.z and wadl2java is available at $CXF_HOME/bin

For generating client side stubs from WADL, use a tool wadl2java.
Download wadl tool from here:-
http://search.maven.org/remotecontent?filepath=org/jvnet/ws/wadl/wadl-dist/1.1.5/wadl-dist-1.1.5-bin.zip.
For genearting client side java stubs(POJOs), use this command:
\wadl2java -o .\src -p com.test.client WADL_FILE_LOCATION
If you are using maven project then you can use wadl2java maven plugin for this work.

Related

Export GitHub Repository Files to a Usable JAR executable file, issues

I am an enthusiast attempting to play around and add things to an app that I have been using for the past year which the source codes are available in GitHub. Problem is when I clone or download the repository and open it in Eclipse, I get a ton of error codes whenever I try to 'run as' Java app (in particular I am unable to find the 'main class/starting point' there's way too many files to chose from to find it and most don't work) and when I try to extract the files to an executable jar it gives me a JAR exe that is unusable :-(. I know that the files are workable since I do use the executable jar that is available from the developer and others have also toyed around with the source codes.
Can anyone assist me with this? Maybe I am using the wrong Java manipulator/application. The program I am using for opening these files is Eclipse IDE for Java Developers and my operating system is 64bit Windows 10.
Also, here is the GitHub URL for the repository, in case anyone asks: https://github.com/DraqueT/PolyGlot.
I thank anyone who can be of some assistance as I have been working on this forever and can't seem to find a solution.
The github project looks a lot like a utility library than a full application. But the following could help:
Try to study the README file attached to the github project. (There is one in the source code according to the author). This would help you to setup the project.
Make sure to download all the dependencies for that project. Again, the author has provided some of them in the github project (I could see some Apache POI libraries in there somewhere), but getting the required jars on the maven repository isn't that difficult.
It would also help to know what type of project it is. For example, having a main method in a web application doesn't do much for you, but a Java SE project would need a main method to run. So try to find out what kind of project it is.
If all else fails, you could try to contact the owner of the repository or one of its contributors to assist you.
Cheers!

How to programmatically retrieve some build files in TeamCity?

I'm currently doing a plugin for TeamCity 8.1.4 to support our tool. The latter generates some JSON and HTML/CSS/JS files I would like to include in TeamCity UI through respectively a graph and some kind of frame I guess.
Our tool is supposed to generate these files in the directory of the project after each build is finished. I read in the docs that I could create "build artifacts", which are basically files kept on the server side. I figured I could then access them with getArtifactsDirectory() method from SBuild interface. The thing is, I have no idea how to instruct TeamCity to create a build artifact programmatically. Or maybe I'm thinking this backwards and there's another way to do this... I'd appreciate some pointers since the Plugin community forum looks dead.
If you are looking to adding an HTML content to build results or projects, please check out this documentation page: 'Including third-party reports in build results'
Configuratoin described in this doc can be done using Java API:
see jetbrains.buildServer.web.reportTabs.ReportTabManager docs to configure tab settings on server side.
see jetbrains.buildServer.agent.artifacts.ArtifactsWatcher to publish files from build agent. This one is used to publish files as build artifacts.
UPD The abovementioned components can be used by plugin to configure 'third party report tab' (without any manual configuration). This way, plugin can provide html report from build without need to access uploaded artifacts.

How do I reference libraries in NetBeans?

I have a Java Web Services project that was created in an older version of NetBeans, and I haven't accessed it in many months, so my paths and installed libraries are different.
When I try to open the project, I get a "Resolve Reference Problems" dialog, and two Reference Problems are listed:
"metro" library could not be found
"JAX-WS-ENDORSED" library could not be found
I have a fresh installation of JDK 6 Update 25 with NetBeans 7.0, and am running Windows 7.
What steps can I take to solve this? I don't even know where to start, as every approach I've taken so far hasn't gotten me anywhere.
Note: JAX-WS-ENDORSED does not appear in my Libraries listing, so I can't remove it. Something hidden is referencing it. How would I find this?
I just came across this issue and found some help from http://netbeans.org/bugzilla/show_bug.cgi?id=187145. Apparently, Netbeans will create the JAX-WS-ENDORSED library when a new web service is created. So go to File > New File, choose Web Service > Web Service Client and fill in dummy values (this can be done in a throwaway project). This client can then be removed, and Netbeans will have created the library with the following classpath entries:
java/modules/ext/jaxws22/api/jaxws-api.jar
ide/modules/ext/jaxb/api/jaxb-api.jar
These are relative to your Netbeans install directory (on OS X will be located in Contents/Resources/Netbeans within the .app). Alternatively, you could create the library manually using the entries above.
This only needs to be done once, as the library will be added to Netbeans Global Libraries list.
The best solution is to edit project.properties file and replace below piece of code.
Original property: endorsed.classpath=\${libs.JAX-WS-ENDORSED.classpath}
Replace with: endorsed.classpath=\${lib.JAX-WS 2.2.classpath}
In older versions of Netbeans there is JAX-WS-ENDORSED library in libs location.
Newer versions of Netbeans having JAX-WS 2.2 library in lib folder
** ALL THE BEST **
If it is still needed, I had the same situation when opened a netbeans 6.9 project in netbeans 7. There is no way to resolve the 'jaxb-endorsed' (in my case was jaxb and not jaxws) reference using the libraries window.
I found a endorsed.classpath property in the nbproject/project.properties file.
I still not sure what is its purpose, but in this property I found the bad reference to jaxb-endorsed.classpath, so I deleted, closed netbeans and opened again, and the reference problem has gone.
I already have Jaxb 2.2 library added to my project, so it is working good with the modification I did to the project.properties.
I hope it helps.
I had a similar problem : DO NOT DELETE THE JAX-WS-ENDORSED - remind me to downvote. I had to go to the imported project > resolve reference
problems dialogue > delete the references from there which were pointing to the old NB folders - pic :
and then create the throwaway web service as suggested by William Scott and then add the newly created jars :
Netbeans maintains a set of libraries, which are simply a convenient way to manage groups of related jar files. Start by clicking Tools > Libraries. You will see the library manager window.
You will see the options to add your own libraries if you have jar files downloaded. If you do not see the library that you are looking for you can download them and add them your self. Once the library exist in Netbeans you can go to the Project Explorer window and right click on the Libraries tab of your project. Select Add Library and you will have the chance to add the library that you added in the library manager.
You may want to right click on your project, go to properties -> Libraries.
Remove the JAX-WS-ENDORSED library, and try using JAX-WS 2.2
Also remove metro and try adding METRO 2.0
That may solve your problem.
You may also want to right-click on your web service references and select
Edit Web Service Attributes
Then on wsimport Options tab see if xendorsed is set to true.
UPDATE
You may need to close netbeans and then open it again, and it may work. I was having a problem similar and I just did that and it worked.
The only difference, and it may not be needed, is that I also added the JAXB 2.2 library, but that was because I was trying to solve a compilation error.
I had same problem and Fix it by install soap webservice and and resful webservice in netbeans plugin
I fix it:
unistall netbeans.
delete HOME/.netbeans and HOME/.nbi
then install netbeans again
Old thread, different and effective solution... I just moved some projects from one system to another and got this error. With NetBeans v7.3+, go to Tools>Plugins, Available Plugins, then search for "SOAP". You should see "SOAP Web Services". On loading this library you'll get the JAX-WS-ENDORSED library. Restart NetBeans and you should be able to get a Clean Build.
Loading this package brings in a number of other libraries. On restarting the IDE you may get a notification that other packages now have available updates.
Do the following ( BTW in my case its NetBeans 6.9.1 )
1 Why this appeared now ?
Because i tried to open project on other pc with fresh copy of net bean
2 How the problem looks like ?
Jar Lib Not Found for JAX-WS-ENDORSED
3 Why it was needed at the first place and what its used for?
Well i have a webservice on same server/domain e.g localhost , so of course
it will work if i removed the web service from the folder in sources but i need it
4 What to do?
Try to add dummy any online free web service in form wsdl
like Some test web service or search for any other one
This is the source of my public free to use wsdl
5 What then ?
Just add it please
Now what ?
Wait for scanning project stuff it should be ok
you can re check from library properties of project
or see that there is no red/ or resolve references problem
in project properties
So what happened exactly?
Note: JAX-WS-ENDORSED it will be added automatically to your libraries
same methodology can solve other problems as well

Offline Javadoc Server

As not all our development machines have internet access, we want to cache the API docs of various libraries in our local network. I was thinking of a webapp that handles caching and listing the available Javadocs after someone uploads them (in jar format). Ideally, the source jars would be automatically pulled from our maven repository (artifactory).
I have not been successful in finding anything like this on google, so I'm trying my luck here.
EDIT
I have found a site that does exactly what I am looking for: http://www.jarvana.com The problem is that this site does not fulfill my #1 requirement - offline availability. So I rephrase my question to: Is there a webapp that works like jarvana but that can be deployed to a local server?
It seems like what I'm looking for really doesn't exist, so I've rolled my own really simple webapp that serves JavaDocs from a local maven repository (transparently extracting jar files). It's far from perfect, but it works for my requirements. If anyone is interested, I shared it on github:
https://github.com/planbnet/JavaDoc-Browser
Why not just use mvn site?
Hm, I'd better add something more useful than that :-)
mvn site will build and deploy a bunch of site reports including the javadoc (assuming you configure that plugin). Everytime your CI server builds the code from trunk/branch/tag/whereever, the latest Javadocs will be generated and stored on the file system (accessible via HTTP)!
There's even a cool report that ties the javadoc into the source code.
You can give wwwoffle a try. A caching proxy which enables to access sites while you're offline.
I wrote a python script some time ago to serve the javadoc from my local maven repo:
http://blog.robotninjas.org/2013/04/17/accessing-your-cached-javadoc-offline/
python javadoc.py
It's crude, but hitting http://localhost:8080/m2 will list all of the projects in your local maven repository with downloaded docs.
You can download all the javadoc jars for a maven project with:
mvn dependency:resolve -Dclassifier=javadoc

Debugging a jax-ws client in eclipse

I am writing a java client for a web service. I used wsimport to generate the proxies. Copied them over to my workspace project (in eclipse). Wrote a simple program using couple of ws calls. Now when I want to step into a soap call, eclipse says that source code for the file was not found (com.sun.xml.internal.ws.client.sei.SEIStub.class). It's using this class from rt.jar which is pointing to the src.zip that came with the installation. I noticed that src.zip does not contain the missing java files, so I downloaded them separately and tried adding them to zip file. I also tried copying them over to my project to see if I can trick eclipse into accepting them as the source file.
I don't write/debug Java on a regular basis so please help me out here. I really want to debug and see what jax-ws is doing differently from axis as the call works in the later implementation.
I believe that you can set the following System property to put JAX-WS in debug mode.
com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true
See JAX-WS Guide - Logging.

Categories

Resources