0 Replies Latest reply on Jun 15, 2005 5:20 AM by sselda

    Wsdl generation on client side

    sselda

      Hi all,

      I'm using:
      - jboss 4.0.1
      - jwsdp 1.5

      I want to realize the tutorial example in http://wiki.jboss.org/wiki/Wiki.jsp?page=WSRPCClientStepByStep.

      I have created a war file for the web service, and deployed on jboss on http://localhost:8080/pc/Organization.
      Then I have created a war file for the web client application, which contains the web service stubs, a factory for lookup, and a jsp page that uses the factory and then call the webservice.

      The factory is:

      public class FactoryOrganizationService {
      
       public static Organization getProxy() {
       try {
       Context iniCtx = new InitialContext();
       OrganizationService service = (OrganizationService) iniCtx
       .lookup("java:comp/env/service/OrganizationServiceJSE");
       return service.getOrganizationPort();
       } catch (Exception e) {
       e.printStackTrace(); //debug
       }
       return null;
       }
      }


      The web.xml is

      <web-app 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/web-app_2_4.xsd"
       version="2.4">
       <display-name>WSOrganizationClient</display-name>
      
       <service-ref>
       <service-ref-name>service/OrganizationServiceJSE</service-ref-name>
       <service-interface>org.jboss.test.webservice.samples.OrganizationService</service-interface>
       <wsdl-file>WEB-INF/wsdl/OrganizationService.wsdl</wsdl-file>
       <jaxrpc-mapping-file>WEB-INF/Organization-mapping.xml</jaxrpc-mapping-file>
       </service-ref>
      
       <session-config>
       <session-timeout>60</session-timeout>
       </session-config>
      </web-app>


      And I need OrganizationService.wsdl.

      So I have opened the browser to http://localhost:8080/pc/Organization?wsdl and I copied the xml definition to a file named OrganizationService.wsdl.

      Questions:

      1) Can I generate the OrganizationService.wsdl automatically from http://localhost:8080/pc/Organization?wsdl ? When I copy from browser to a text editor I need to delete manually "-" characters. Example:

      <?xml version="1.0" encoding="UTF-8" ?>
      - <definitions name="OrganizationService"
      targetNamespace="http://org.jboss.test.webservice/samples"
      xmlns="http://schemas.xmlsoap.org/wsdl/"
      xmlns:ns2="http://org.jboss.test.webservice/samples/types"
      xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
      xmlns:tns="http://org.jboss.test.webservice/samples"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      - <types>
      - <schema targetNamespace="http://org.jboss.test.webservice/samples/types"



      2) is there a solution to avoid wsdl generation on client side? Maybe I need to change web.xml deleting the <wsdl-file> tag, but it doesn't function...maybe I change the factory method getProxy()...Any ideas?
      I tried to use
      Stub stub = (Stub)(new OrganizationService_Impl().getOrganizationPort());
       stub._setProperty( javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,
       "http://localhost:8080/pc/Organization");
       Organization pc = (Organization)stub;

      but I have the following error:
      cannot access com.sun.xml.rpc.client.BasicService
      file com\sun\xml\rpc\client\BasicService.class not found
      Stub stub = (Stub)(new OrganizationService_Impl().getOrganizationPort());

      And if I copy the jar that contains BasicService class from jwsdp1.5 to jboss/server/default/lib I have a new class not found on another class, and so. I don't know which jars I must copy in jboss server lib directory.