[Design of JBoss Web Services] - Inheritance problem
by pio1k
Hello.
I have a problem with class inheritance in web services. I want to make a web service with one method to add objects of classes (B, C and other in the future) which inheritated from my basic class (A). My source code:
Server side:
1) TestService.java
@WebService(serviceName = "TestService")
| @Stateless
| @XmlSeeAlso({B.class, C.class})
| public class TestService {
| @EJB
| TestMgmtLocal tl = null;
|
| @WebMethod(operationName = "testAddA")
| public @WebResult(name = "A")
| A testAddA(@WebParam(name = "testA") A testA) {
| return tl.testAddA(testA);
| }
| }
2) TestMgmtLocal.java
@Local
| public interface TestMgmtLocal extends TestMgmtRemote {
|
| }
3) TestMgmtRemote.java
@Remote
| public interface TestMgmtRemote {
| A testAddA(A testA);
| }
4) TestMgmt.java
@Stateless
| public class TestMgmt implements TestMgmtLocal {
| @Resource
| private SessionContext ctx = null;
|
| public A testAddA(A testA) {
| if (testA instanceof A) {
| System.out.println("class A");
| }
|
| if (testA instanceof B) {
| System.out.println("class B");
| }
|
| if (testA instanceof C) {
| System.out.println("class C");
| }
|
| return testA;
| }
| }
5) A.java
public class A implements Serializable {
|
| private static final long serialVersionUID = 110181269433550832L;
|
| private int a = -1;
|
| public int getA() {
| return a;
| }
|
| public void setA(int a) {
| this.a = a;
| }
| }
6) B.java
public class B extends A implements Serializable {
|
| private static final long serialVersionUID = 6921792702940813727L;
|
| private int b = -1;
|
| public int getB() {
| return b;
| }
|
| public void setB(int b) {
| this.b = b;
| }
| }
7) C.java
public class C extends A implements Serializable {
|
| private static final long serialVersionUID = 7823155353151239133L;
|
| private int c = -1;
|
| public int getC() {
| return c;
| }
|
| public void setC(int c) {
| this.c = c;
| }
| }
Client side:
1) TestClient.java
public class TestClient {
|
| public static void main(String[] args) {
| TestServiceProxy proxy = new TestServiceProxy();
| TestService_PortType port = proxy.getTestService_PortType();
| try {
| C c = new C();
| c.setA(2);
| c.setC(3);
| port.testAddA(c);
| } catch(RemoteException e) {
| System.out.println(e);
| }
| }
| }
I found this page:
http://blog.vinodsingh.com/2008/09/anytype-object-over-webservice-and.html
but it doesn't work in my web service. In testAddA method I always get an object of A class (when I send from client object of B or C class). I've also tried to add @XmlSeeAlso annotation to A class but it doesn't help. Maybe I did something wrong? Any ideas? Any other solutions of this problem?
I'm using:
1) JBoss 4.2.3GA (I tired also on JBoss 5.1.GA)
2) Java 1.5 update 15
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4244812#4244812
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4244812
15 years, 7 months
Changes for JBWS-2704
by Darran Lofthouse
I just quickly wanted to run my changes for JBWS-2704 past you before I
commit: -
https://jira.jboss.org/jira/browse/JBWS-2704
I am also planning to follow the same pattern for JBWS-2703: -
https://jira.jboss.org/jira/browse/JBWS-2703
Essentially for both of these issues the logic in DOMUtils does not take
into account the specific details for each of the getElementsByTagName
methods add to this the affected methods are used in many locations it
is quite risky modifying the DOMUtils further without introducing other
regressions.
The proposed solution is to use the getChildElements method from
DOMUtils to obtain all child elements and then filter the response as
required by the relevent getElementsByTagName method, these changes can
be seen here: -
http://fisheye.jboss.org/changelog/JBossWS/?cs=10336
(The System.out.println calls have been removed :-) )
Alternatively I think the solution would be to refactory the DOMUtils
implementation with a getChildElements method that takes a filter as a
parameter, the filter would then be used by search to compare each
element as it is visited to decide if it should be accepted by the
specific rules in the filter.
Regards,
Darran Lofthouse.
15 years, 7 months
[Design of JBoss Web Services] - Does JBoss handle SOAP request with additional working Threa
by pccontact168
Dear all,
I have a SOAP application which call other server's SOAP and do some process. But the response time from another server is about 1-4 seconds.
I plan to setup JBoss on Q8200(4core Intel CPU) with 4GB RAM server.
The JVM Heap is about 2G.
My SOAP application use a Thread.Sleep(1000 until 4000) to simulate the process from another server's response.
As far as I know, each client request need one "worker thread" to handle the request no matter NIO or not(this is a SOAP request not static file).
Then the maxthreads is the key on the max. concurrent request my JBoss server can handle.
Now, I am wondering what is the max. # of the MaxThreads a JBoss application server can handle in my situation.
I tested on Glassfish Tomcat, it looks like about 500 only. That means the best throughput is at most 500 TPS(beacause each working thread has to wait at least 1 second).
Can JBoss better than that?
How is the configuration?
Thanks!!
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4243127#4243127
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4243127
15 years, 8 months