Dimuthuc’s Weblog

Just using what others shared..

Changing My Blog to dimuthu.org

So I m moving my blog again. It is not back to here. Instead it is to my own domain and own space.

Visit http://www.dimuthu.org for my new blog and the web site.

It is still a new. and I m hoping to upgrade and update it as regular as possible. Hope you too join me in new place. :)

July 19, 2008 Posted by dimuthuc | Private | , , , | No Comments Yet

Good Bye WordPress!!

So its been few months I m blogging here, But I think I should go back to my old blog in Blogspot. The main reason I fed up with WordPress is it is too inflexible, we are not allowed to edit HTMLs of our templates. And there are some other reasons which I blogged in my come-back blog in the Blogspot.

So I did some fair amount of blogs in here, And I found I m having fair number of visitors as well. So it s no doubt wordpress is really great, but just not good enough for me. So GoodBye wordpress!! (Hope we meet again;)

Continue to http://dimuthuc.blogspot.com ..

January 6, 2008 Posted by dimuthuc | Private | , , , | No Comments Yet

Moving Back To PHP

So we hit the WSO2 WSF/Ruby 1.0.0 release meeting the deadline in time without any problems. So now it is the time to wait for people to use it watching how they respond, and fix problems and improve functionality accordingly. Until that I m moving to the WSO2 WSF/PHP which already have a well-established community.

Few months ago before starting WSF/Ruby project, I did some simple things with WSF/PHP like writing demos and sample apps and now it is the time to go much deeper into that. In next few months I ll spend most of the time listening to the community, helping them, writing blogs, articles and most importantly writing demo applications to test our own code. This would be a big test for me, but I think I like doing that. Meanwhile I make sure I have some time to go into codegen JIRAs as well.

So hope to meet you in many blogs in future. Happy reading blogs!!

January 5, 2008 Posted by dimuthuc | Private | | No Comments Yet

New Year Gift for Ruby Developers, The Brand New Web service Dev Kit

Finally WSO2 Web Service Framework for Ruby (known as WSF/Ruby) is reached the milestone 1.0.0. It took us only 3 months to hit this as it was based on well established code in WSO2 WSF/C which is proven to be embeddable and most importantly we had WSO2 WSF/PHP which make more easier to do the same thing with ruby.

In this extension the consumer is written using swig interfaces which does the talk between ruby and c languages, but the provider engine is completely written in C which provides the high performance required in an enterprise level applications.

When compared with the other soap extensions of ruby, You will find this is the only choice that support following set of features,

  1. Full Support for MTOM binary attachments.
  2. WS-Security with username-token(For Authentication), sign(For Non-Repudiation), encrypt(For Confidentiality), time-stamp(For avoid replay attacks) support.
  3. WS-SecurityPolicy based configurations
  4. WS-Reliable Messaging
  5. The simple client and service APIs.
  6. Interoperability with Java, C, .Net

And it has a really comprehensive guide and blogs which update the community with really interesting thoughts on web services on ruby. Ruby developers like to write internet programs in few lines of code. So they will find this is the product for them to write web service clients and services in their natural style.

January 5, 2008 Posted by dimuthuc | Programming, WSF/Ruby, WSO2, Web services | , , , , , | 2 Comments

Last JIRA for the Year 2007

Today I managed to commit the code for support simple type lists for WSDL2C tool. The user interface for handling list is exactly the same as arrays. So the generated code provides set_at, get_at, add, sizeof and remove operations for the list properties.

(1)

<xs:element name=”ElementArray”>

<xs:complexType>

<xs:sequence>

<xs:element maxOccurs=”unbounded” name=”Element” type=”xs:string”/>

</xs:sequence>

</xs:complexType>

</xs:element>

(2)

<xs:element name=”SimpleList”>

<xs:simpleType>

<xs:list itemType=”xs:string”/>

</xs:simpleType>

</xs:element>

The above two schema representation would be serialized as in the following xml.

