Saturday, October 4, 2008

Session Maintenance in JAX RPC Web Service

A good article avaialable at http://www.ibm.com/developerworks/webservices/library/ws-tip-stateful.html.

The article mentions how to enable service to use HTTPSession object. Also, it describs how Java web service client can participate in session.

But, for .net client

Just need to set CookieContainer of web service to
m_Service.CookieContainer = New System.Net.CookieContainer()

Refer: http://www.codeproject.com/KB/vb/WebService_Sessions.aspx

Friday, October 3, 2008

Trace SOAP Message in WebSphere

Enable trace for a Web Services for Java 2 enterprise edition (J2EE) server application.

  • Start WebSphere Application Server.
  • Open the administrative console.
  • Click Servers > Application Servers > server.
  • Click Change Log Detail Levels.
  • Add or delete the trace string in the text box.
  • For this task, delete the trace string *=info and add the trace string com.ibm.ws.webservices.engine.*=all=enabled. OR
  • Type the trace string directly into the text box. You must separate each trace string by a colon (:) with no spaces. For example: com.ibm.ws.webservices.trace.MessageTrace =finest:com.ibm.ws.webservices.engine.Message=finest

This will log the soap message in trace.log file.

Friday, November 30, 2007

DispatchAction: ServletException : 'method' not found

javax.servlet.ServletException: Request[/addcomponent] does not contain handler parameter named 'method'. This may be caused by whitespace in the label text.

Cause:
The error was cause by Internet Explorer because it has a concept of a default submit action when enter is pushed. So it submits the form to the server but with no specified method parameter because no button was pushed. And if you have a page with multiple submit buttons (which is the whole point of using a LookUpDispatchAction class), the &method='someMethodName' will always be dropped.

Wednesday, October 24, 2007

Power of java.lang.System class

The class System has a variable out that represents the standard output, and the variable err that represents the standard error device. By default, they both point at the system console. This how the standard output could be re-directed:

Stream st = new Stream(new FileOutputStream("output.txt"));
System.setErr(st);
System.setOut(st);

sleep() Vs. wait()

The code sleep(1000); puts thread aside for exactly one second. The code wait(1000), causes a wait of up to one second. A thread could stop waiting earlier if it receives the notify() or notifyAll() call. The method wait() is defined in the class Object and the method sleep() is defined in the class Thread.

Synchronized methods and Synchronized statements

Synchronized methods are methods that are used to control access to an object. A thread only executes a synchronized method after it has acquired the lock for the method's object or class. Synchronized statements are similar to synchronized methods. A synchronized statement can only be executed after a thread has acquired the lock for the object or class referenced in the synchronized statement.

Boolean Operators & Vs. &&

If an expression involving the Boolean & operator is evaluated, both operands are evaluated. Then the & operator is applied to the operand. When an expression involving the && operator is evaluated, the first operand is evaluated. If the first operand returns a value of true then the second operand is evaluated. The && operator is then applied to the first and second operands. If the first operand evaluates to false, the evaluation of the second operand is skipped.