- This topic has 4 replies, 3 voices, and was last updated 16 years, 11 months ago by Riyad Kalla.
-
AuthorPosts
-
Robert JacksonMemberFolks,
I may be doing something wrong here. I’m defined a EJB 3 and deployed it on JBOss 4.2.2. I can access it fine using a java client. The web service seems to work but returns 0. Am I doing something wrong.
1) Data Class
package com.simple.data;
import java.io.Serializable;
public class DataSum implements Serializable {
private int sumOfInt = 0;public DataSum() {
super();
}public DataSum(int retVal) {
sumOfInt = retVal;
}public int getSumOfInt() {
return sumOfInt;
}public void setSumOfInt(int sumOfInt) {
this.sumOfInt = sumOfInt;
}
}2) EJB
package com.ca.simple.ejb3;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;import com.simple.data.DataSum;
@WebService(name = “Simple3EJB”, serviceName=”Simple3EJBService”)
@Stateless
public class Simple3EJB implements Simple3EJBLocal, Simple3EJBRemote {@WebMethod
@WebResult(name = “sum”)
public DataSum addInts( @WebParam(name = “x”) int x, @WebParam(name = “y”)int y) {
int retVal = 0;
retVal = x + y;
DataSum dataSum = new DataSum(retVal);
return dataSum;
}}
4) Generated Client with my updates
public static void main(String[] args) {
Simple3EJBServiceClient client = new Simple3EJBServiceClient();
//create a default service endpoint
Simple3EJB service = client.getSimple3EJBPort();//TODO: Add custom client code here
//
//service.yourServiceOperationHere();com.ca.simple.ejb3.DataSum sum = service.addInts(10, 10);
System.out.println(“test client completed sum is: ” + sum.getSumOfInt());
System.exit(0);
}}
5) WSDL from JBOSS
– <definitions name=”Simple3EJBService” targetNamespace=”http://ejb3.simple.ca.com/” xmlns=”http://schemas.xmlsoap.org/wsdl/” xmlns:soap=”http://schemas.xmlsoap.org/wsdl/soap/” xmlns:tns=”http://ejb3.simple.ca.com/” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
+ <types>
– <xs:schema targetNamespace=”http://ejb3.simple.ca.com/” version=”1.0″ xmlns:tns=”http://ejb3.simple.ca.com/” xmlns:xs=”http://www.w3.org/2001/XMLSchema”>
<xs:element name=”addInts” type=”tns:addInts” />
<xs:element name=”addIntsResponse” type=”tns:addIntsResponse” />
– <xs:complexType name=”addInts”>
– <xs:sequence>
<xs:element name=”x” type=”xs:int” />
<xs:element name=”y” type=”xs:int” />
</xs:sequence>
</xs:complexType>
– <xs:complexType name=”addIntsResponse”>
– <xs:sequence>
<xs:element minOccurs=”0″ name=”sum” type=”tns:dataSum” />
</xs:sequence>
</xs:complexType>
– <xs:complexType name=”dataSum”>
– <xs:sequence>
<xs:element name=”sumOfInt” type=”xs:int” />
</xs:sequence>
</xs:complexType>
</xs:schema>
</types>
– <message name=”Simple3EJB_addInts”>
<part element=”tns:addInts” name=”addInts” />
</message>
– <message name=”Simple3EJB_addIntsResponse”>
<part element=”tns:addIntsResponse” name=”addIntsResponse” />
</message>
– <portType name=”Simple3EJB”>
– <operation name=”addInts” parameterOrder=”addInts”>
<input message=”tns:Simple3EJB_addInts” />
<output message=”tns:Simple3EJB_addIntsResponse” />
</operation>
</portType>
– <binding name=”Simple3EJBBinding” type=”tns:Simple3EJB”>
<soap:binding style=”document” transport=”http://schemas.xmlsoap.org/soap/http” />
– <operation name=”addInts”>
<soap:operation soapAction=”” />
– <input>
<soap:body use=”literal” />
</input>
– <output>
<soap:body use=”literal” />
</output>
</operation>
</binding>
– <service name=”Simple3EJBService”>
– <port binding=”tns:Simple3EJBBinding” name=”Simple3EJBPort”>
<soap:address location=”http://127.0.0.1:8080/Simple3EJBProject/Simple3EJB” />
</port>
</service>
</definitions>
Loyal WaterMemberrjack,
Can you go to MyEclipse > Installation Summary > Installation Details and paste the information here for me.
Robert JacksonMember*** Date:
Wednesday, January 23, 2008 8:05:36 AM CST** System properties:
OS=WindowsXP
OS version=5.1
Java version=1.5.0_11*** MyEclipse details:
MyEclipse Enterprise Workbench
Version: 6.0.1 GA
Build id: 6.0.1-GA-200710*** Eclipse details:
MyEclipse Enterprise WorkbenchVersion: 6.0.1 GA
Build id: 6.0.1-GA-200710Eclipse Graphical Editing Framework
Version: 3.3.1.v20070814
Build id: 20070814-1555Eclipse Platform
Version: 3.3.1.R33x_r20070911-_19UEkpF-B7Uh2hKy75y
Build id: M20070921-1145Eclipse RCP
Version: 3.3.1.R33x_r20070802-8y8eE8sEV3Fz0z0GlHJrXvTAUS
Build id: M20070921-1145Eclipse Java Development Tools
Version: 3.3.1.r331_v20070629-7o7jE72EDlXAbqAcnbmyg1rf8RIL
Build id: M20070921-1145Eclipse Plug-in Development Environment
Version: 3.3.1.R33x_r20070802-7N7M3D1VIA_52JsDFsEC
Build id: M20070921-1145Eclipse Project SDK
Version: 3.3.1.R33x_r20070802-7M7J78_mu1mnlRa7A4Ns52XeZ6D0
Build id: M20070921-1145Eclipse startup command=-os
win32
-ws
win32
-arch
x86
-showsplash
-launcher
C:\Program Files\MyEclipse 6.0\eclipse\eclipse.exe
-name
Eclipse
–launcher.library
C:\Program Files\MyEclipse 6.0\eclipse\plugins\org.eclipse.equinox.launcher.win32.win32.x86_1.0.1.R33x_v20070828\eclipse_1020.dll*** Date:
Wednesday, January 23, 2008 8:05:36 AM CST** System properties:
OS=WindowsXP
OS version=5.1
Java version=1.5.0_11*** MyEclipse details:
MyEclipse Enterprise Workbench
Version: 6.0.1 GA
Build id: 6.0.1-GA-200710*** Eclipse details:
MyEclipse Enterprise WorkbenchVersion: 6.0.1 GA
Build id: 6.0.1-GA-200710Eclipse Graphical Editing Framework
Version: 3.3.1.v20070814
Build id: 20070814-1555Eclipse Platform
Version: 3.3.1.R33x_r20070911-_19UEkpF-B7Uh2hKy75y
Build id: M20070921-1145Eclipse RCP
Version: 3.3.1.R33x_r20070802-8y8eE8sEV3Fz0z0GlHJrXvTAUS
Build id: M20070921-1145Eclipse Java Development Tools
Version: 3.3.1.r331_v20070629-7o7jE72EDlXAbqAcnbmyg1rf8RIL
Build id: M20070921-1145Eclipse Plug-in Development Environment
Version: 3.3.1.R33x_r20070802-7N7M3D1VIA_52JsDFsEC
Build id: M20070921-1145Eclipse Project SDK
Version: 3.3.1.R33x_r20070802-7M7J78_mu1mnlRa7A4Ns52XeZ6D0
Build id: M20070921-1145Eclipse startup command=-os
win32
-ws
win32
-arch
x86
-showsplash
-launcher
C:\Program Files\MyEclipse 6.0\eclipse\eclipse.exe
-name
Eclipse
–launcher.library
C:\Program Files\MyEclipse 6.0\eclipse\plugins\org.eclipse.equinox.launcher.win32.win32.x86_1.0.1.R33x_v20070828\eclipse_1020.dll
-startup
C:\Program Files\MyEclipse 6.0\eclipse\plugins\org.eclipse.equinox.launcher_1.0.1.R33x_v20070828.jar
-exitdata
8c4_54
-vm
C:\Program Files\MyEclipse 6.0\jre\bin\javaw.exe-startup
C:\Program Files\MyEclipse 6.0\eclipse\plugins\org.eclipse.equinox.launcher_1.0.1.R33x_v20070828.jar
-exitdata
8c4_54
-vm
C:\Program Files\MyEclipse 6.0\jre\bin\javaw.exe
Robert JacksonMemberFolks,
II tried it with the JBuilder client builder and it worked.
Robert
Riyad KallaMemberRobert,
Everything looks kosher… do you have an install of Glassfish 2 handy to deploy and test this same project on? I’d be curious if there is some server interaction going on here that is causing the difference as opposed to a code issue. -
AuthorPosts