Problem getting client working from just WSDL
acxsjones Mar 21, 2005 1:35 PMI 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>