Web service client in EJB module in NetBeans 5.0

I'm working on one J2EE application that has web service client in EJB module. However, NetBeans 5.0 doesn't support web service client for EJB. Since NetBeans uses Ant as build tool is very easy to add this missing feature in NetBeans. We should changes build.properties and add new target in build.xml file. Let's to add support for web service client in NetBeans. These steps create Static generated web service client (JSR-101) in your EJB module:
  • Add wscompile config file in src/conf directory. I created file with name CreditService-config.xml:
         <?xml version="1.0" encoding="UTF-8"?>
         <configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
    	<wsdl location="http://localhost:8080/credit/CreditCardService?WSDL" 
              packageName="creditsystem.client"/>
         </configuration>
       
    Where location attribute represents location of the WSDL file and package is package where stubs will be generated.
  • Add these lines in project.properties file that is in nbproject directory:
         wscompile.classpath=${wscompile.tools.classpath}:${j2ee.platform.wscompile.classpath}
         wscompile.client.CreditCardService.features=strict,wsi
         wscompile.client.CreditCardService.package=creditsystem.client
         wscompile.tools.classpath=${java.home}\\\\..\\\\lib\\\\tools.jar
       
    First line setups classpath for wscompile, second one is wscompile options.
  • Now, add these target in your build.xml file:
        <target name="-pre-compile">
        <taskdef name="wscompile"
                 classname="com.sun.xml.rpc.tools.ant.Wscompile"
                 classpath="${wscompile.classpath}"/>
        <copy file="src/conf/CreditCardService-config.xml"
          tofile="${build.classes.dir}/META-INF/wsdl/CreditCardService-config.xml"/>
        <wscompile gen="true" base="${build.classes.dir}" keep="true" debug="true"
          config="${build.classes.dir}/META-INF/wsdl/CreditCardService-config.xml"
          classpath="${wscompile.classpath}"/>
        <wscompile gen="true" base="${build.dir}/ear-module" keep="true" debug="true"
          config="${build.classes.dir}/META-INF/wsdl/CreditCardService-config.xml"
          classpath="${wscompile.classpath}"/>
      </target>
       
    Here is one issue. You can see that similar task is invoked twice. The hack solves issue that EJB module can be included in J2EE application or can be standalone. When you build J2EE application with this EJB module then classes are built in different directory then for standalone module. I don't know how to resolve this issue in build.xml. Therefore, I call these two tasks.
  • Use this generated stubs and invoke web service operations.
Comments:

necesito el ejemplo de netbeans usando la libreria ejb

Posted by johar on February 07, 2006 at 06:29 PM CET #

nbn

Posted by guest on July 31, 2006 at 11:53 AM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

pblaha

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
Bookmarks