Sep 23, 2009

Generate J2SE client from WSDL using JBoss wsconsume

If you have a valid WSDL URL and need to invoke web service method(s), here is what I compiled in order to consume a WSDL in JBoss environment:

We will Use “wsconsume” utility supplied by JBoss WS (available under /bin) to generate necessary glue code and stubs/interfaces.
  1. Type-in following command on the command prompt. Make sure that you have working WSDL URL before executing following command:
    [JBOSS Path]\bin>wsconsume -k -p packageName -o targetBinDir -s TaregtSrcDir http://127.0.0.1:8080/ejbs/HelloWorld?wsdl
  2. Once you have the interfaces, you can write the client like this (you should get the classes names (service, proxy) from the generated code in targetBinDir ):
public class HelloWorldClient {
    public static void main(String[] args) {
        //Create Service
        HelloWorldService service = new HelloWorldService();

        //create proxy
        HelloWorld proxy = service.getHelloWorldPort();

        //invoke
        System.out.println(proxy.hello("hello"));
    }
   }
  • Related links:
http://myarch.com/create-jax-ws-service-in-5-minutes
http://www.mastertheboss.com/en/web-interfaces/101-jboss-web-services-part-1.html


Jun 29, 2009

Maven build without running test cases

To build a project by maven without running the test cases use command:

mvn package -Dmaven.test.skip=true

this will reduce the build time.

And to run tests only use:

mvn test

Jun 2, 2009

NoSuchMethodError

I have did modification in a large exiting project , and when i have modified a module in this project and built this module individually ... then building all the project (by Maven) ... depoly it (on Jboss) ... test ... it thorws NoSuchMethodError at run time for a function that I sure that it exist in the code ... then I know that building some module of a project (by Maven) changes the version of that module from other modules in the project, so they become incompatible with them self

I solved it by:
1. Make the build number in "buildNumber.properties" file in each module as the same
2. Clean the project
3. Build the project
4. deploy and it works fine.

Or, Take a fresh copy of the project, then build it all when u do a change in either module.

I hope this help

Feb 13, 2009

الموقف

كثيرا يعتقد الانسان انه سوف يتصرف بسلوك معين في مواقف معينة ... ولكن عند وجوده بالفعل فى تلك المواقف يكون سلوكه واحساسه غير ما توقع