(1)

<ElementArray>

<Element>String1</Element>

<Element>String2</Element>

</ElementArray>

(2)

<SimpleList>String1 String2</SimpleList>

But when you look at the WSDL2C generated API, you will see the same set of functions are there to access and modify these values .

That is,

adb_ElementArray_add_Element() <—> adb_SimpleList_add_SimpleList()

adb_ElementArray_set_Element_at() <—> adb_SimpleList_set_SimpleList_at()

adb_ElementArray_get_Element_at() <—> adb_SimpleList_get_SimpleList_at()

adb_ElementArray_sizeof_Element() <—> adb_SimpleList_sizeof_SimpleList()

adb_ElementArray_remove_Element() <—> adb_SimpleList_remove_SimpleList()

Similarly we can provide the same API to complex type choice and simple type union, although they are also serialized completely differently.

(1)

<xs:element name=”ElementChoice”>

<xs:complexType>

<xs:choice>

<xs:element name=”StringElement” type=”xs:string”/>

<xs:element name=”IntElement” type=”xs:int”/>

</xs:choice>

</xs:complexType>

</xs:element>


(2)

<xs:element name=”SimpleUnion”>

<xs:simpleType>

<xs:list memberTypes=”xs:string xs:int”/>

</xs:simpleType>

</xs:element>

And these will be serialized in to the following kind of xmls,

(1)

<ElementChoice>

<StringElement>String1</StringElement>

</ElementChoice>

Or

<ElementChoice>

<IntElement>5</IntElement>

</ElementChoice>

(2)

<SimpleUnion>String1</SimpleUnion>

Or

<SimpleUnion>5</SimpleUnion>

Which one to be serialized is decided on the basis which was the last to set. So the user can freely set the desired value at anytime, without worrying about freeing or resetting earlier values.

The code for handling ‘xs:choice’ is already there ( just from yesterday), And the union support will also be implemented very soon.(What I should do is just edit some xsl files, the engine is already there with WSDL2Java tool). Then WSDL2C will be able to serve for most of the ‘WSDL’s without many problems.

December 31, 2007 Posted by dimuthuc | WSDL2C/ Codegen, Web services | , , , , , | No Comments Yet

First trip in the year

Well I m really bad in going trips, and finally managed to go one and it was really a great one too.

The trip was to visit the waterfall ‘Hath-Maale Alle’ (means for 7-steps waterfall) near Deniyaya (A suburb in southern province of Sri Lanka).

I took some photos from my phone-camara. Although they were not in the best of quality, it is enough to give some idea how wonderful it was. I uploaded some of them in flickr (Just click here to see my photos). And this is my first uploading to the flickr too.

December 25, 2007 Posted by dimuthuc | Private | , , , | No Comments Yet

WSO2 WSF/Ruby Stepping towards 1.0

Yesterday We were doing an RC on WSO2 WSF/Ruby. It will enable growing ruby and rails developers to feel the taste of WS-* stack without having any trouble.

WSF/Ruby is based on the WSO2 WSF/C which itself based on set of apache web service projects like Axis2/C, Rampart/C, Sandesha/C, Savan/C. So the WSF/Ruby will be great platform to experience the power of these project.

Consuming a web services with WSF/Ruby is really simple. It need very few line of code to do a simple web service,


require "wsf"   req_payload_string = "<greet> Hello </greet>" 

client = WSO2::WSF::WSClient.new({"to" => "http://greeting_host/myservice"}) 

res_message = client.request(req_payload_string) 

p res_message.payload_to_s << "\n"

The service provider code would be simple as this, You may put this on some function in the controller class inside Rails. (Yea I mean Ruby on Rails)


def greet(message)      if message.payload_to_s == "Hello"   

      "<greetResponse>Welcome!</greetResponse>"   

   else 

      "<greetResponse>Still Welcome!</greetResponse>" 

   end 

end

