Generating Web Services server using Axis2

Everybody knows that you can easily generate Web Services client classes just from WSDL file in Java.
You even have such tool (wsimport) in every JDK distribution (check JDK_HOME/bin). It handles
all XML data types to Java mapping and generates all complex types needed. You even have such tools
for many other programming languages. Scripting languages don’t need them at all, they generate them
on the fly.

But what to do if you have to implement WS client and only thing you can get from your customer
is a WSDL file? Of course you can generate client classes from it. But how to test it? (You wouldn’t give
untested code to your customer, won’t you?)

Continue reading…

Advertisements

Web Services in Ruby, Python and Java

Today I’ve had to prepare some examples to show that web services are interoperable. So I’ve created a simple web service in Java using Metro and launched it on Tomcat. Then tried to consume them using Python and Ruby. Here’s how it all finished…
Continue reading…

Why NetBeans is awesome. Part 2: Intelligent Java code completion

Welcome to another part of “Why NetBeans is awesome” series. What I’d like to show you today is how does NetBeans smart code completion work. Let’s look at this simple example:
Continue reading…

InfoShare 2011 conference

Been on technical track of InfoShare conference last Friday. Mostly to attend Adam Bien presentation and workshop. All the conference talks were great, but what I need to say is that Adam presentations are something you can’t miss. 100% Java and no marketing bullshit as someone said :). It was just that. No slides, no off topic, just code. You could ask whatever you were interested in regarding J2EE and Adam was ready to answer. Not on next Friday, but here and now. He’s a real pro and if you have an opportunity to meet him on some workshop, then you really have to go. I was driving for 5 hours for this conference and it was worth it.
Continue reading…

Force Outlook to check if subject is set before sending message

Did you ever forgot to set subject when sending email? Finally found solution today:
http://www.benh.org/techblog/2006/07/forcing-outlook-to-send-emails-only-with-subject/

Alias to open latest log file in Windows Power Shell

Few days ago I’ve posted an alias to open latest log file of your application in bash shell. Same is possible on Windows environment if you use Windows Power Shell command interpreter. What you have to do is edit your profile.ps1 script and add a new function:

set-alias ed "C:/Program Files (x86)/Notepad++/notepad++.exe"
$global:app = "D:/MyApp"
function log {
   $myfile = ls $app/logs/*.log | sort -property lastwritetime | select -last 1
   ed $myfile
}

Of course change value for ed to your favorite editor/log viewer.
Here’s where you can read more about PowerShell profiles:
http://msdn.microsoft.com/en-us/library/bb613488(v=vs.85).aspx

Now just restart shell and execute log command.

Alias to open latest log file in Bash shell

Here’s a simple bash alias to open last modified log file in logs directory. It will be opened in less pager on last line:

alias log='less +G $(ls -ctr1 $APP_HOME/logs/*.log | tail -1)'


You can put it somewhere in ~/.bashrc or ~/.bash_profile and declare $APP_HOME somewhere above this line. You might also need to change /logs/*.log path.

Save file. Run source ~/.bashrc, and you’ll see last modified log anytime you call log command.

You can also substitute less +G with tail -f and open log in follow mode (it will automatically show anything new written to file)

Why NetBeans is awesome. Part 1: Swing form editor and custom components.

I’m great fan of NetBeans IDE and think it really doesn’t get enough noise. So I’m starting my Why NetBeans is awesome series of posts that show some NetBeans features you might not know about, but are really cool or makes life really easier.

First in the series is about great Java Swing form editor and how you can use it with custom components you have created in your application. What NetBeans allows you to do is to just add your components to palette and drag’n’drop it anywhere you need it. What’s coolest there is that it will look exactly like you designed it and will allow you to operate on properties (via getter/setter you have in your component) using Properties table you’re used to while working with ootb Swing components. Here’s how…

Continue reading…

J2EE JDBC based authentication with JPA Entities in Glassfish

One of the authentication options you get in Glassfish is to store your users/roles just in database tables. This way you can implement your custom UIs and logic for managing users. Usual solution you’ll find over the web for that is to create them by hand with SQL and fill using JDBC. What I needed was to get some entities for the users so I just could start my app and everything is created by JPA. This is not that easy, as Glassfish has some assuptions about tables you use (as it’s also using plain JDBC to retrieve users from database). Here’s how I’ve managed to do it using JPA 2.0 entities:
Continue reading…

Java 7 listen for file/directory change

Today I’ve started to experiment with some new features we’ll get in Java 7. First is filesystem WatchService which allows us to listen to changes in some directory without any pooling. Looks really great. You just register to be notified about change and wait to get your notifications. Best of it you can assign as much listeners as you like and even from different threads with no code changes, it all is thread save. Here’s what I’ve done to get notified about files being modified/removed/added to my very important TEMP directory:
Continue reading…

%d bloggers like this: