5 Replies Latest reply on Apr 13, 2005 5:28 AM by thomas.diesler

    Problem getting client working from just WSDL

    acxsjones

      I have a simple EJB "HelloWorld" that I am trying to get a client connected to.

      I have gen'd this as RPC literal style. When I do this. The gen'd code from the client stub is incorrect. I changed the gen'd sub and added items to the constructor on QName for the param and return and it works.

      I have also changed to document style and then the server has problem with these two items.

      Any help would be great.

      *********************

      Client Stub as Gen'd

       static {
       _operations = new org.apache.axis.description.OperationDesc[1];
       org.apache.axis.description.OperationDesc oper;
       oper = new org.apache.axis.description.OperationDesc();
       oper.setName("hello");
       oper.addParameter(new javax.xml.namespace.QName("", "in0"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, org.apache.axis.description.ParameterDesc.IN, false, false);
       oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
       oper.setReturnClass(java.lang.String.class);
       oper.setReturnQName(new javax.xml.namespace.QName("", "helloResponse"));
       oper.setStyle(org.apache.axis.enum.Style.RPC);
       oper.setUse(org.apache.axis.enum.Use.LITERAL);
       _operations[0] = oper;
      
       }
      


      Code changes made to make it work. I added the items in the QName constructor.
       static {
       _operations = new org.apache.axis.description.OperationDesc[1];
       org.apache.axis.description.OperationDesc oper;
       oper = new org.apache.axis.description.OperationDesc();
       oper.setName("hello");
       oper.addParameter(new javax.xml.namespace.QName("http://helloworld.ejb.test.acxiom.com", "in0"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, org.apache.axis.description.ParameterDesc.IN, false, false);
       oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
       oper.setReturnClass(java.lang.String.class);
       oper.setReturnQName(new javax.xml.namespace.QName("http://helloworld.ejb.test.acxiom.com", "helloResponse"));
       oper.setStyle(org.apache.axis.enum.Style.RPC);
       oper.setUse(org.apache.axis.enum.Use.LITERAL);
       _operations[0] = oper;
      
       }
      





      WSDL:
      <?xml version="1.0" encoding="UTF-8"?>
      <wsdl:definitions targetNamespace="http://helloworld.ejb.test.acxiom.com"
       xmlns="http://schemas.xmlsoap.org/wsdl/"
       xmlns:apachesoap="http://xml.apache.org/xml-soap"
       xmlns:impl="http://helloworld.ejb.test.acxiom.com"
       xmlns:intf="http://helloworld.ejb.test.acxiom.com"
       xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
       xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
       xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <wsdl:message name="helloRequest">
       <wsdl:part name="in0" type="xsd:string"/>
       </wsdl:message>
       <wsdl:message name="helloResponse">
       <wsdl:part name="helloResponse" type="xsd:string"/>
       </wsdl:message>
       <wsdl:portType name="HelloWorldEndpoint">
       <wsdl:operation name="hello" parameterOrder="in0">
       <wsdl:input message="impl:helloRequest" name="helloRequest"/>
       <wsdl:output message="impl:helloResponse" name="helloResponse"/>
       </wsdl:operation>
       </wsdl:portType>
       <wsdl:binding name="HelloWorldEndpointSoapBinding" type="impl:HelloWorldEndpoint">
       <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
       <wsdl:operation name="hello">
       <wsdlsoap:operation soapAction=""/>
       <wsdl:input name="helloRequest">
       <wsdlsoap:body namespace="http://helloworld.ejb.test.acxiom.com" use="literal"/>
       </wsdl:input>
       <wsdl:output name="helloResponse">
       <wsdlsoap:body namespace="http://helloworld.ejb.test.acxiom.com" use="literal"/>
       </wsdl:output>
       </wsdl:operation>
       </wsdl:binding>
       <wsdl:service name="HelloWorldService">
       <wsdl:port binding="impl:HelloWorldEndpointSoapBinding" name="HelloWorldEndpoint">
       <wsdlsoap:address location="http://localhost:8080/helloworldws-ejb/HelloWorld"/>
       </wsdl:port>
       </wsdl:service>
      </wsdl:definitions>
      



      EJB Build File
      <project name="Web Service 7 RPC" default="all" basedir=".">
       <property file="jboss-build.properties"/>
       <property file="settings.properties"/>
      
       <target name="all" depends="clean,compile,wsdl,package-ws"/>
      
       <path id="build.classpath">
       <pathelement location="${build.dir}"/>
       <fileset dir="${lib.dir}">
       <include name="*.jar"/>
       </fileset>
       </path>
      
       <path id="client.classpath">
       <path refid="build.classpath"/>
       <fileset dir="${clientlib.dir}">
       <include name="*.jar"/>
       </fileset>
       </path>
      
      
       <target name="clean">
       <delete dir="${build.dir}" />
       <mkdir dir="${build.dir}" />
       </target>
      
       <target name="prepare">
       <mkdir dir="${build.dir}"/>
       </target>
      
      
       <target name="compile" depends="prepare">
       <javac destdir="${build.dir}"
       classpathref="build.classpath"
       debug="on">
       <src path="${src.dir}"/>
       </javac>
       </target>
      
      
       <target name="wsdl">
       <mkdir dir="src/com/acxiom/test/ejb/helloworld/META-INF/wsdl" />
      
       <java classname="org.apache.axis.wsdl.Java2WSDL"
       classpathref="build.classpath" fork="yes">
       <arg value="-lhttp://this.value.is.replaced.by.jboss" />
       <arg value="-SHelloWorldService" />
       <arg value="-sHelloWorldEndpoint" />
       <arg value="-osrc/com/acxiom/test/ejb/helloworld/META-INF/wsdl/HelloWorld.wsdl" />
       <arg value="-uLITERAL" />
       <arg value="com.acxiom.test.ejb.helloworld.HelloWorldEndpoint" />
       </java>
       </target>
      
       <target name="package-ws" depends="wsdl">
       <mkdir dir="${dist.dir}" />
       <delete file="${dist.dir}/helloworldws-ejb.jar"/>
      
       <jar jarfile="${dist.dir}/helloworldws-ejb.jar">
       <metainf dir="src/com/acxiom/test/ejb/helloworld/META-INF"
       includes="**/*.xml,**/*.wsdl" />
      
       <fileset dir="${build.dir}">
       <include name="com/acxiom/test/ejb/helloworld/**/**" />
       </fileset>
       </jar>
       </target>
      
      
      
       </project>
      


      mapping.xml
      <java-wsdl-mapping 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://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd"
       version="1.1">
      
       <package-mapping>
       <package-type>com.acxiom.test.ejb.helloworld</package-type>
       <namespaceURI>http://helloworld.ejb.test.acxiom.com</namespaceURI>
       </package-mapping>
      </java-wsdl-mapping>
      
      


      client build file
      <project name="jboss web Service 7 RPC client" default="all" basedir=".">
       <property file="jboss-build.properties"/>
       <property file="settings.properties"/>
      
       <target name="all" depends="clean,soap.stubs,compile"/>
      
       <!-- The build classpath -->
       <path id="build.classpath">
       <fileset dir="${axis.home}">
       <include name="**/*.jar" />
       </fileset>
       <fileset dir="${lomboz.axis.home}">
       <include name="**/*.jar" />
       </fileset>
       <fileset dir="${commons.home}">
       <include name="**/*.jar" />
       </fileset>
       <fileset dir="${log4j.home}">
       <include name="**/*.jar" />
       </fileset>
       <fileset dir="${lib.dir}">
       <include name="**/*.jar" />
       </fileset>
       </path>
      
      
       <target name="clean">
       <delete dir="${build.dir}" />
       <mkdir dir="${build.dir}" />
       </target>
      
       <target name="prepare">
       <mkdir dir="${build.dir}"/>
       </target>
      
      
       <target name="compile" depends="prepare">
       <javac destdir="${build.dir}"
       classpathref="build.classpath"
       debug="on">
       <src path="${src.dir}"/>
       </javac>
       </target>
      
       <target name="soap.stubs">
      
       <taskdef resource="axis-tasks.properties" classpathref="build.classpath"/>
      
       <axis-wsdl2java output="${src.dir}"
       testcase="true"
       verbose="true"
       url="http://localhost:8080/helloworldws-ejb/HelloWorld?wsdl">
      
       <mapping namespace="http://helloworld.ejb.test.acxiom.com"
       package="com.acxiom.test.soap.generated" />
      
       <mapping namespace="http://localhost:8080/helloworldws-ejb/HelloWorld"
       package="com.acxiom.test.soap.generated"/>
      
      
       </axis-wsdl2java>
       </target>
      
       <target name="test" depends="compile">
       <java classname="junit.textui.TestRunner"
       fork="yes"
       failonerror="yes">
      
       <arg value="com.acxiom.test.soap.generated.HelloWorldServiceTestCase"/>
      
       <classpath>
       <path refid="build.classpath"/>
       <pathelement location="${build.dir}"/>
       </classpath>
       </java>
      </target>
      
      </project>
      


        • 1. Re: Problem getting client working from just WSDL
          anil.saldhana

          Look at the JBossWS wiki page.

          First stop would be the "FAQ" at the beginning of this forum.

          Bottomline, we do not support axis generated client stubs. Try Dynamic Proxy
          or DII model.

          • 2. Re: Problem getting client working from just WSDL
            acxsjones

            I have been looking at the examples that are out there and the jboss-build.xml from the jboss-dukes-bank project.

            I was able to get that working. But what I am looking for is an example of client code that starts with the WSDL gen'd from the server side. Can you point me to some sample client code that starts with wsdl and can connect to the EJB gen'd in the duke's bank example.

            Any and all help would be wonderful
            Scott

            • 3. Re: Problem getting client working from just WSDL
              jason.greene

              Take a look at this wiki for writing a client app http://www.jboss.org/wiki/Wiki.jsp?page=WSClientAppl. Keep in mind that J2EE client apps require a portion to be deployed on the server.

              -Jason

              • 4. Re: Problem getting client working from just WSDL
                acxsjones

                I have looked at that. I used the endPoint from the EJB.

                I just want to distribute the WSDL to my EJB and work from there. I have a client working using the endpoint from the EJB.

                Are you able to just hand out the WSDL to a client and have them access your webservice deployed under JBossWS

                • 5. Re: Problem getting client working from just WSDL
                  thomas.diesler

                  Of course, any SOAP stack should be able to generate the client side artifacts from a given WSDL. Remember, client and server are fundamentatlly disconnected in web services.

                  The wiki is talking about WS4EE clients, that is a portable WS client in Java that can be deployed on any J2EE-1.4 compatible app server. Is your client using an app server?

                  As Anil said correctly, generated Axis clients do not enter the WS4EE game. It maybe your choice to use an Axis client, but then you should not use jboss jars neither would this be the right forum to ask your questions regarding a non WS4EE client.