0 Replies Latest reply on Mar 30, 2006 2:56 PM by Dan Smith

    XDoclet to generate webservices.xml

    Dan Smith Newbie

      I'm trying to get my web service build automated with Ant and XDoclet. After some messing around, I finally got the wscompile task working, but I'm having the following problem with the XDoclet piece:

      When I run the wseedoclet task to generate webservices.xml, I get an invalid <service-endpoint-interface> entry. Here is my code:

      Interface / Implementing class:

      package com.abc;
      
      import java.rmi.Remote;
      import java.rmi.RemoteException;
      
      public interface SayHello extends Remote
      {
       public String sayHi( String firstName, String lastName ) throws RemoteException;
      }
      
      package com.abc;
      
      /**
       * @web.servlet
       * display-name="Say Hello Service"
       * name="SayHello"
       * @web.servlet-mapping
       * url-pattern="/SayHello"
       *
       * @wsee.port-component
       * name="SayHello"
       */
      public class SayHelloImpl implements SayHello
      {
       public String sayHi( String firstName, String lastName )
       {
       return "hello there " + firstName + " " + lastName;
       }
      }


      My config.xml
      <configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
       <service name="SayHelloService" targetNamespace="http://com.abc"
       typeNamespace="http://com.abc/types" packageName="com.abc">
       <interface name="com.abc.SayHello" />
       </service>
      </configuration>
      


      Parts of interest in the build.xml:
      <target name="compile">
       <javac srcdir="${src}" destdir="${classes.dir}" />
       <wscompile classpath="${classes.dir}"
       base="${classes.dir}"
       fork="true"
       server="true"
       features="documentliteral, wsi"
       nonclassdir="${temp.dir}"
       sourcebase="${temp.dir}"
       keep="true"
       config="${config.dir}/config.xml"
       classpathref="jwsdp.classpath"
       mapping="${mapping.file}">
       <classpath refid="javac.classpath"/>
       </wscompile>
      </target>
      
      <target name="webdoclet">
       <webdoclet
       destdir="${webinf.dir}" verbose="true" excludedtags="@wsee.port-component">
       <fileset dir="${src}">
       <include name="**/*.java"/>
       </fileset>
       <deploymentdescriptor destdir="${webinf.dir}"/>
       </webdoclet>
      </target>
      
      <target name="wseedoclet">
       <wseedoclet
       jaxrpcmappingfile="${mapping.file}"
       wsdlfile="wsdl/${wsdl.file}"
       destdir="${webinf.dir}"
       wseeSpec="1.1"
       verbose="true">
       <fileset dir="${src}">
       <include name="**/SayHelloImpl.java"/>
       </fileset>
       <deploymentdescriptor name="SayHello"/>
       </wseedoclet>
      </target>
      


      This gives me all the server code I need, a mapping file and web.xml which all look fine. But the webservices.xml contains the following:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <webservices
       xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/j2ee_web_services_1_1.xsd"
       version="1.1">
      
       <webservice-description>
       <icon>
       </icon>
      
       <webservice-description-name>SayHello</webservice-description-name>
      
       <wsdl-file>WEB-INF/wsdl/SayHelloService.wsdl</wsdl-file>
       <jaxrpc-mapping-file>WEB-INF/jaxrpc-mapping.xml</jaxrpc-mapping-file>
      
       <port-component>
      
       <icon>
       </icon>
      
       <port-component-name>SayHello</port-component-name>
       <wsdl-port>SayHelloPort</wsdl-port>
       <service-endpoint-interface>com.abc.SayHelloImplService</service-endpoint-interface>
       <service-impl-bean>
       <servlet-link>SayHello</servlet-link>
       </service-impl-bean>
       </port-component>
      
       </webservice-description>
      
      </webservices>
      


      How does the service-endpoint-interface get set to "com.abc.SayHelloImplService"? Is this name just made up by XDoclet, I can't figure out where it comes from, or how to get it right.

      Is there an attribute that I need to set to get the proper interface name?

      Thanks,