service = WSService.new({"operations" => {"greet" => "greet"}}) #the greet service operation to greet function map 

res = service.reply(request, response) 

render :text => res

Ok, That may seems ordinary. How about improving the service by authenticating the user with username tokens,Consumers may give their identity by adding some options at the constructor of WSO2::WSF::WSClient,


   policy_content = {"use_username_token" => true}   

 policy = WSPolicy.new({"security" => policy_content})   

 security_options = {"user" => "dimuthu",   

     "password" => "not my real one",   

     "password_type" => "Digest"} 

security_token = WSSecurityToken.new(security_options) 

options = {"to" => "http://greeting_host/myservice", 

      "policy" => policy, 

      "security_token" => security_token} 

client = WSClient.new(options)

And the service provider will also change their code just to authenticate the user,


  def passwordCallBack(username)    # hopefully you will be taking the password out from database   

  if(username == "dimuthu")   

    return "not my real one" 

  else 

    return "I m a guest" 

  end 

end  

policy_content = {"use_username_token" => true} 

policy = WSO2::WSF::WSPolicy.new({"security" => policy_content}) 

sec_token = WSO2::WSF::WSSecurityToken.new({"password_callback" => "passwordCallBack", 

                                            "password_type" => "Digest"}) 

wss = WSO2::WSF::WSService.new({"operations" => operations, 

                                "policy" => policy, 

                                "securityToken" => sec_token})

Similarly not only the username token, but also complete specifications of WS-Security, WS-Addressing, WS-Policy and WS-Reliable messaging can be used from a simple script with WSF/Ruby. This API is proven to be simple and popular with its predecessor WSO2 WSF/PHP. Hope we can do the same in Ruby as well.:)

December 8, 2007 Posted by dimuthuc | Programming, Ruby, WSF/C, WSF/PHP, WSF/Ruby, WSO2, Web services, axis2/c | , , , , , , | 1 Comment

adb with base64Binary and xmime.xsd – little howto (Sending binary with Axis2/WSDL2C)

This is to put a pointer to a mail in axis2/c user list appeared few months ago, It is a little how to on using Axis2 WSDL2C to generate code to send binaries. Please check the following link to find the howto. http://markmail.org/message/sdkccr3ixve3psyv (It will be on a zip file)

There Mark Nüßler is sharing his experience of sending binaries with Axis2/C specially from WSDL2C generated code.

Hope he will excuse me for mentioning it here.:)

December 6, 2007 Posted by dimuthuc | WSDL2C/ Codegen, Web services, axis2/c | , , , , , , | 1 Comment

Ubuntu

I installed Ubuntu 7.10, Gutsy Gibbon. It helped me to install drivers for my wireless and vga cards even from proprietary vendors without any trouble. And it s getting really great day by day. It has made a situation where any window user can come to Linux without much problem.

No wonder why Ubuntu is so much popular, http://www.google.com/trends?q=ubuntu%2C+red+hat%2C+fedora%2C+suse%2C+debian

December 2, 2007 Posted by dimuthuc | Private | , | No Comments Yet

Axis2/C codegen helper tools

In a case somebody feel not well to work with the WSDL2C tool, I have written some scripts to help generating demos, writing tests and building code. From that I think the demo generation script should be really useful. It s a ruby script and you can download it from here. (http://people.apache.org/~dimuthu/leisure_time.html, check the script under 23th October 2007)

What you should do is generate the code using WSDL2C tool (It can be either stub or skel), and run the script within the generated files. If it is stub, then there will be a demo.c file, which is a complete demonstration of writing all the operation using ADB objects. And if it the skel, then the demo filename will be axis2_skel_myservice2.c (axis2_skel_myservice.c is the original generated file). That has implemented some fake logic to show how each operation can be built using ADB.

I hope this will be useful to people who are searching for WSDL2C tags.:)

December 1, 2007 Posted by dimuthuc | WSDL2C/ Codegen, Web services, axis2/c | , , | 6 Comments