Friday, January 27, 2006

VS : Looking at the SOAP proxy code

So you are writing a web client with Visual Studio (assume command line) and you need to add a web reference.

Solution Explorer - right click References - Add Web Reference.

Point to the WSDL - GO and it's done.

What's done? - where's the generated code?

Open File - navigate to Web References / WebReference / Reference.cs.

This will show the SOAP methods and signatures you can call.

It will start with "public class X".

So use:

X x = new X ();
and the SOAP call will be x.method.

(Hint - when compiling add a "using" to your main class and check the namespace of the generated code.)

The line "this.Url = "http://a.b.c.e"; " is useful. Change this url if you move your web service.

Enjoy.

Friday, December 23, 2005

Misc : 2005 reading list

The local library has a feature that stores all the books you have read so you can check your reading history.

Looking through this, the ones that were really enjoyed (in no particular order) were:

Under pressure : the final voyage of Submarine S-Five / A.J. Hill.

Excellent read and a prime example if how when there is a will, there's a way.

Rocketman : astronaut Pete Conrad's incredible ride to the moon and beyond / Nancy Conrad and Howard A. Klausner ; introduction by Buzz Aldrin.

Interesting and readable account of one of the real characters of the Apollo era.

The silicon boys and their valley of dreams / David A. Kaplan.

Really good overview of the .dot com boom and bust. Basically, the experts knew as much as the rest of us and they picked as many dogs as success stories.

The fate of Africa : from the hopes of freedom to the heart of despair : a history of fifty years of independence / Martin Meredith.

Excellent read. If you want to know why Bono and company waste their time trying to get read of 3rd world debt, read it. Ultimately a depressing story of how a continent with so much potential ended up bankrupt and in a mess. And a story of self-centered dictators more concerned with their Swiss bank accounts and orgies on the Riviera than their people starving and uneducated at home.

Dr. Space : the life of Wernher von Braun / Bob Ward ; foreword by John Glenn.

Good read, drags in parts. Doesn't really address the Nazi issues and how culpable he was with the treatment of the slave labour forced to build the V1 and v2.

Sinatra : the life / Anthony Summers, and Robbyn Swan.

Excellent read and an insight into his Mob links.

Dancing with cranes : on location with a New Zealand wildlife film-maker / Alison Ballance.

And you thought making wild-life movies was simple and easy. Quite staggering commitment.

A bright shining lie : John Paul Vann and America in Vietnam / Neil Sheehan.

Probably the best overall book on the war. Shows how much the top brass deluded themselves, how the war was screwed from the start and how the real victims were the Vietnamese peasants who were brutalised by both sides.

Enjoy!

Wednesday, November 30, 2005

Misc : George Best

Sadly, one of the all-times greats has gone.

When I was a kid, George Best was my hero. He was cool and fitted in with the whole 60's era - Carnaby Street, Twiggy, Mary Quant, the Beatles, Sergeant Pepper ... He was almost the fifth Beatle with his good looks and long, flowing hair. He was the epitome of what people aspired to - talent, youth, fame, fortune and a blond on each arm.

And he could play football! He had the support around him. In Man U's previous great era, George, Denis Law and Bobby Charlton were each voted European Footballer of the Year over a five year period. Show me another English club with that sort of record.

He was the master of the feint and the dribble. He leapt over tackles like a gazelle. And remember he played in an era where goalscorers were not protected as they are today. He faced such hard men as Chopper Harris, Norman Hunter, Billy Bremner and the like ... and he still scored goals.

He is the only UK player who belongs in the pantheon of the greats; Pele, Cruyff, Maradonna and Best.

He was never rated internationally because he never appeared in a World Cup. Northern Ireland last appeared in that competition in 1958 in Sweden when George was just a nipper. Maybe just as well - George in Sweden with those leggy, beautiful Swedish blondes would would been a potent distraction.

With Matt Busby as a father figure, he flowered. The pre-match instructions for George were "Go out and enjoy yourself" allowing full reign to his talent and individuality. Defenders hated him because he made them look ponderous, slow and stupid. Mostly they just saw his back, twinkling down the touchline.

The rot set in with the later managers - Frank O'Farrell, Wilf McGuinness and Tommy Docherty. They expected him to conform, to be part of the overall pattern, to be part of the common herd. It was never going to work and he walked away in disgust.

He left a massive hole at Man. U. Succeeding generations of footballers were always given the curse - "He's the new George Best". That "compliment" was a hospital pass. Ryan Giggs is a good example - a brilliant footballer, a great team man but the next Best? That's simply not achievable no matter how hard Giggs or anyone else tried - George was a one-off and we'll never see his like again.

Sadly, he forget that he was famous because of football, not in spite of it. He seemed to live on the tabloid's front page. Surrounded by sycophants and diverse hangers-on, he opened night clubs, advertised rubbish, partied and declined.

