Thursday, February 26, 2009

CXF - How to set a custom endpoint address

For some reason it is rarely straight forward how to configure a Java Web Service framework to use a custom endpoint address (one that is not in the WSDL). Anyway, here is how you do it in CXF:


URL wsdl = getClass().getResource("myservice.wsdl.xml");
MyService service = new MyService(wsdl).getMyServicePort();
BindingProvider bp = (BindingProvider)service;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, URL);

Thursday, February 19, 2009

Linux one liner: When did I come to work today?

I'm usually quite tired when I get up in the morning. Beeing a consultant with flexible hours, it is often easy to forget exactly when I got to the office in the morning. So I figured i had to write a script to check when I started my computer. What it does is checking the syslog for the first occurence of todays date. I'm running Ubuntu linux and the syslog file is rotated a while after my computer has started. This is why I'm checking syslog.0.

The magic one liner:

date "+%b %d" | xargs -i grep -m1 -i {} /var/log/syslog.0
|awk '{ print "Today I got to work at " $3 }'

(Syntax plugin didn't handle long lines properly. Remove the and put the entire thing on one line.)