Sunday, July 21, 2013

Monday, February 4, 2013

Simple webservice Client using Java

Moving from Rails to Java is not an easy decision....but made it and have started loving it (no other option though ;-))

 My Task: Make a webservice client which can simulate SOAP UI at a very basic level.

 My Env
 Java: 1.5, Weblogic: 11

 Options that I considered
2) Apache Axis
3) Simple exchange of xml's using http connection.

 I have WSDL file available

 Problems faced with SAAJ:
 SAAJ: I felt this as close to the best option as i had the control of forming the SOAP request from the base,Ii mean the SOAP header, Envelop to adding nodes and child nodes with their attributes. I started forming the request and ran a mock test to find the destination "This class does not support SAAJ 1.1", with out much delay and started to work on the other option "Apache AXIS".

 Problems faced with AXIS:
 If your webservice deals with primitive datatypes then this is the best option, also there are lot of tutorials online for Axis. Infact you can get your client ready in less than 10 mins using Axis. But in my case I had to deal with Complex types. Unlike Primitive types complex types needs to be Registered using a Typemappingregistry inorder to have Java data types to bind with a XML type. This is the most complicated part and consumed a lot of time, I was not able to find any clear online resources that could guide me through type mapping, serialization, deserialisation and finally registering custom java classes. If you could get through "failed to serialize class" and "mapping lookup failure" issues then you are through.
 I even tried the wsdl2java option that axis has to create stud files from wsdl, but even this did not help.

 Http connection
My time was limited so I was suggested to go for a basic xml exchange using http connection, this worked like a charm. You just need to connect to webservice end point url, set connection property, get the stream to post request xml and wait for response. Perfect choice for a time constrained requirement.

Wednesday, November 25, 2009

Detect Firebug using javascript

Firefox users with FIREBUG add on, would have often seen messages stating "Firebug is known to make Google Mail slow unless it is configured correctly".

Firebug detection can be implemented using javascript


Windows.console.firebug will return the version of firebug.