In his famous words, "I spent my money on booze, birds and fast cars. The rest I just squandered." The incredible talent that made him such a star also destroyed him. This seems to be a common theme - just look at Gazza. Perhaps Rooney should have been taken to the hospital at the end and told "Look - this is your life if you don't wake up"!

George has gone and an era has passed. Shakespeare wrote "the good men do is interred with their bones... but, their evil lives on and on". The "good" George did on the football field is certainly not interred and the genius and the memories will always remain. And what glorious memories - look here for a brief reminder:

http://video.google.com/videoplay?docid=6000929952097818068&q=%22george+best%22

R.I.P.

Friday, November 25, 2005

Eclipse : Writing java snippets in a scratchpad

For web server development, especially when the code is in a jar file, you need to write some code, stop the application inside the server, deploy the new one, start it all up etc. That takes time - and then you find that the code doesn't work so you try something else which takes more time and so on ...

It's much easier to write the snippet inside an Eclipse scrapbook first and test it.

"File / New / Other / Java / Java Run/Debug / Scrapbook Page

Then just write some code in the editor e.g.

System.out.println("Hello");

Then highlight the snippet, right click, "Display"

Bingo!

Enjoy!

Friday, November 18, 2005

Eclipse : Where's my console output?

Debugging my Java program inside Eclipse 3.1, I noticed that the console output which had tons of debugging statements was missing a large swathe of the initial output.

A bit of digging around found the option under Window / Preferences / Run/Debug / Console.

Uncheck "Limit console output" and you'll get the output you were expecting!

Enjoy!

Thursday, November 17, 2005

Java : String input to Digester

Every one of the gazillion examples out there use an XML file to demonstrate how to use Digester.

But what if you need to hand Digester some XML which is actually a String input.

Problem! The only String constructor needs a URI.

Well, you could write it to a file and then use the File constructor as input.

Yeah - right!

Use the StringReader class which converts a string to an input stream e.g.

StringReader sReader = new StringReader (AXmlString);
myResponse = (Response) digester.parse (sReader);

Enjoy!

Java : Digester debug logging

So you are trying to figure out why Digester won't parse the XML correctly.

You need the debugger!

Just apply the following run-time switches:

-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog

-Dorg.apache.commons.logging.simplelog.log.org.apache.commons.digester.Digester=debug

-Dorg.apache.commons.logging.simplelog.log.org.apache.commons.digester.Digester.sax=info

where the levels (e.g. debug / info) at the end at the line are the levels you require.

(Note: the

-
D

is actually -D.

The console will spit out exactly what Digester is doing and it's all a whole lot easier to figure out.

Enjoy!

Monday, November 14, 2005

Misc : Martins Bay - just north of Auckland (2)



And another one - this time looking north.

Enjoy!

Misc : Martins Bay - just north of Auckland (1)



Quiet and peaceful!

Enjoy!

Thursday, November 10, 2005

WL : Using wsdl2service to create the Java classes for servicegen

In the previous post, it talks about a_service.service.Java_ServiceImpl.

But where does this java class come from?

The answer is that it's created by Weblogic's wsdl2service. In the build.xml file, you would add:

wsdl2service
packageName="a_service.service"
keepGenerated="True"
generateimpl="True"

This utility reads the WSDL and then creates the classes.

Enjoy!

WL : servicegen and javaClassComponents

Weblogic's servicegen "takes as input an EJB JAR file or list of Java classes, and creates all the needed Web Service components and packages them into a deployable EAR file".

javaClassComponents has as input a "Comma-separated list of Java class names that implement the Web Service operation. The Java classes must be compiled and in your CLASSPATH"

This comes under the service element of servicegen so part of the build.xml would be:

service
serviceName="a_service"
javaClassComponents="a_service.service.Java_ServiceImpl"

So in the CLASSPATH, you would have:

set CLASSPATH=%CLASSPATH%;C:\...\a_service\service\Java_ServiceImpl.class;

and Java_ServiceImpl.java would than have a:

package a_service.service;

Note the "a_service.service" in javaClassComponents. If that's missing, servicegen will invoke javac which will then throw a "Class not found" exception.

But where does the Java class come from in the first place? See this

Enjoy!

Wednesday, November 09, 2005

WL : The task doesn't support the "generateimpl" attribute

Running Ant on Weblogic SP2 wsdl2service.

Get this weird message.

file:.../build.xml:xx: The task doesn't support the "generateimpl" attribute.

What?

The Weblogic 8.1 documentation specifically states that it IS an option:

"generateImpl - Specifies that the wsdl2Service Ant task should generate an empty implementation Java class file."

Pull hair out. Turn to best friend Mr. Google. Turns out this is a bug which has been fixed in SP3.

Download latest SP4 - problem solved.

Enjoy!