Author: thomas.diesler(a)jboss.com
Date: 2007-01-09 09:28:41 -0500 (Tue, 09 Jan 2007)
New Revision: 1874
Added:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextInjector.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/ContextEJBTestCase.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/ContextJSETestCase.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/EndpointEJB.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/EndpointJSE.java
Removed:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/MessageContextInjector.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/EndpointBean.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/WebServiceContextTestCase.java
Modified:
trunk/integration-jboss50/.classpath
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
trunk/jbossws-tests/ant-import/build-jars-jaxws.xml
trunk/jbossws-tests/src/main/resources/jaxws/context/WEB-INF/web.xml
Log:
[JBWS-1443] getMessageContext Not Implemented\n More to come
Modified: trunk/integration-jboss50/.classpath
===================================================================
--- trunk/integration-jboss50/.classpath 2007-01-09 13:53:23 UTC (rev 1873)
+++ trunk/integration-jboss50/.classpath 2007-01-09 14:28:41 UTC (rev 1874)
@@ -4,7 +4,7 @@
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con"
path="org.eclipse.jdt.USER_LIBRARY/jboss-5.0.x"/>
<classpathentry combineaccessrules="false" kind="src"
path="/jbossws-core"/>
- <classpathentry kind="lib"
path="/build/thirdparty/ejb3.deployer/jboss-ejb3.jar"/>
+ <classpathentry kind="lib"
path="/build/thirdparty/ejb3.deployer/jboss-ejb3.jar"
sourcepath="/home/tdiesler/svn/jbossas/trunk/ejb3/src/main"/>
<classpathentry kind="lib"
path="/build/thirdparty/jboss-deployers.jar"/>
<classpathentry kind="lib"
path="/build/thirdparty/jboss-vfs.jar"/>
<classpathentry kind="lib" path="/build/thirdparty/ant.jar"/>
Modified:
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java
===================================================================
---
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java 2007-01-09
13:53:23 UTC (rev 1873)
+++
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceEndpointInvokerEJB3.java 2007-01-09
14:28:41 UTC (rev 1874)
@@ -29,14 +29,19 @@
import javax.xml.rpc.soap.SOAPFaultException;
import org.jboss.aop.Dispatcher;
+import org.jboss.ejb3.BaseSessionContext;
import org.jboss.ejb3.stateless.StatelessContainer;
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
+import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.jaxrpc.handler.SOAPMessageContextJAXRPC;
+import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.server.AbstractServiceEndpointInvoker;
import org.jboss.ws.core.server.ServiceEndpointInfo;
import org.jboss.ws.core.server.ServiceEndpointInvoker;
import org.jboss.ws.core.server.UnifiedDeploymentInfo;
+import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.core.utils.ObjectNameFactory;
/**
@@ -91,24 +96,10 @@
}
/** Invoke an instance of the SEI implementation bean */
- public void invokeServiceEndpoint(ServiceEndpointInfo seInfo, Object seiImpl,
EndpointInvocation epInv) throws SOAPFaultException, Exception
+ public void invokeServiceEndpoint(ServiceEndpointInfo seInfo, Object beanInstance,
EndpointInvocation epInv) throws SOAPFaultException, Exception
{
log.debug("invokeServiceEndpoint: " + epInv.getJavaMethod().getName());
- /* [FIXME] how to do this for EJB3
-
- // these are provided by the ServerLoginHandler
- Principal principal = SecurityAssociation.getPrincipal();
- Object credential = SecurityAssociation.getCredential();
-
- CommonMessageContext msgContext = MessageContextAssociation.getMessageContext();
-
- Invocation inv = new Invocation(null, method, args, null, principal, credential);
- inv.setValue(InvocationKey.SOAP_MESSAGE_CONTEXT, msgContext);
- inv.setValue(InvocationKey.SOAP_MESSAGE, msgContext.getMessage());
- inv.setType(InvocationType.SERVICE_ENDPOINT);
- */
-
// invoke on the container
try
{
@@ -118,11 +109,33 @@
Dispatcher dispatcher = Dispatcher.singleton;
StatelessContainer container =
(StatelessContainer)dispatcher.getRegistered(objectName.getCanonicalName());
+ Class beanClass = container.getBeanClass();
+
+ SOAPMessageContextJAXWS jaxwsMessageContext;
+ SOAPMessageContextJAXRPC jaxrpcMessageContext;
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ if (msgContext instanceof SOAPMessageContextJAXRPC)
+ {
+ jaxrpcMessageContext = (SOAPMessageContextJAXRPC)msgContext;
+ jaxwsMessageContext = new SOAPMessageContextJAXWS(msgContext);
+ }
+ if (msgContext instanceof SOAPMessageContextJAXWS)
+ {
+ jaxwsMessageContext = (SOAPMessageContextJAXWS)msgContext;
+ jaxrpcMessageContext = new SOAPMessageContextJAXRPC(msgContext);
+ }
+
+ // WebServiceContext injection
+ // beanInstance = TODO get the bean instance somehow
+ // WebServiceContextInjector.injectContext(beanInstance,
(SOAPMessageContextJAXWS)msgContext);
+
+ // MessageContext injection
+ //BaseSessionContext ejbContext = TODO get the bean base context somehow
+ //ejbContext.setMessageContext(jaxrpcMessageContext);
- Class implClass = container.getBeanClass();
- Method implMethod = getImplMethod(implClass, seiMethod);
-
+ Method implMethod = getImplMethod(beanClass, seiMethod);
Object retObj = container.localInvoke(implMethod, args);
+
epInv.setReturnValue(retObj);
}
catch (Throwable th)
Added:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextInjector.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextInjector.java 2007-01-09
13:53:23 UTC (rev 1873)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextInjector.java 2007-01-09
14:28:41 UTC (rev 1874)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.jaxws;
+
+// $Id$
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import javax.annotation.Resource;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.jaxws.WebServiceContextImpl;
+
+/**
+ * Inject the JAXWS WebServiceContext
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 04-Jan-2006
+ */
+public class WebServiceContextInjector
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(WebServiceContextInjector.class);
+
+ public static void injectContext(Object epImpl, MessageContext msgContext)
+ {
+ WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgContext);
+ try
+ {
+ // scan fields that are marked with @Resource
+ Field[] fields = epImpl.getClass().getFields();
+ for (Field field : fields)
+ {
+ Class type = field.getType();
+ if (type == WebServiceContext.class &&
field.isAnnotationPresent(Resource.class))
+ {
+ field.set(epImpl, webServiceContext);
+ }
+ }
+
+ // scan methods that are marked with @Resource
+ Method[] methods = epImpl.getClass().getMethods();
+ for (Method method : methods)
+ {
+ Class[] paramTypes = method.getParameterTypes();
+ if (paramTypes.length == 1 && paramTypes[0] ==
WebServiceContext.class && method.isAnnotationPresent(Resource.class))
+ {
+ method.invoke(epImpl, new Object[] { webServiceContext });
+
+ }
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ log.warn("Cannot inject WebServiceContext", ex);
+ }
+ }
+}
Property changes on:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/WebServiceContextInjector.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/MessageContextInjector.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/MessageContextInjector.java 2007-01-09
13:53:23 UTC (rev 1873)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/MessageContextInjector.java 2007-01-09
14:28:41 UTC (rev 1874)
@@ -1,85 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.ws.core.server;
-
-// $Id$
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import javax.annotation.Resource;
-import javax.xml.ws.WebServiceContext;
-import javax.xml.ws.handler.MessageContext;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.core.jaxws.WebServiceContextImpl;
-
-/**
- * Inject the JAXWS WebServiceContext
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 04-Jan-2006
- */
-public class MessageContextInjector
-{
- // provide logging
- private static Logger log = Logger.getLogger(MessageContextInjector.class);
-
- public static void injectMessageContext(Object epImpl, MessageContext msgContext)
- {
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgContext);
-
- try
- {
- // scan fields that are marked with @Resource
- Field[] fields = epImpl.getClass().getFields();
- for (Field field : fields)
- {
- Class type = field.getType();
- if (type == WebServiceContext.class &&
field.isAnnotationPresent(Resource.class))
- {
- field.set(epImpl, webServiceContext);
- }
- }
-
- // scan methods that are marked with @Resource
- Method[] methods = epImpl.getClass().getMethods();
- for (Method method : methods)
- {
- Class[] paramTypes = method.getParameterTypes();
- if (paramTypes.length == 1 && paramTypes[0] ==
WebServiceContext.class && method.isAnnotationPresent(Resource.class))
- {
- method.invoke(epImpl, new Object[] { webServiceContext });
-
- }
- }
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- log.warn("Cannot inject WebServiceContext", ex);
- }
- }
-}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java 2007-01-09
13:53:23 UTC (rev 1873)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/ServiceEndpointInvokerJSE.java 2007-01-09
14:28:41 UTC (rev 1874)
@@ -35,6 +35,7 @@
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.EndpointInvocation;
import org.jboss.ws.core.jaxrpc.ServletEndpointContextImpl;
+import org.jboss.ws.core.jaxws.WebServiceContextInjector;
import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.core.soap.MessageContextAssociation;
import org.jboss.ws.metadata.umdm.ServerEndpointMetaData;
@@ -88,7 +89,7 @@
{
CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
if (msgContext instanceof SOAPMessageContextJAXWS)
- MessageContextInjector.injectMessageContext(seiImpl,
(SOAPMessageContextJAXWS)msgContext);
+ WebServiceContextInjector.injectContext(seiImpl,
(SOAPMessageContextJAXWS)msgContext);
Class implClass = seiImpl.getClass();
Method seiMethod = epInv.getJavaMethod();
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java 2007-01-09
13:53:23 UTC (rev 1873)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSEndpointMetaDataBuilder.java 2007-01-09
14:28:41 UTC (rev 1874)
@@ -79,7 +79,7 @@
sepMetaData.setConfigFile(configFile);
}
- boolean isJSEEndpoint = udi.type == DeploymentType.JAXWS_JSE;
+ boolean isJSEEndpoint = (udi.type == DeploymentType.JAXWS_JSE);
// context-root
if (anPortComponent.contextRoot().length() > 0)
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2007-01-09
13:53:23 UTC (rev 1873)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2007-01-09
14:28:41 UTC (rev 1874)
@@ -997,7 +997,8 @@
processOrGenerateWSDL(seiClass, serviceMetaData, result.wsdlLocation,
sepMetaData);
// process config name and config file amongst others
- processPortComponent(udi, seiClass, linkName, sepMetaData);
+ // Note, that @PortComponent needs to be defined on the endpoint not the SEI
+ processPortComponent(udi, sepClass, linkName, sepMetaData);
// setup handler chain from config
sepMetaData.configure(sepMetaData);
Modified: trunk/jbossws-tests/ant-import/build-jars-jaxws.xml
===================================================================
--- trunk/jbossws-tests/ant-import/build-jars-jaxws.xml 2007-01-09 13:53:23 UTC (rev
1873)
+++ trunk/jbossws-tests/ant-import/build-jars-jaxws.xml 2007-01-09 14:28:41 UTC (rev
1874)
@@ -39,10 +39,16 @@
<!-- jaxws-context -->
<war warfile="${tests.output.dir}/libs/jaxws-context.war"
webxml="${tests.output.dir}/resources/jaxws/context/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/classes">
- <include
name="org/jboss/test/ws/jaxws/context/EndpointBean.class"/>
+ <include
name="org/jboss/test/ws/jaxws/context/EndpointJSE.class"/>
<include
name="org/jboss/test/ws/jaxws/context/EndpointInterface.class"/>
</classes>
</war>
+ <jar jarfile="${tests.output.dir}/libs/jaxws-context.jar">
+ <fileset dir="${tests.output.dir}/classes">
+ <include
name="org/jboss/test/ws/jaxws/context/EndpointEJB.class"/>
+ <include
name="org/jboss/test/ws/jaxws/context/EndpointInterface.class"/>
+ </fileset>
+ </jar>
<!-- jaxws-eardeployment -->
<war warfile="${tests.output.dir}/libs/jaxws-eardeployment.war"
webxml="${tests.output.dir}/resources/jaxws/eardeployment/WEB-INF/web.xml">
Added:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/ContextEJBTestCase.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/ContextEJBTestCase.java 2007-01-09
13:53:23 UTC (rev 1873)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/ContextEJBTestCase.java 2007-01-09
14:28:41 UTC (rev 1874)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.context;
+
+// $Id$
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+
+/**
+ * Test JAXWS WebServiceContext
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 29-Apr-2005
+ */
+public class ContextEJBTestCase extends JBossWSTest
+{
+ public static Test suite()
+ {
+ return JBossWSTestSetup.newTestSetup(ContextEJBTestCase.class,
"jaxws-context.jar");
+ }
+
+ public void testWSDLAccess() throws MalformedURLException
+ {
+
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-context?wsdl");
+ WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
+ WSDLDefinitions wsdlDefinitions = factory.parse(wsdlURL);
+ assertNotNull(wsdlDefinitions);
+ }
+
+ public void testClientAccess() throws Exception
+ {
+ URL wsdlURL = new
File("resources/jaxws/context/WEB-INF/wsdl/TestService.wsdl").toURL();
+ QName qname = new QName("http://org.jboss.ws/jaxws/context",
"TestService");
+ Service service = Service.create(wsdlURL, qname);
+ EndpointInterface port =
(EndpointInterface)service.getPort(EndpointInterface.class);
+
+ String helloWorld = "Hello world!";
+ Object retObj = port.echo(helloWorld);
+ assertEquals(helloWorld + "/" + helloWorld, retObj);
+ }
+
+}
Property changes on:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/ContextEJBTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/ContextJSETestCase.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/ContextJSETestCase.java 2007-01-09
13:53:23 UTC (rev 1873)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/ContextJSETestCase.java 2007-01-09
14:28:41 UTC (rev 1874)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.context;
+
+// $Id$
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+
+/**
+ * Test JAXWS WebServiceContext
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 29-Apr-2005
+ */
+public class ContextJSETestCase extends JBossWSTest
+{
+ public static Test suite()
+ {
+ return JBossWSTestSetup.newTestSetup(ContextJSETestCase.class,
"jaxws-context.war");
+ }
+
+ public void testWSDLAccess() throws MalformedURLException
+ {
+
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-context?wsdl");
+ WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
+ WSDLDefinitions wsdlDefinitions = factory.parse(wsdlURL);
+ assertNotNull(wsdlDefinitions);
+ }
+
+ public void testClientAccess() throws Exception
+ {
+ URL wsdlURL = new
File("resources/jaxws/context/WEB-INF/wsdl/TestService.wsdl").toURL();
+ QName qname = new QName("http://org.jboss.ws/jaxws/context",
"TestService");
+ Service service = Service.create(wsdlURL, qname);
+ EndpointInterface port =
(EndpointInterface)service.getPort(EndpointInterface.class);
+
+ String helloWorld = "Hello world!";
+ Object retObj = port.echo(helloWorld);
+ assertEquals(helloWorld, retObj);
+ }
+
+}
Property changes on:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/ContextJSETestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/EndpointBean.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/EndpointBean.java 2007-01-09
13:53:23 UTC (rev 1873)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/EndpointBean.java 2007-01-09
14:28:41 UTC (rev 1874)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxws.context;
-
-// $Id: $
-
-import javax.annotation.Resource;
-import javax.jws.WebService;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.WebServiceContext;
-import javax.xml.ws.WebServiceException;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-@WebService(endpointInterface =
"org.jboss.test.ws.jaxws.context.EndpointInterface", serviceName =
"TestService", targetNamespace = "http://org.jboss.ws/jaxws/context")
-public class EndpointBean
-{
- @Resource
- public WebServiceContext context;
-
- public String echo(String input)
- {
- try
- {
- SOAPMessageContext msgContext =
(SOAPMessageContext)context.getMessageContext();
- SOAPMessage soapMessage = msgContext.getMessage();
- SOAPElement soapElement =
(SOAPElement)soapMessage.getSOAPBody().getChildElements().next();
- soapElement = (SOAPElement)soapElement.getChildElements().next();
- return soapElement.getValue();
- }
- catch (SOAPException ex)
- {
- throw new WebServiceException(ex);
- }
- }
-}
Added: trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/EndpointEJB.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/EndpointEJB.java 2007-01-09
13:53:23 UTC (rev 1873)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/EndpointEJB.java 2007-01-09
14:28:41 UTC (rev 1874)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.context;
+
+// $Id$
+
+import javax.annotation.Resource;
+import javax.ejb.SessionContext;
+import javax.ejb.Stateless;
+import javax.jws.WebService;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.ws.annotation.PortComponent;
+
+@WebService(endpointInterface =
"org.jboss.test.ws.jaxws.context.EndpointInterface", serviceName =
"TestService", targetNamespace = "http://org.jboss.ws/jaxws/context")
+@PortComponent(contextRoot = "/jaxws-context", urlPattern = "/*")
+@Stateless
+public class EndpointEJB
+{
+ @Resource
+ WebServiceContext wsCtx;
+
+ @Resource
+ SessionContext ejbCtx;
+
+ public String echo(String input)
+ {
+ try
+ {
+ String retValue = getValueJAXWS() + "/" + getValueJAXRPC();
+ return retValue;
+ }
+ catch (SOAPException ex)
+ {
+ throw new WebServiceException(ex);
+ }
+ }
+
+ private String getValueJAXWS() throws SOAPException
+ {
+ javax.xml.ws.handler.soap.SOAPMessageContext jaxwsContext =
(javax.xml.ws.handler.soap.SOAPMessageContext)wsCtx.getMessageContext();
+ SOAPMessage soapMessage = jaxwsContext.getMessage();
+ SOAPElement soapElement =
(SOAPElement)soapMessage.getSOAPBody().getChildElements().next();
+ soapElement = (SOAPElement)soapElement.getChildElements().next();
+ return soapElement.getValue();
+ }
+
+ private String getValueJAXRPC() throws SOAPException
+ {
+ javax.xml.rpc.handler.soap.SOAPMessageContext jaxrpcContext =
(javax.xml.rpc.handler.soap.SOAPMessageContext)ejbCtx.getMessageContext();
+ SOAPMessage soapMessage = jaxrpcContext.getMessage();
+ SOAPElement soapElement =
(SOAPElement)soapMessage.getSOAPBody().getChildElements().next();
+ soapElement = (SOAPElement)soapElement.getChildElements().next();
+ return soapElement.getValue();
+ }
+}
Property changes on:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/EndpointEJB.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/EndpointJSE.java
(from rev 1858,
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/EndpointBean.java)
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/EndpointBean.java 2007-01-08
10:08:16 UTC (rev 1858)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/EndpointJSE.java 2007-01-09
14:28:41 UTC (rev 1874)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.context;
+
+// $Id: $
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+@WebService(endpointInterface =
"org.jboss.test.ws.jaxws.context.EndpointInterface", serviceName =
"TestService", targetNamespace = "http://org.jboss.ws/jaxws/context")
+public class EndpointJSE
+{
+ @Resource
+ public WebServiceContext wsCtx;
+
+ public String echo(String input)
+ {
+ try
+ {
+ SOAPMessageContext msgContext = (SOAPMessageContext)wsCtx.getMessageContext();
+ SOAPMessage soapMessage = msgContext.getMessage();
+ SOAPElement soapElement =
(SOAPElement)soapMessage.getSOAPBody().getChildElements().next();
+ soapElement = (SOAPElement)soapElement.getChildElements().next();
+ return soapElement.getValue();
+ }
+ catch (SOAPException ex)
+ {
+ throw new WebServiceException(ex);
+ }
+ }
+}
Deleted:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/WebServiceContextTestCase.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/WebServiceContextTestCase.java 2007-01-09
13:53:23 UTC (rev 1873)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/context/WebServiceContextTestCase.java 2007-01-09
14:28:41 UTC (rev 1874)
@@ -1,74 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.test.ws.jaxws.context;
-
-// $Id: $
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
-
-import junit.framework.Test;
-
-import org.jboss.test.ws.JBossWSTest;
-import org.jboss.test.ws.JBossWSTestSetup;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
-
-/**
- * Test JAXWS WebServiceContext
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 29-Apr-2005
- */
-public class WebServiceContextTestCase extends JBossWSTest
-{
- public static Test suite()
- {
- return JBossWSTestSetup.newTestSetup(WebServiceContextTestCase.class,
"jaxws-context.war");
- }
-
- public void testWSDLAccess() throws MalformedURLException
- {
-
- URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-context?wsdl");
- WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
- WSDLDefinitions wsdlDefinitions = factory.parse(wsdlURL);
- assertNotNull(wsdlDefinitions);
- }
-
- public void testClientAccess() throws Exception
- {
- URL wsdlURL = new
File("resources/jaxws/context/WEB-INF/wsdl/TestService.wsdl").toURL();
- QName qname = new QName("http://org.jboss.ws/jaxws/context",
"TestService");
- Service service = Service.create(wsdlURL, qname);
- EndpointInterface port =
(EndpointInterface)service.getPort(EndpointInterface.class);
-
- String helloWorld = "Hello world!";
- Object retObj = port.echo(helloWorld);
- assertEquals(helloWorld, retObj);
- }
-
-}
Modified: trunk/jbossws-tests/src/main/resources/jaxws/context/WEB-INF/web.xml
===================================================================
--- trunk/jbossws-tests/src/main/resources/jaxws/context/WEB-INF/web.xml 2007-01-09
13:53:23 UTC (rev 1873)
+++ trunk/jbossws-tests/src/main/resources/jaxws/context/WEB-INF/web.xml 2007-01-09
14:28:41 UTC (rev 1874)
@@ -7,7 +7,7 @@
<servlet>
<servlet-name>TestService</servlet-name>
-
<servlet-class>org.jboss.test.ws.jaxws.context.EndpointBean</servlet-class>
+
<servlet-class>org.jboss.test.ws.jaxws.context.EndpointJSE</servlet-class>
</servlet>
<servlet-mapping>