September 2007 - Posts

 I was playing with Netbeans today and wanted to see how I would be able to deploy a Webservice. I started by importing all the required Jar file. I used a wizard(Library Manager) so all the required Jars were already placed on my behalf. If you want to add them manually, here is the list of jars that were included in my project(I'm sure you don't need all of these).

 

 

 

 Now, the question in my mind was what if I weren't using netbeans? What if I'm doing all these manually through Ant? Or even without a build tool? I wanted to be able to deploy my webservice so I could access it to a web browser and see if it works. Let's try to create a webservice class first.

 

package com.test.ws.endpoint;

import javax.jws.WebService;
import javax.jws.WebMethod;

@WebService()
public class HelloWorldWS {
  private String message = "Hello, ";
 
  @WebMethod
  public String sayHello(String name){
    return message + name;
  }
 
}

In netbeans, when you create a Webservice using the "New" command then an entry in the web.xml is already made for you. I didn't know this before so I was really puzzled. Here are the entries

 
    <listener>
        <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
    </listener>
    <servlet>
        <servlet-name>HelloWorldWS</servlet-name>
        <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
        </servlet>
    <servlet-mapping>
        <servlet-name>HelloWorldWS</servlet-name>
        <url-pattern>/HelloWorldWS</url-pattern>
    </servlet-mapping>
 

There's also a file called sun-jaxws.xml create by the Netbeans IDE

<?xml version="1.0" encoding="UTF-8"?>
<endpoints version="2.0" xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime">
  <endpoint implementation="com.test.ws.endpoint.HelloWorldWS" name="HelloWorldWS" url-pattern="/HelloWorldWS"/>
</endpoints>


I do not claim that all these assumptions are correct. But studing all these entries gives me the idea that all requests goes to the com.sun.xml.ws.transport.http.servlet.WSServlet and delegated through your Webservice class. The WSServlet does a lookup in your sun-jaxws.xml file(and I do hope so that I'm correct).

 

Invoking the Servlet(http://localhost:8084/WSTest/HelloWorldWS in my machine) would yield this result

 

 And clicking on the link would give you the WSDL

 

What I don't like here is unlike .Net's implementation, there is a page wherein you could click on a method and put some parameters in it. I'd like to see something similar in Java.


Posted by lamia | 2 comment(s)

I posted before how I failed to answer some basic questions about SQL in one of my interviews. I thought I would never hear from them again. But then, just today someone called me and informed me and brought the good news. :)

I'm in the middle of choosing from a local MNC company and another MNC company, abroad. Whichever I get, is probably the one I deserve.
 

Though I probably don't deserve it, once again... Thank you Jesus, for taking care of me. :)

Posted by lamia | 5 comment(s)
Filed under:

I was on my way to a PinoyJUG seminar and I was waiting for a friend in Eastwood, Libis. While waiting for him, I decided to visit the bookstore and look for some Computer-related books. Being unable to find one, I found myself browsing through management/personality-growth books and there I picked one about project management which was thin, but its title, I forgot. There were many powerful lessons there but one that really fascinated me was the phrase "Don't think of unfinished projects as a failure...

I have to admit that I've quite a few unfinished project that I wish I was able to finish. I carried this burden throughout my career which I guess made me think lowly of myself. This simple phrase has a powerful lesson. You learned from those unfinished projects and therefore should think of it as a success.

Posted by lamia | with no comments
Filed under:

 I just had a talk with one of our senior .Net developers. I asked him if he know about Execution Plan and Indexing in Database. Hmmm... I was shown a diagram in SQLServer which apparently computes the cost of each query in percentage. I guess query optimization is just left with the programmer of the query after all. He also showed me how to create an Index. I learned that it makes searching faster on large records but has has a drawback of being slow if the table is being frequently updated(like something is being inserted every time).

I also got a bonus lecture on Cursors and Triggers. It's funny how I related to cursors to java.sql.ResultSet. Triggers to the Observer pattern as you set a trigger to a table and fire up a message to other tables if an update is made to the table where you set the trigger.

Wow, I think I just saved myself a few months or years of having to learn all these stuff. Of course, application of these knowledge will have to wait until I get into a project where I could utilize them. My heart feels so happy right now. :) I could burst down in tears!

Thanks to this Mr. MCAD, MCSD and the list goes on for his certifications. He is one M$ certification freak!

Posted by lamia | 2 comment(s)
Filed under:

And so it was said on the Mastering Enterprise Java Beans 3.0, chapter 5. I didn't understand the relationship of UDDI with Web services. If I understand it right, UDDI is some sort of directory lookup if a a webservice is availbale on a given end(e.g., a URL). UDDI however is not needed all the time since you could manually point your web service client to a URL that returns a WSDL document. So I think you could simplify the equation to

Web service = WSDL + SOAP

I've been hearing about SOAP since I was in my senior College days(back in the year 2005). I've read a couple of things about it but never really had the chance to write a SOAP message from scratch(and I know those who did would say, you're lucky you never did).

 

Posted by lamia | with no comments
Filed under:

Truly, in life... There is no shortcut. And the same rule applies to me. I just came from a very exhausting interview today and I was asked about several things about Java technology tools which I don't have experience with and SQL Performance Tuning.  The most frustrating question though was when I was asked about SQL. And what about SQL you might say? Listen to my story..

In a scale of 1-10, how would you rate yourself in SQL? I was confident enough that time to give myself an 8. I can write from simple SELECT, INSERT, UPDATE, DELETE to using JOINS, and perhaps some stored procedures, views and SQL scripts. I was asked about an Execution Plan. What the hell? Execution plan? I didn't know... Darn... My interviewer told me that if I gave myself an 8 then I should atleast know about this. I guess he was right, wasn't he? It was a good lesson for me not to be overconfident over simple stuff like SQL. There are indeed a lot of things that I still need to know. I was also asked about indexes which I already heard before but didn't do much reading upon. I wanted to tell him I wasn't applying for a database administrator position but I just kept my mouth shut to avoid any commotion. Lolz!

This is not the time to feel disappointed so I invite you to learn these things if you don't already know about these stuff yourself. Don't worry. We'll get better. Wink

Some useful links

SQL Tuning Tutorial - Understanding a Database Execution Plan
Database Index

You might also want to know that the standard chartered bank is a Bank and not a kind of Bank. Hahaha! 

Posted by lamia | 6 comment(s)
Filed under: ,

The usual way of making a webservice client in Java is by feeding Axis's WSDL2JAR tool or Using the Eclipse/Netbeans IDE with  a URL that looks something like http://someurl.com/webservice.aspx?wsdl . Alternatively, you could use a WSDL file. I thought WSDLs were always manually-generated until my team lead gave me a manually-constructed one(made due to client requirements). Obviously, this is more prone to errors because it was crafted by hand. I continuously received errors in my IDE saying things like the "Response was an invalid WSDL" and 404 error. I had a hard time convincing them that it was indeed the WSDL they constructed which was the problem. In the end, I've proven myself right and we ended up using the auto-generated one instead. Very silly... But I'm glad it was over...

Posted by lamia | with no comments

My officemate told me about this SuperWaba which is a Virtual Machine for PDA's. The syntax for developing apps is similar to the Java syntax. However, this VM doesn't implement any of Sun's specification. It is opensource but I don't think it's free.It works on old versions of Palm OS! See the list of their supported devices. I read in their website that you could use common Java IDE's in developing for this platform but as to which IDE's, I have no clue. Hmmmm... This should be interesting.

Posted by lamia | with no comments
Filed under: ,

Hi guys! If any of you are looking for a job or thinking of shifting from a Java career to .Net then take a look at the following:

This is for local employment 

General requirements:

  • 1 to 5 years experience, fresh grads are welcome to apply.
  • Good problem solving skills
  • Preferably with front-end and back-end web development skills
  • Proficiency in XML, XSL and XSLT is a plus but not a requirement
  • Knowledge in both Java and .Net technology is an advantage but not a requirement.
  • Knowledge or experience in using SQLServer 2000/2005
  • Visual Sourcesafe (or similar source control tools)
  • Knowledge or experience in using any bug/issue tracking system
  • Knowledge in creating SQL scripts, functions and stored procedures is a plus but not a requirement

Specific Java requirements:

  • Core Java
  • Servlets and JSP
  • JDBC 

 Specific .Net requirements

  • C#
  • ADO.Net
  • Webservices  

 

Visit our website. http://www.worldpartner.com. Interested applicants may e-mail their resume at timothy_samaniego@yahoo.com or paul.timothy@worldpartner.com

PM me for details. 

 

Syet, dapat naging headhunter nalang ako eh. Lolz.
 

Posted by lamia | with no comments

It's funny how the simplest of things could actually fool you. If you want to search for a particular String, let's say "Lamia", but you don't know if that name actually has some trailing numbers or something. You just know that it starts with "Lam". How do you search for this in SQL? I had this as a question in one interview and because maybe I had very little exposure to this keyword, I ended up using the regexp keyword in MySQL when the answer was just a simple WHERE username LIKE "me".

While working on a feature for my current project, I was searching for a username. So as an example, I use the username "Lamia" but don't know that it really is Lamia. I just know that it starts with "Lam". I tried the following

 

SELECT * FROM users_tbl WHERE username LIKE "Lam"

 
It didn't work. I approached my team lead (quite an intelligent person) and he told me to put a "%" in the end of the string.

SELECT * FROM users_tbl WHERE username LIKE "Lam%"

Now, I swear I knew what the "%" symbol mean. But I really couldn't remember so I searched w3schools. Okay, so the percent symbol is used as some sort of wildcard. I couldn't hate myself more! But again, this proves me wrong that I learn nothing in my current job. Lolz!

Posted by lamia | 3 comment(s)
Filed under: