KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ejb3 > test > webservices > jsr181 > StatelessBean


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.ejb3.test.webservices.jsr181;
23
24 import javax.ejb.EJBException JavaDoc;
25 import javax.ejb.SessionContext JavaDoc;
26 import javax.ejb.Stateless JavaDoc;
27 import javax.ejb.Remote JavaDoc;
28 import javax.naming.InitialContext JavaDoc;
29 import javax.naming.NamingException JavaDoc;
30 import javax.xml.rpc.Service JavaDoc;
31 import javax.xml.ws.WebServiceRef;
32 import org.jboss.logging.Logger;
33
34 import org.jboss.ejb3.Container;
35
36 /**
37  * @author <a HREF="mailto:bdecoste@jboss.com">William DeCoste</a>
38  * @version $Revision: 43930 $
39  */

40 @Stateless JavaDoc(name="StatelessBean")
41 @Remote JavaDoc(StatelessRemote.class)
42 public class StatelessBean implements StatelessRemote
43 {
44    private static final Logger log = Logger.getLogger(StatelessBean.class);
45    
46    @WebServiceRef(mappedName="jbossws-client/service/TestService")
47    EndpointInterface endpoint1;
48    
49    EndpointInterface endpoint2;
50    
51    EndpointInterface endpoint3;
52    
53    EndpointInterface endpoint4;
54    
55    @WebServiceRef(mappedName="jbossws-client/service/TestService")
56    javax.xml.rpc.Service JavaDoc service1;
57    
58    javax.xml.rpc.Service JavaDoc service2;
59    
60    javax.xml.rpc.Service JavaDoc service3;
61    
62    javax.xml.rpc.Service JavaDoc service4;
63    
64    @WebServiceRef(mappedName="jbossws-client/service/TestService")
65    public void setEndpoint2(EndpointInterface endpoint2)
66    {
67       this.endpoint2 = endpoint2;
68    }
69    
70    public void setEndpoint4(EndpointInterface endpoint4)
71    {
72       this.endpoint4 = endpoint4;
73    }
74    
75    @WebServiceRef(mappedName="jbossws-client/service/TestService")
76    public void setService2(javax.xml.rpc.Service JavaDoc service2)
77    {
78       this.service2 = service2;
79    }
80    
81    public void setService4(javax.xml.rpc.Service JavaDoc service4)
82    {
83       this.service4 = service4;
84    }
85    
86    public String JavaDoc echo1(String JavaDoc string) throws Exception JavaDoc
87    {
88      return endpoint1.echo(string);
89    }
90    
91    public String JavaDoc echo2(String JavaDoc string) throws Exception JavaDoc
92    {
93      return endpoint2.echo(string);
94    }
95    
96    public String JavaDoc echo3(String JavaDoc string) throws Exception JavaDoc
97    {
98      return endpoint3.echo(string);
99    }
100    
101    public String JavaDoc echo4(String JavaDoc string) throws Exception JavaDoc
102    {
103      return endpoint4.echo(string);
104    }
105    
106    public String JavaDoc echo5(String JavaDoc string) throws Exception JavaDoc
107    {
108       EndpointInterface endpoint = (EndpointInterface)service1.getPort(EndpointInterface.class);
109       return endpoint.echo(string);
110    }
111    
112    public String JavaDoc echo6(String JavaDoc string) throws Exception JavaDoc
113    {
114       EndpointInterface endpoint = (EndpointInterface)service2.getPort(EndpointInterface.class);
115       return endpoint.echo(string);
116    }
117    
118    public String JavaDoc echo7(String JavaDoc string) throws Exception JavaDoc
119    {
120       EndpointInterface endpoint = (EndpointInterface)service3.getPort(EndpointInterface.class);
121       return endpoint.echo(string);
122    }
123    
124    public String JavaDoc echo8(String JavaDoc string) throws Exception JavaDoc
125    {
126       EndpointInterface endpoint = (EndpointInterface)service4.getPort(EndpointInterface.class);
127       return endpoint.echo(string);
128    }
129    
130    public String JavaDoc echo9(String JavaDoc string) throws Exception JavaDoc
131    {
132       InitialContext JavaDoc iniCtx = new InitialContext JavaDoc();
133       javax.xml.rpc.Service JavaDoc service = (Service JavaDoc)iniCtx.lookup(Container.ENC_CTX_NAME + "/env/service/Service3");
134       
135       EndpointInterface endpoint = (EndpointInterface)service.getPort(EndpointInterface.class);
136       return endpoint.echo(string);
137    }
138 }
139
Popular Tags