6 Replies Latest reply on Oct 1, 2005 3:53 AM by Per Arneng

    "Reverse Engineering" a Web Service from WSDL

    phillip pollard Newbie

      We have created a java web service running on jboss 3.2.5 that will call and be called by a partner's web service. Basically, we will give them the WSDL that they will need, and then they will reverse engineer a web service off of that WSDL. (Not client stubs...they will need their own web service). I was able to use WSDL2Java and build files (an impl and skeleton file) from the wsdl, and they look correct, but I don't know what to do after that. It creates a deploy.wsdd file, but we aren't using Axis.

      What is the best way to do this in JBoss? How can we get these skeleton files, put in some logic in the methods, and then deploy that web service?

        • 1. Re:
          Lance Nehring Newbie

          You should probably use wscompile instead of WSDL2Java.

          Have you looked at: http://wiki.jboss.org/wiki/Wiki.jsp?page=WSDOCClientStepByStep

          and: http://wiki.jboss.org/wiki/Wiki.jsp?page=WSDOCServiceStepByStep

          I would imagine that wscompile can be configured to generate the server files from a WSDL....although I admit that I have not done that myself.

          r,
          Lance

          • 2. Re:
            Anil Saldanha Master

            Use wscompile and look for client side generation.

            http://docs.sun.com/source/817-6092/hman1m/wscompile.1m.html

            Look for the WSDL element in the above url.

            • 3. Re:
              Per Arneng Newbie

              I havent done it but im going to do it soon on all our services. I think it is:

              wscompile -import -keep


              • 4. Re:
                phillip pollard Newbie

                I tried using the -import and -keep options but I receive these errors when trying to run the build script.

                [wscompile] error: class javax.xml.rpc.holders.Holder not found.
                [wscompile] error: -import requires a WSDL-based configuration file

                My config files looks like

                <configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
                 <wsdl
                 location="C:\partnerService.docliteral.wsdl"
                 packageName="com.test.ejb.partnerService"/>
                </configuration>


                And here is the target in the build file.
                <target name="client">
                 <wscompile
                 keep="true"
                 import="true"
                 config="${src.dir}/com/test/ejb/abstractbean/config/abstractBean-config.xml">
                 </wscompile>
                </target>




                • 5. Re:
                  Per Arneng Newbie

                  Hi!

                  Did a test run. Dont know if it is usable yet but somethings are generated
                  using jwsdp 1.6

                  Commandline:

                  [pure@localhost wsdltest]$ wscompile.sh -import -keep config.xml
                  [pure@localhost wsdltest]$ ls test
                  MovieServiceAPI.class MovieService.class MovieService_Impl.java MovieService_Rent_RequestStruct.class MovieService_Rent_ResponseStruct.class
                  MovieServiceAPI.java MovieService_Impl.class MovieService.java MovieService_Rent_RequestStruct.java MovieService_Rent_ResponseStruct.java
                  


                  config.xml:
                  <?xml version="1.0" encoding="UTF-8"?>
                  <configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
                   <wsdl
                   location="Test.wsdl"
                   packageName="test"
                   />
                  </configuration>
                  


                  The WSDL file:
                  <?xml version="1.0" ?>
                  <definitions name="OrganizationServiceEJB" targetNamespace="http://com.underworld.crimeportal"
                   xmlns:tns="http://com.underworld.crimeportal" xmlns="http://schemas.xmlsoap.org/wsdl/"
                   xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
                  
                   <types/>
                  
                   <message name="RentRequest">
                   <part name="MovieName" type="xsd:string"/>
                   </message>
                   <message name="RentResponse">
                   <part name="result" type="xsd:boolean"/>
                   </message>
                  
                   <portType name="MovieService">
                   <operation name="Rent" parameterOrder="MovieName">
                   <input message="tns:RentRequest"/>
                   <output message="tns:RentResponse"/>
                   </operation>
                   </portType>
                  
                   <binding name="MovieServiceBinding" type="tns:MovieService">
                   <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
                   <operation name="Rent">
                   <soap:operation soapAction=""/>
                   <input>
                   <soap:body use="literal" namespace="http://com.underworld.crimeportal"/>
                   </input>
                   <output>
                   <soap:body use="literal" namespace="http://com.underworld.crimeportal"/>
                   </output>
                   </operation>
                   </binding>
                  
                   <service name="MovieServiceAPI">
                   <port name="MoviePort" binding="tns:MovieServiceBinding">
                   <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
                   </port>
                   </service>
                   </definitions>