1 /*2 * JBoss, Home of Professional Open Source3 * Copyright 2005, JBoss Inc., and individual contributors as indicated4 * by the @authors tag. See the copyright.txt in the distribution for a5 * full listing of individual contributors.6 *7 * This is free software; you can redistribute it and/or modify it8 * under the terms of the GNU Lesser General Public License as9 * published by the Free Software Foundation; either version 2.1 of10 * 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 of14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU15 * Lesser General Public License for more details.16 *17 * You should have received a copy of the GNU Lesser General Public18 * License along with this software; if not, write to the Free19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA20 * 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 ;25 import javax.ejb.SessionContext ;26 import javax.ejb.Stateless ;27 import javax.ejb.Remote ;28 import javax.naming.InitialContext ;29 import javax.naming.NamingException ;30 import javax.xml.rpc.Service ;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 (name="StatelessBean")41 @Remote (StatelessRemote.class)42 public class StatelessBean implements StatelessRemote43 {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 service1;57 58 javax.xml.rpc.Service service2;59 60 javax.xml.rpc.Service service3;61 62 javax.xml.rpc.Service 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 service2)77 {78 this.service2 = service2;79 }80 81 public void setService4(javax.xml.rpc.Service service4)82 {83 this.service4 = service4;84 }85 86 public String echo1(String string) throws Exception 87 {88 return endpoint1.echo(string);89 }90 91 public String echo2(String string) throws Exception 92 {93 return endpoint2.echo(string);94 }95 96 public String echo3(String string) throws Exception 97 {98 return endpoint3.echo(string);99 }100 101 public String echo4(String string) throws Exception 102 {103 return endpoint4.echo(string);104 }105 106 public String echo5(String string) throws Exception 107 {108 EndpointInterface endpoint = (EndpointInterface)service1.getPort(EndpointInterface.class);109 return endpoint.echo(string);110 }111 112 public String echo6(String string) throws Exception 113 {114 EndpointInterface endpoint = (EndpointInterface)service2.getPort(EndpointInterface.class);115 return endpoint.echo(string);116 }117 118 public String echo7(String string) throws Exception 119 {120 EndpointInterface endpoint = (EndpointInterface)service3.getPort(EndpointInterface.class);121 return endpoint.echo(string);122 }123 124 public String echo8(String string) throws Exception 125 {126 EndpointInterface endpoint = (EndpointInterface)service4.getPort(EndpointInterface.class);127 return endpoint.echo(string);128 }129 130 public String echo9(String string) throws Exception 131 {132 InitialContext iniCtx = new InitialContext ();133 javax.xml.rpc.Service service = (Service )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