13 Replies Latest reply on Nov 30, 2005 7:52 AM by sthalkidis

    Must include type attribute for handler deployment message

    sthalkidis

      Dear programmers,

      I think I have sucessfully deployed a simple HelloWorld service
      because by using the URL for the .wsdl file I can see it in a web
      browser. However, the client for this simple service does not work.
      I try to use Dynamic Invocation Interface and I always get
      the org.jboss.axis.deployment.wsdd.WSDDException "Must include type attribute for handler deployment!"

      I include source code for HelloClient.java the .wsdl file and the .wsdd file
      below. Excuse my ignorance. Any help is valuable.

      Spyros Halkidis

      1. HelloClient.java
      ------------------------------------------------------------
      import webservice.test.hello.*;

      import javax.xml.namespace.QName;
      import javax.xml.rpc.Service;
      import javax.xml.rpc.ServiceFactory;
      import javax.xml.rpc.Call;
      import java.net.URL;

      class HelloClient
      {
      public static void main(String[] args) throws Exception
      {

      URL url = new URL("http://localhost:8080/hello/HelloWS");
      String ns="http://webservice.test.hello/";
      QName qname=new QName(ns, "HelloWorldWS");

      ServiceFactory factory=ServiceFactory.newInstance();
      Service service=factory.createService(url, qname);
      HelloInterface
      hello=(HelloInterface)service.getPort(HelloInterface.class);
      System.out.println("output:"+hello.hello());
      }
      }
      ===============================================
      2. HelloWorldWS.wsdl
      -------------------------------------------------------------------------------------
      <?xml version="1.0" encoding="UTF-8"?>

      <definitions name="HelloWorldWS" targetNamespace="http://webservice.test.hello/" xmlns:tns="http://webservice.test.hello/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">









      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>

      <soap:operation soapAction=""/>

      <soap:body use="literal" namespace="http://webservice.test.hello/"/>

      <soap:body use="literal" namespace="http://webservice.test.hello/"/>


      <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
      ====================================================
      3. HelloWS.wsdd
      ----------------------------------------------------------------------------------------------
      <deployment
      xmlns='http://xml.apache.org/axis/wsdd/'
      xmlns:java='http://xml.apache.org/axis/wsdd/providers/java'
      xmlns:soap='http://schemas.xmlsoap.org/soap/encoding/'
      xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
      xmlns:xsd='http://www.w3.org/2001/XMLSchema'>






      <operation name='hello' qname='ns1:hello' returnQName='result' returnType='ns2:string' xmlns:ns1='http://webservice.test.hello/' xmlns:ns2='http://www.w3.org/2001/XMLSchema' >





      -------------------------------------------------------------------------------------

        • 1. Re:  Must include type attribute for handler deployment mess
          sthalkidis

          Sorry,

          the code for the .wsdl and .wsdd files was not properly
          shown. I repeat all of the files here for convenience.

          Spyros Halkidis

          ==================================
          HelloClient.java
          -------------------------------------------------------------

          import webservice.test.hello.*;
          
          import javax.xml.namespace.QName;
          import javax.xml.rpc.Service;
          import javax.xml.rpc.ServiceFactory;
          import javax.xml.rpc.Call;
          import java.net.URL;
          
          class HelloClient
          {
           public static void main(String[] args) throws Exception
           {
          
           URL url = new URL("http://localhost:8080/hello/HelloWS");
           String ns="http://webservice.test.hello/";
           QName qname=new QName(ns, "HelloWorldWS");
          
           ServiceFactory factory=ServiceFactory.newInstance();
           Service service=factory.createService(url, qname);
           HelloInterface hello=(HelloInterface)service.getPort(HelloInterface.class);
           System.out.println("output:"+hello.hello());
           }
          }
          

          ==================================
          HelloWorldWS.wsdl
          -----------------------------------------------------------------------------
          <?xml version="1.0" encoding="UTF-8"?>
          
          <definitions name="HelloWorldWS" targetNamespace="http://webservice.test.hello/" xmlns:tns="http://webservice.test.hello/" 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="HelloInterface_hello"/>
           <message name="HelloInterface_helloResponse">
           <part name="result" type="xsd:string"/></message>
           <portType name="HelloInterface">
           <operation name="hello">
           <input message="tns:HelloInterface_hello"/>
           <output message="tns:HelloInterface_helloResponse"/></operation></portType>
           <binding name="HelloInterfaceBinding" type="tns:HelloInterface">
           <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
           <operation name="hello">
           <soap:operation soapAction=""/>
           <input>
           <soap:body use="literal" namespace="http://webservice.test.hello/"/></input>
           <output>
           <soap:body use="literal" namespace="http://webservice.test.hello/"/></output></operation></binding>
           <service name="HelloWorldWS">
           <port name="HelloInterfacePort" binding="tns:HelloInterfaceBinding">
           <soap:address location="REPLACE_WITH_ACTUAL_URL"/></port></service></definitions>
          

          ===================================================
          HelloWS.wsdd
          --------------------------------------------------------------------------------------------
          <deployment
           xmlns='http://xml.apache.org/axis/wsdd/'
           xmlns:java='http://xml.apache.org/axis/wsdd/providers/java'
           xmlns:soap='http://schemas.xmlsoap.org/soap/encoding/'
           xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
           xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
          
          <service name='hello.jar#HelloService/HelloWS' style='rpc' use='literal' provider='Handler'>
          
           <parameter name='webserviceID' value='hello.jar#HelloService/HelloWS' />
           <parameter name='handlerClass' value='org.jboss.webservice.server.InvokerProviderEJB' />
          
           <operation name='hello' qname='ns1:hello' returnQName='result' returnType='ns2:string' xmlns:ns1='http://webservice.test.hello/' xmlns:ns2='http://www.w3.org/2001/XMLSchema' >
           </operation>
          </service>
          </deployment>
          


          • 2. Re:  Must include type attribute for handler deployment mess
            sthalkidis

            Forgot to mention that my aim is to use a stateless EJB
            as a web service. I also used the code from Wiki for
            DII and get the same problem. I guess that a parameter
            in the creation of the Service object is not correct
            but I can not find the correct values.

            Thanks in advance,

            Spyros Halkidis

            P.S. I am new to web services (I started taking a look
            two days ago)

            • 3. Re:  Must include type attribute for handler deployment mess
              thomas.diesler

              Have you looked at the samples that are attached to the wiki?

              • 4. Re:  Must include type attribute for handler deployment mess
                sthalkidis

                Dear Thomas Diesler,

                I took a look now at the wiki "mafia" sample and I saw that a
                variable axis.home is used in the build.xml files. Isn't axis built
                inside jboss-4.0.3? If not, how should I install axis inside jboss?
                If yes, how should someone determine the correct axis.home
                variable?

                Thanks in advance,

                Spyros Halkidis

                • 5. Re:  Must include type attribute for handler deployment mess
                  sthalkidis

                  I try to build the examples from Wiki for JBossWS with jboss-4.0.3
                  and get the following error:
                  Error opening C:\jboss-4.0.3\client\auth.conf: java.util.zip.ZipException
                  error opening zip file.

                  • 7. Re:  Must include type attribute for handler deployment mess
                    sthalkidis

                    Thanks. I've seen the SLSB example and the web client for it from
                    the samples.
                    Though it is not very clear to me yet, how a simple java client and not a web client for the SLSB should be structured.
                    For example have noticed that when the ws4ee-samples-client.jar is deployed there is no jndi name bound to the service when I look at the logs of the server. I do not understand how the service is looked up.

                    Spyros Halkidis

                    • 8. Re:  Must include type attribute for handler deployment mess
                      sthalkidis

                      Furthermore I have noticed that the ws4ee-samples-client-appl.jar does
                      not have any main function in the classes included. How does this client
                      work?

                      • 9. Re:  Must include type attribute for handler deployment mess
                        anders.hedstrom

                        Here's a good place for you to start at:

                        http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html

                        • 10. Re:  Must include type attribute for handler deployment mess
                          sthalkidis

                          A simple java client should have a main function or not?
                          My question is how does a simple java client for an SLSB
                          working as a web service. I am not new to J2EE,
                          I am new to web services.

                          Spyros Halkidis

                          • 11. Re:  Must include type attribute for handler deployment mess
                            sthalkidis

                            A simple java client should have a main function or not?
                            My question is how does a java client and not a web client
                            for an SLSB deployed as a web service look like.
                            I am not new to J2EE. I am new to web services.

                            Spyros Halkidis

                            • 12. Re:  Must include type attribute for handler deployment mess
                              anders.hedstrom

                               

                              A simple java client should have a main function or not?

                              Depends on how you gonna run your client. In the examples you've looked at the client is ran as a JUnit Test Case. If you want to run your client stand-alone, of course you will need a main method.

                              If you deploy ws4ee-samples-server-jse.war from the examples and you want to write a a simple java client the consumes it
                              Use wscompile to generate the needed artifacts from the wsdl file.
                              Write you main class and use of the generated artifacts


                              config.xml for wscompile
                              <configuration
                               xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
                               <wsdl location="http://localhost:8080/ws4ee-samples-server-jse/Organization?wsdl"
                               packageName="show.me">
                               </wsdl>
                              </configuration>


                              Your main class:
                              package show.me;
                              
                              /**
                               * A SimpleWSClient.
                               *
                               */
                              public class SimpleWSClient
                              {
                              
                               public static void main(String[] args)
                               {
                               try
                               {
                               OrganizationService_Impl srv = new OrganizationService_Impl();
                               Organization port = srv.getOrganizationPort();
                               System.out.println(port.getContactInfo("Test"));
                               }
                               catch (Exception e)
                               {
                               e.printStackTrace();
                               }
                               }
                              }


                              output:
                              The 'Test' boss is currently out of office, please call again.


                              http://jboss.com/wiki/Wiki.jsp?page=JBossWS
                              http://java.sun.com/webservices/docs/1.4/tutorial/doc/index.html
                              https://bpcatalog.dev.java.net/nonav/soa/standalone-client/frames.html


                              • 13. Re:  Must include type attribute for handler deployment mess
                                sthalkidis

                                Thank you!

                                Spyros Halkidis