Author: thomas.diesler(a)jboss.com
Date: 2007-03-09 09:15:46 -0500 (Fri, 09 Mar 2007)
New Revision: 2573
Added:
branches/jbossws-1.2.0/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java
branches/jbossws-1.2.0/jbossws-tests/src/etc/
branches/jbossws-1.2.0/jbossws-tests/src/etc/jndi.properties
branches/jbossws-1.2.0/jbossws-tests/src/etc/log4j.xml
branches/jbossws-1.2.0/jbossws-tests/src/etc/tst.policy
branches/jbossws-1.2.0/jbossws-tests/src/resources/jaxws/samples/webserviceref/WEB-INF-client/jboss-web.xml
Log:
Unified service-ref handling for jboss50
Added:
branches/jbossws-1.2.0/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java
===================================================================
---
branches/jbossws-1.2.0/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java
(rev 0)
+++
branches/jbossws-1.2.0/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java 2007-03-09
14:15:46 UTC (rev 2573)
@@ -0,0 +1,139 @@
+/*
+* 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.integration.jboss50;
+
+// $Id$
+
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.ejb.plugins.AbstractInterceptor;
+import org.jboss.invocation.Invocation;
+import org.jboss.invocation.InvocationKey;
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.CommonBinding;
+import org.jboss.ws.core.CommonBindingProvider;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.EndpointInvocation;
+import org.jboss.ws.core.jaxrpc.SOAPFaultHelperJAXRPC;
+import org.jboss.ws.metadata.umdm.OperationMetaData;
+import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
+
+/**
+ * This Interceptor does the ws4ee handler processing.
+ *
+ * According to the ws4ee spec the handler logic must be invoked after the container
+ * applied method level security to the invocation.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 21-Sep-2005
+ */
+public class ServiceEndpointInterceptor extends AbstractInterceptor
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(ServiceEndpointInterceptor.class);
+
+ // Interceptor implementation --------------------------------------
+
+ /** Before and after we call the service endpoint bean, we process the handler
chains.
+ */
+ public Object invoke(final Invocation mi) throws Exception
+ {
+ // If no msgContext, it's not for us
+ CommonMessageContext msgContext =
(CommonMessageContext)mi.getPayloadValue(InvocationKey.SOAP_MESSAGE_CONTEXT);
+ if (msgContext == null)
+ {
+ return getNext().invoke(mi);
+ }
+
+ // Get the endpoint invocation
+ EndpointInvocation epInv =
(EndpointInvocation)mi.getValue(EndpointInvocation.class.getName());
+ OperationMetaData opMetaData = epInv.getOperationMetaData();
+
+ // Get the handler callback
+ String key = ServiceEndpointInvokerEJB21.HandlerCallback.class.getName();
+ ServiceEndpointInvokerEJB21.HandlerCallback callback =
(ServiceEndpointInvokerEJB21.HandlerCallback)mi.getValue(key);
+
+ // Handlers need to be Tx. Therefore we must invoke the handler chain after the
TransactionInterceptor.
+ if (callback != null && epInv != null)
+ {
+ try
+ {
+ // call the request handlers
+ boolean handlersPass =
callback.callRequestHandlerChain(HandlerType.ENDPOINT);
+ handlersPass = handlersPass &&
callback.callRequestHandlerChain(HandlerType.POST);
+
+ // Call the next interceptor in the chain
+ if (handlersPass)
+ {
+ // The SOAPContentElements stored in the EndpointInvocation might have
changed after
+ // handler processing. Get the updated request payload. This should be a
noop if request
+ // handlers did not modify the incomming SOAP message.
+ Object[] reqParams = epInv.getRequestPayload();
+ mi.setArguments(reqParams);
+ Object resObj = getNext().invoke(mi);
+ epInv.setReturnValue(resObj);
+
+ // Bind the response message
+ CommonBindingProvider bindingProvider = new
CommonBindingProvider(opMetaData.getEndpointMetaData());
+ CommonBinding binding =
(CommonBinding)bindingProvider.getCommonBinding();
+ SOAPMessage resMessage =
(SOAPMessage)binding.bindResponseMessage(opMetaData, epInv);
+ msgContext.setSOAPMessage(resMessage);
+ }
+
+ // call the response handlers
+ handlersPass = callback.callResponseHandlerChain(HandlerType.POST);
+ handlersPass = handlersPass &&
callback.callResponseHandlerChain(HandlerType.ENDPOINT);
+
+ // update the return value after response handler processing
+ Object resObj = epInv.getReturnValue();
+
+ return resObj;
+ }
+ catch (Exception ex)
+ {
+ try
+ {
+ SOAPMessage faultMessage =
SOAPFaultHelperJAXRPC.exceptionToFaultMessage(ex);
+ msgContext.setSOAPMessage(faultMessage);
+
+ // call the fault handlers
+ boolean handlersPass = callback.callFaultHandlerChain(HandlerType.POST,
ex);
+ handlersPass = handlersPass &&
callback.callFaultHandlerChain(HandlerType.ENDPOINT, ex);
+ }
+ catch (Exception subEx)
+ {
+ log.warn("Cannot process handlerChain.handleFault, ignoring: ",
subEx);
+ }
+ throw ex;
+ }
+ finally
+ {
+ // do nothing
+ }
+ }
+ else
+ {
+ log.warn("Handler callback not available");
+ return getNext().invoke(mi);
+ }
+ }
+}
Property changes on:
branches/jbossws-1.2.0/integration-jboss50/src/java/org/jboss/ws/integration/jboss50/ServiceEndpointInterceptor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-1.2.0/jbossws-tests/src/etc/jndi.properties
===================================================================
--- branches/jbossws-1.2.0/jbossws-tests/src/etc/jndi.properties
(rev 0)
+++ branches/jbossws-1.2.0/jbossws-tests/src/etc/jndi.properties 2007-03-09 14:15:46 UTC
(rev 2573)
@@ -0,0 +1,3 @@
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
+java.naming.provider.url=jnp://localhost:1099
\ No newline at end of file
Added: branches/jbossws-1.2.0/jbossws-tests/src/etc/log4j.xml
===================================================================
--- branches/jbossws-1.2.0/jbossws-tests/src/etc/log4j.xml (rev
0)
+++ branches/jbossws-1.2.0/jbossws-tests/src/etc/log4j.xml 2007-03-09 14:15:46 UTC (rev
2573)
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- ===================================================================== -->
+<!-- -->
+<!-- Log4j Configuration -->
+<!-- -->
+<!-- ===================================================================== -->
+
+<!-- $Id$ -->
+
+<!--
+| For more configuration infromation and examples see the Jakarta Log4j
+| owebsite:
http://jakarta.apache.org/log4j
+-->
+
+<log4j:configuration
xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <!-- A time/date based rolling appender -->
+ <appender name="FILE"
class="org.jboss.logging.appender.DailyRollingFileAppender">
+ <param name="File" value="${build.testlog}/test.log"/>
+ <param name="Append" value="false"/>
+
+ <!-- Rollover at midnight each day -->
+ <param name="DatePattern" value="'.'yyyy-MM-dd"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c:%L]
%m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE"
class="org.apache.log4j.ConsoleAppender">
+ <param name="Threshold" value="INFO"/>
+ <param name="Target" value="System.out"/>
+
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}]
%m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <category name="org.jboss.ws">
+ <priority value="DEBUG"/>
+ </category>
+
+ <category name="org.jboss.remoting">
+ <priority value="INFO"/>
+ </category>
+
+ <!-- Apache security is verbose -->
+ <category name="org.apache.xml.security">
+ <priority value="INFO"/>
+ </category>
+
+ <!-- Enable SOAP message tracing -->
+ <category name="jbossws.SOAPMessage">
+ <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+ </category>
+
+ <!--
+ <category name="org.jboss.xb">
+ <priority value="TRACE" class="org.jboss.logging.XLevel"/>
+ </category>
+ -->
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+<!--
+ <appender-ref ref="CONSOLE"/>
+-->
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
Property changes on: branches/jbossws-1.2.0/jbossws-tests/src/etc/log4j.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-1.2.0/jbossws-tests/src/etc/tst.policy
===================================================================
--- branches/jbossws-1.2.0/jbossws-tests/src/etc/tst.policy (rev
0)
+++ branches/jbossws-1.2.0/jbossws-tests/src/etc/tst.policy 2007-03-09 14:15:46 UTC (rev
2573)
@@ -0,0 +1,4 @@
+grant {
+ permission java.security.AllPermission;
+};
+
Added:
branches/jbossws-1.2.0/jbossws-tests/src/resources/jaxws/samples/webserviceref/WEB-INF-client/jboss-web.xml
===================================================================
---
branches/jbossws-1.2.0/jbossws-tests/src/resources/jaxws/samples/webserviceref/WEB-INF-client/jboss-web.xml
(rev 0)
+++
branches/jbossws-1.2.0/jbossws-tests/src/resources/jaxws/samples/webserviceref/WEB-INF-client/jboss-web.xml 2007-03-09
14:15:46 UTC (rev 2573)
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 5.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
+
+<jboss-web>
+
+
+ <!--
+ @WebServiceRef(name = "service1", value = TestEndpointService.class,
wsdlLocation = "WEB-INF/wsdl/TestEndpoint.wsdl")
+ <service-ref>
+ <service-ref-name>service1</service-ref-name>
+ <wsdl-override>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+ -->
+
+ <!--
+ @WebServiceRef(name = "service2", value = TestEndpointService.class)
+ -->
+ <service-ref>
+ <service-ref-name>service2</service-ref-name>
+ <wsdl-override>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(name = "TestEndpointService3")
+ -->
+ <service-ref>
+ <service-ref-name>TestEndpointService3</service-ref-name>
+ <wsdl-override>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef
+ -->
+ <service-ref>
+
<service-ref-name>org.jboss.test.ws.jaxws.samples.webserviceref.ServletClient/service4</service-ref-name>
+ <wsdl-override>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(name = "TestEndpointService5")
+ -->
+ <service-ref>
+ <service-ref-name>TestEndpointService5</service-ref-name>
+ <wsdl-override>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef
+ -->
+ <service-ref>
+
<service-ref-name>org.jboss.test.ws.jaxws.samples.webserviceref.ServletClient/service6</service-ref-name>
+ <wsdl-override>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(name = "port1", value = TestEndpointService.class, type =
TestEndpoint.class)
+ -->
+ <service-ref>
+ <service-ref-name>port1</service-ref-name>
+ <wsdl-override>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(name = "Port2", value = TestEndpointService.class)
+ -->
+ <service-ref>
+ <service-ref-name>Port2</service-ref-name>
+ <wsdl-override>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+ <!--
+ @WebServiceRef(value = TestEndpointService.class)
+ -->
+ <service-ref>
+
<service-ref-name>org.jboss.test.ws.jaxws.samples.webserviceref.ServletClient/port3</service-ref-name>
+ <wsdl-override>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
+ </service-ref>
+
+</jboss-web>
\ No newline at end of file
Property changes on:
branches/jbossws-1.2.0/jbossws-tests/src/resources/jaxws/samples/webserviceref/WEB-INF-client/jboss-web.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF