JBossWS SVN: r5216 - legacy/branches.
by jbossws-commits@lists.jboss.org
Author: mageshbk(a)jboss.com
Date: 2007-12-06 20:20:25 -0500 (Thu, 06 Dec 2007)
New Revision: 5216
Added:
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/
Log:
Branch for [JBWS-1900]
Copied: legacy/branches/jbossws-1.2.1.GA_JBWS-1900 (from rev 5215, legacy/branches/jbossws-1.2.1.GA_JBWS-1875)
17 years, 1 month
JBossWS SVN: r5215 - legacy/branches.
by jbossws-commits@lists.jboss.org
Author: mageshbk(a)jboss.com
Date: 2007-12-06 20:07:57 -0500 (Thu, 06 Dec 2007)
New Revision: 5215
Removed:
legacy/branches/jbossws-1.2.1.GA_JBWS-1900/
Log:
Removed file/folder
17 years, 1 month
JBossWS SVN: r5214 - framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/invocation.
by jbossws-commits@lists.jboss.org
Author: alessio.soldano(a)jboss.com
Date: 2007-12-06 17:31:34 -0500 (Thu, 06 Dec 2007)
New Revision: 5214
Added:
framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/invocation/RecordingRequestHandlerImpl.java
Log:
RecordingRequestHandlerImpl first cut (simply writing to the log)
Added: framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/invocation/RecordingRequestHandlerImpl.java
===================================================================
--- framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/invocation/RecordingRequestHandlerImpl.java (rev 0)
+++ framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/invocation/RecordingRequestHandlerImpl.java 2007-12-06 22:31:34 UTC (rev 5214)
@@ -0,0 +1,209 @@
+/*
+ * 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.wsf.framework.invocation;
+
+//$Id$
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpServletResponseWrapper;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.common.IOUtils;
+import org.jboss.wsf.spi.deployment.Endpoint;
+import org.jboss.wsf.spi.invocation.InvocationContext;
+import org.jboss.wsf.spi.invocation.RequestHandler;
+
+/**
+ * A request handler that records requests and responses
+ *
+ * @author alessio.soldano(a)jboss.org
+ * @since 06-Dec-2007
+ */
+public class RecordingRequestHandlerImpl implements RequestHandler
+{
+
+ private RequestHandler delegateHandler;
+
+ public RecordingRequestHandlerImpl(RequestHandler delegateHandler)
+ {
+ this.delegateHandler = delegateHandler;
+ }
+
+ public void handleHttpRequest(Endpoint endpoint, HttpServletRequest req, HttpServletResponse res, ServletContext context) throws ServletException, IOException
+ {
+ Logger.getLogger(this.getClass()).info("*** handleHttpRequest");
+
+ byte[] bytes = readInputStream(req.getInputStream());
+ Logger.getLogger(this.getClass()).info("REQUEST: "+new String(bytes));
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+ delegateHandler.handleHttpRequest(endpoint, new DelegatingRequestWrapper(req, new ByteArrayInputStream(bytes)), new DelegatingResponseWrapper(res, baos), context);
+ Logger.getLogger(this.getClass()).info("RESPONSE: "+baos.toString());
+ }
+
+ public void handleRequest(Endpoint endpoint, InputStream inputStream, OutputStream outputStream, InvocationContext context) throws IOException
+ {
+ Logger.getLogger(this.getClass()).info("*** handleRequest");
+
+ byte[] bytes = readInputStream(inputStream);
+ Logger.getLogger(this.getClass()).info("REQUEST: "+new String(bytes));
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+ delegateHandler.handleRequest(endpoint, new ByteArrayInputStream(bytes), new DoubleOutputStream(outputStream, baos), context);
+ Logger.getLogger(this.getClass()).info("RESPONSE: "+baos.toString());
+ }
+
+ public void handleWSDLRequest(Endpoint endpoint, OutputStream output, InvocationContext context) throws IOException
+ {
+ Logger.getLogger(this.getClass()).info("*** handleWSDLRequest");
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
+ delegateHandler.handleWSDLRequest(endpoint, new DoubleOutputStream(output, baos), context);
+ Logger.getLogger(this.getClass()).info("RESPONSE: "+baos.toString());
+ }
+
+ private byte[] readInputStream(InputStream is) throws IOException
+ {
+ ByteArrayOutputStream os = new ByteArrayOutputStream(1024);
+ IOUtils.copyStream(os, is);
+ return os.toByteArray();
+ }
+
+ /**
+ * A HttpServletRequestWrapper that uses a given input stream.
+ * It delegates everything else to the original request wrapper.
+ *
+ */
+ private class DelegatingRequestWrapper extends HttpServletRequestWrapper
+ {
+ private InputStream inputStream;
+ private ServletInputStream servletInputStream;
+
+ public DelegatingRequestWrapper(HttpServletRequest httpServletRequest, InputStream inputStream)
+ {
+ super(httpServletRequest);
+ this.inputStream = inputStream;
+ }
+
+ @Override
+ public ServletInputStream getInputStream() throws IOException
+ {
+ if (servletInputStream == null)
+ {
+ servletInputStream = new DelegatingInputStream(inputStream);
+ }
+ return servletInputStream;
+ }
+ }
+
+ /**
+ * A ServletInputStream that delegates read invocations
+ * to a given input stream.
+ *
+ */
+ private class DelegatingInputStream extends ServletInputStream
+ {
+ private InputStream inputStream;
+
+ public DelegatingInputStream(InputStream inputStream)
+ {
+ this.inputStream = inputStream;
+ }
+
+ @Override
+ public int read() throws IOException
+ {
+ return inputStream.read();
+ }
+ }
+
+ /**
+ * A HttpServletResponseWrapper that uses a given output stream.
+ * It delegates everything else to the original response wrapper.
+ *
+ */
+ private class DelegatingResponseWrapper extends HttpServletResponseWrapper
+ {
+ private OutputStream outputStream;
+ private ServletOutputStream servletOutputStream;
+
+ public DelegatingResponseWrapper(HttpServletResponse httpServletResponse, OutputStream outputStream)
+ {
+ super(httpServletResponse);
+ this.outputStream = outputStream;
+ }
+
+ @Override
+ public ServletOutputStream getOutputStream() throws IOException
+ {
+ if (servletOutputStream == null)
+ {
+ servletOutputStream = new DoubleOutputStream(super.getOutputStream(), outputStream);
+ }
+ return servletOutputStream;
+ }
+ }
+
+ /**
+ * A ServletOutputStream that delegates write invocations
+ * to two given output streams.
+ *
+ */
+ private class DoubleOutputStream extends ServletOutputStream
+ {
+ private OutputStream first;
+ private OutputStream second;
+
+ public DoubleOutputStream(OutputStream first, OutputStream second)
+ {
+ this.first = first;
+ this.second = second;
+ }
+
+ @Override
+ public void write(byte[] b, int off, int len) throws IOException
+ {
+ first.write(b, off, len);
+ second.write(b, off, len);
+ }
+
+ @Override
+ public void write(int b) throws IOException
+ {
+ first.write(b);
+ second.write(b);
+ }
+ }
+
+}
Property changes on: framework/branches/asoldano/trunk/src/main/java/org/jboss/wsf/framework/invocation/RecordingRequestHandlerImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
17 years, 1 month
JBossWS SVN: r5213 - in stack/cxf/trunk: src/main/java/org/jboss/wsf/stack/cxf and 3 other directories.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-12-06 11:37:59 -0500 (Thu, 06 Dec 2007)
New Revision: 5213
Added:
stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/
stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceObjectFactory.java
stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceRefBinderFactoryImpl.java
stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceRefBinderJAXRPC.java
stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceRefBinderJAXWS.java
stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceReferenceable.java
stack/cxf/trunk/src/main/resources/jbossws-cxf.jar/META-INF/services/org.jboss.wsf.spi.serviceref.ServiceRefBinderFactory
Modified:
stack/cxf/trunk/ant-import/build-thirdparty.xml
stack/cxf/trunk/src/test/resources/test-excludes-jboss500.txt
Log:
[JBWS-1756] Fix @WebServiceRef with CXF
Modified: stack/cxf/trunk/ant-import/build-thirdparty.xml
===================================================================
--- stack/cxf/trunk/ant-import/build-thirdparty.xml 2007-12-06 16:28:41 UTC (rev 5212)
+++ stack/cxf/trunk/ant-import/build-thirdparty.xml 2007-12-06 16:37:59 UTC (rev 5213)
@@ -81,6 +81,7 @@
<pathelement location="${thirdparty.dir}/jbossws-spi.jar"/>
<pathelement location="${thirdparty.dir}/cxf-${cxf.version}.jar"/>
+ <pathelement location="${thirdparty.dir}/geronimo-ws-metadata_${cxf.geronimo.ws.metadata}.jar"/>
<pathelement location="${thirdparty.dir}/jaxws-api-${cxf.jaxws.api}.jar"/>
<pathelement location="${thirdparty.dir}/spring-beans-${cxf.spring}.jar"/>
<pathelement location="${thirdparty.dir}/spring-context-${cxf.spring}.jar"/>
Added: stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceObjectFactory.java
===================================================================
--- stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceObjectFactory.java (rev 0)
+++ stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceObjectFactory.java 2007-12-06 16:37:59 UTC (rev 5213)
@@ -0,0 +1,215 @@
+/*
+ * 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.wsf.stack.cxf.client;
+
+// $Id: $
+
+import org.jboss.wsf.spi.WSFException;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
+
+import javax.naming.*;
+import javax.naming.spi.ObjectFactory;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.Hashtable;
+import org.jboss.logging.Logger;
+
+/**
+ * This ServiceObjectFactory reconstructs a javax.xml.ws.Service
+ * for a given WSDL when the webservice client does a JNDI lookup
+ *
+ * @see ServiceReferenceable
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 06-Dec-2007
+ */
+public class ServiceObjectFactory implements ObjectFactory
+{
+ protected final Logger log = Logger.getLogger(ServiceObjectFactory.class);
+
+ /**
+ * Creates an object using the location or reference information specified.
+ * <p/>
+ *
+ * @param obj The possibly null object containing location or reference
+ * information that can be used in creating an object.
+ * @param name The name of this object relative to <code>nameCtx</code>,
+ * or null if no name is specified.
+ * @param nameCtx The context relative to which the <code>name</code>
+ * parameter is specified, or null if <code>name</code> is
+ * relative to the default initial context.
+ * @param environment The possibly null environment that is used in
+ * creating the object.
+ * @return The object created; null if an object cannot be created.
+ * @throws Exception if this object factory encountered an exception
+ * while attempting to create an object, and no other object factories are
+ * to be tried.
+ * @see javax.naming.spi.NamingManager#getObjectInstance
+ * @see javax.naming.spi.NamingManager#getURLContext
+ */
+ public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception
+ {
+ try
+ {
+ Reference ref = (Reference)obj;
+
+ // Get the target class name
+ String targetClassName = (String)ref.get(ServiceReferenceable.TARGET_CLASS_NAME).getContent();
+
+ // Unmarshall the UnifiedServiceRef
+ UnifiedServiceRefMetaData serviceRef = unmarshallServiceRef(ref);
+ String serviceRefName = serviceRef.getServiceRefName();
+ QName serviceQName = serviceRef.getServiceQName();
+
+ String serviceImplClass = serviceRef.getServiceImplClass();
+ if (serviceImplClass == null)
+ serviceImplClass = (String)ref.get(ServiceReferenceable.SERVICE_IMPL_CLASS).getContent();
+
+ // If the target defaults to javax.xml.ws.Service, use the service as the target
+ if (Service.class.getName().equals(targetClassName))
+ targetClassName = serviceImplClass;
+
+ log.debug("getObjectInstance [name=" + serviceRefName + ",service=" + serviceImplClass + ",target=" + targetClassName + "]");
+
+ // Load the service class
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ Class serviceClass = ctxLoader.loadClass(serviceImplClass);
+ Class targetClass = (targetClassName != null ? ctxLoader.loadClass(targetClassName) : null);
+
+ if (Service.class.isAssignableFrom(serviceClass) == false)
+ throw new IllegalArgumentException("WebServiceRef type '" + serviceClass + "' is not assignable to javax.xml.ws.Service");
+
+ // Receives either a javax.xml.ws.Service or a dynamic proxy
+ Object target;
+
+ // Get the URL to the wsdl
+ URL wsdlURL = serviceRef.getWsdlLocation();
+
+ // Generic javax.xml.ws.Service
+ if (serviceClass == Service.class)
+ {
+ if (wsdlURL != null)
+ {
+ target = Service.create(wsdlURL, serviceQName);
+ }
+ else
+ {
+ throw new IllegalArgumentException("Cannot create generic javax.xml.ws.Service without wsdlLocation: " + serviceRefName);
+ }
+ }
+ // Generated javax.xml.ws.Service subclass
+ else
+ {
+ if (wsdlURL != null)
+ {
+ Constructor ctor = serviceClass.getConstructor(new Class[] { URL.class, QName.class });
+ target = ctor.newInstance(new Object[] { wsdlURL, serviceQName });
+ }
+ else
+ {
+ target = (Service)serviceClass.newInstance();
+ }
+ }
+
+ // Configure the service
+ configureService((Service)target, serviceRef);
+
+ if (targetClassName != null && targetClassName.equals(serviceImplClass) == false)
+ {
+ try
+ {
+ Object port = null;
+ if (serviceClass != Service.class)
+ {
+ for (Method method : serviceClass.getDeclaredMethods())
+ {
+ String methodName = method.getName();
+ Class retType = method.getReturnType();
+ if (methodName.startsWith("get") && targetClass.isAssignableFrom(retType))
+ {
+ port = method.invoke(target, new Object[0]);
+ target = port;
+ break;
+ }
+ }
+ }
+
+ if (port == null)
+ {
+ Method method = serviceClass.getMethod("getPort", new Class[] { Class.class });
+ port = method.invoke(target, new Object[] { targetClass });
+ target = port;
+ }
+ }
+ catch (InvocationTargetException ex)
+ {
+ throw ex.getTargetException();
+ }
+ }
+
+ return target;
+ }
+ catch (Throwable ex)
+ {
+ WSFException.rethrow("Cannot create service", ex);
+ return null;
+ }
+ }
+
+
+ private void configureService(Service service, UnifiedServiceRefMetaData serviceRef)
+ {
+ log.warn("Service configuration not available in Sun-RI");
+ }
+
+ private UnifiedServiceRefMetaData unmarshallServiceRef(Reference ref) throws ClassNotFoundException, NamingException
+ {
+ UnifiedServiceRefMetaData sref;
+ RefAddr refAddr = ref.get(ServiceReferenceable.SERVICE_REF_META_DATA);
+ ByteArrayInputStream bais = new ByteArrayInputStream((byte[])refAddr.getContent());
+ try
+ {
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ sref = (UnifiedServiceRefMetaData)ois.readObject();
+ ois.close();
+ }
+ catch (IOException e)
+ {
+ throw new NamingException("Cannot unmarshall service ref meta data, cause: " + e.toString());
+ }
+
+ // Verify it. There is some know coinstraints
+ if(null == sref.getServiceQName())
+ throw new IllegalArgumentException("ServiceQName may not be null. " +
+ "Specify a service QName in the <service-ref> declaration, or thorugh the @WebServiceClient annotation.");
+
+ return sref;
+ }
+}
+
Added: stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceRefBinderFactoryImpl.java
===================================================================
--- stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceRefBinderFactoryImpl.java (rev 0)
+++ stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceRefBinderFactoryImpl.java 2007-12-06 16:37:59 UTC (rev 5213)
@@ -0,0 +1,42 @@
+/*
+ * 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.wsf.stack.cxf.client;
+
+// $Id: ServiceRefBinderJAXWS.java 4049 2007-08-01 11:26:30Z thomas.diesler(a)jboss.com $
+
+import org.jboss.wsf.spi.serviceref.ServiceRefBinder;
+import org.jboss.wsf.spi.serviceref.ServiceRefBinderFactory;
+import org.jboss.wsf.spi.serviceref.ServiceRefHandler.Type;
+
+/**
+ * Binds a JAXWS Service object in the client's ENC
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 06-Dec-2007
+ */
+public class ServiceRefBinderFactoryImpl implements ServiceRefBinderFactory
+{
+ public ServiceRefBinder newServiceRefBinder(Type type)
+ {
+ return (type == Type.JAXRPC ? new ServiceRefBinderJAXRPC() : new ServiceRefBinderJAXWS());
+ }
+}
Added: stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceRefBinderJAXRPC.java
===================================================================
--- stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceRefBinderJAXRPC.java (rev 0)
+++ stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceRefBinderJAXRPC.java 2007-12-06 16:37:59 UTC (rev 5213)
@@ -0,0 +1,44 @@
+/*
+ * 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.wsf.stack.cxf.client;
+
+// $Id: $
+
+import java.lang.reflect.AnnotatedElement;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
+import org.jboss.wsf.spi.serviceref.ServiceRefBinder;
+
+/**
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 06-Dec-2007
+ */
+public class ServiceRefBinderJAXRPC implements ServiceRefBinder
+{
+ public void setupServiceRef(Context encCtx, String encName, AnnotatedElement anElement, UnifiedServiceRefMetaData serviceRef, ClassLoader loader) throws NamingException
+ {
+ throw new IllegalArgumentException("Deployed stack does not support JAX-RPC service-ref deployments");
+ }
+}
Added: stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceRefBinderJAXWS.java
===================================================================
--- stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceRefBinderJAXWS.java (rev 0)
+++ stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceRefBinderJAXWS.java 2007-12-06 16:37:59 UTC (rev 5213)
@@ -0,0 +1,223 @@
+/*
+ * 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.wsf.stack.cxf.client;
+
+// $Id: $
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jws.HandlerChain;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.Referenceable;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceClient;
+import javax.xml.ws.WebServiceRef;
+import javax.xml.ws.WebServiceRefs;
+
+import org.jboss.logging.Logger;
+import org.jboss.util.naming.Util;
+import org.jboss.wsf.spi.WSFException;
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
+import org.jboss.wsf.spi.serviceref.ServiceRefBinder;
+
+/**
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 06-Dec-2007
+ */
+public class ServiceRefBinderJAXWS implements ServiceRefBinder
+{
+ // logging support
+ private static Logger log = Logger.getLogger(ServiceRefBinderJAXWS.class);
+
+ public void setupServiceRef(Context encCtx, String encName, AnnotatedElement anElement, UnifiedServiceRefMetaData serviceRef, ClassLoader loader)
+ throws NamingException
+ {
+ WebServiceRef wsref = null;
+
+ if (null == loader)
+ throw new IllegalArgumentException("There needs to be a classloader available");
+
+ // Build the list of @WebServiceRef relevant annotations
+ List<WebServiceRef> wsrefList = new ArrayList<WebServiceRef>();
+
+ if (anElement != null)
+ {
+ for (Annotation an : anElement.getAnnotations())
+ {
+ if (an instanceof WebServiceRef)
+ wsrefList.add((WebServiceRef)an);
+
+ if (an instanceof WebServiceRefs)
+ {
+ WebServiceRefs wsrefs = (WebServiceRefs)an;
+ for (WebServiceRef aux : wsrefs.value())
+ wsrefList.add(aux);
+ }
+ }
+ }
+
+ // Use the single @WebServiceRef
+ if (wsrefList.size() == 1)
+ {
+ wsref = wsrefList.get(0);
+ }
+ else
+ {
+ for (WebServiceRef aux : wsrefList)
+ {
+ if (encName.endsWith("/" + aux.name()))
+ {
+ wsref = aux;
+ break;
+ }
+ }
+ }
+
+ Class targetClass = null;
+ if (anElement instanceof Field)
+ {
+ targetClass = ((Field)anElement).getType();
+ }
+ else if (anElement instanceof Method)
+ {
+ targetClass = ((Method)anElement).getParameterTypes()[0];
+ }
+ else
+ {
+ if (wsref != null && (wsref.type() != Object.class))
+ targetClass = wsref.type();
+ }
+
+ String targetClassName = (targetClass != null ? targetClass.getName() : null);
+ String externalName = encCtx.getNameInNamespace() + "/" + encName;
+ log.debug("setupServiceRef [jndi=" + externalName + ",target=" + targetClassName + "]");
+
+ String serviceImplClass = null;
+
+ // #1 Use the explicit @WebServiceRef.value
+ if (wsref != null && wsref.value() != Object.class)
+ serviceImplClass = wsref.value().getName();
+
+ // #2 Use the target ref type
+ if (serviceImplClass == null && targetClass != null && Service.class.isAssignableFrom(targetClass))
+ serviceImplClass = targetClass.getName();
+
+ // #3 Use <service-interface>
+ if (serviceImplClass == null && serviceRef.getServiceInterface() != null)
+ serviceImplClass = serviceRef.getServiceInterface();
+
+ // #4 Use javax.xml.ws.Service
+ if (serviceImplClass == null)
+ serviceImplClass = Service.class.getName();
+
+ // #1 Use the explicit @WebServiceRef.type
+ if (wsref != null && wsref.type() != Object.class)
+ targetClassName = wsref.type().getName();
+
+ // #2 Use the target ref type
+ if (targetClassName == null && targetClass != null && Service.class.isAssignableFrom(targetClass) == false)
+ targetClassName = targetClass.getName();
+
+ // Set the wsdlLocation if there is no override already
+ if (serviceRef.getWsdlOverride() == null && wsref != null && wsref.wsdlLocation().length() > 0)
+ serviceRef.setWsdlOverride(wsref.wsdlLocation());
+
+ // Set the handlerChain from @HandlerChain on the annotated element
+ String handlerChain = serviceRef.getHandlerChain();
+ if (anElement != null)
+ {
+ HandlerChain anHandlerChain = anElement.getAnnotation(HandlerChain.class);
+ if (handlerChain == null && anHandlerChain != null && anHandlerChain.file().length() > 0)
+ handlerChain = anHandlerChain.file();
+ }
+
+ // Resolve path to handler chain
+ if (handlerChain != null)
+ {
+ try
+ {
+ new URL(handlerChain);
+ }
+ catch (MalformedURLException ex)
+ {
+ Class declaringClass = null;
+ if (anElement instanceof Field)
+ declaringClass = ((Field)anElement).getDeclaringClass();
+ else if (anElement instanceof Method)
+ declaringClass = ((Method)anElement).getDeclaringClass();
+ else if (anElement instanceof Class)
+ declaringClass = (Class)anElement;
+
+ handlerChain = declaringClass.getPackage().getName().replace('.', '/') + "/" + handlerChain;
+ }
+
+ serviceRef.setHandlerChain(handlerChain);
+ }
+
+ // Extract service QName for target service
+ if (null == serviceRef.getServiceQName())
+ {
+ try
+ {
+ Class serviceClass = loader.loadClass(serviceImplClass);
+ if (serviceClass.getAnnotation(WebServiceClient.class) != null)
+ {
+ WebServiceClient clientDecl = (WebServiceClient)serviceClass.getAnnotation(WebServiceClient.class);
+ serviceRef.setServiceQName(new QName(clientDecl.targetNamespace(), clientDecl.name()));
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ WSFException.rethrow("Cannot extract service QName for target service", e);
+ }
+ }
+
+ // Do not use rebind, the binding should be unique
+ // [JBWS-1499] - Revisit WebServiceRefHandler JNDI rebind
+ Referenceable serviceReferenceable = buildServiceReferenceable(serviceImplClass, targetClassName, serviceRef);
+ Util.bind(encCtx, encName, serviceReferenceable);
+
+ }
+
+ /**
+ * Create a Sun-RI specific service referenceable.
+ * Most of the setup is done in {@link org.jboss.wsf.framework.serviceref.ServiceRefBinderJAXWS}
+ *
+ * @param serviceImplClass
+ * @param targetClassName
+ * @param serviceRef
+ * @return a Sun-RI specific service referenceable.
+ */
+ protected Referenceable buildServiceReferenceable(String serviceImplClass, String targetClassName, UnifiedServiceRefMetaData serviceRef)
+ {
+ return new ServiceReferenceable(serviceImplClass, targetClassName, serviceRef);
+ }
+}
Added: stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceReferenceable.java
===================================================================
--- stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceReferenceable.java (rev 0)
+++ stack/cxf/trunk/src/main/java/org/jboss/wsf/stack/cxf/client/ServiceReferenceable.java 2007-12-06 16:37:59 UTC (rev 5213)
@@ -0,0 +1,91 @@
+/*
+ * 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.wsf.stack.cxf.client;
+
+// $Id: $
+
+import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
+
+import javax.naming.*;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.io.IOException;
+
+/**
+ * A JNDI reference to a javax.xml.ws.Service
+ *
+ * It holds the information to reconstrut the javax.xml.ws.Service
+ * when the client does a JNDI lookup.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 06-Dec-2007
+ */
+public class ServiceReferenceable implements Referenceable
+{
+ public static final String SERVICE_REF_META_DATA = "SERVICE_REF_META_DATA";
+ public static final String SERVICE_IMPL_CLASS = "SERVICE_CLASS_NAME";
+ public static final String TARGET_CLASS_NAME = "TARGET_CLASS_NAME";
+
+ private String serviceImplClass;
+ private String targetClassName;
+ private UnifiedServiceRefMetaData serviceRef;
+
+ public ServiceReferenceable(String serviceImplClass, String targetClassName, UnifiedServiceRefMetaData serviceRef)
+ {
+ this.serviceImplClass = serviceImplClass;
+ this.targetClassName = targetClassName;
+ this.serviceRef = serviceRef;
+ }
+
+ /**
+ * Retrieves the Reference of this object.
+ *
+ * @return The non-null Reference of this object.
+ * @throws javax.naming.NamingException If a naming exception was encountered while retrieving the reference.
+ */
+ public Reference getReference() throws NamingException
+ {
+ Reference myRef = new Reference(ServiceReferenceable.class.getName(), ServiceObjectFactory.class.getName(), null);
+
+ myRef.add(new StringRefAddr(SERVICE_IMPL_CLASS, serviceImplClass));
+ myRef.add(new StringRefAddr(TARGET_CLASS_NAME, targetClassName));
+ myRef.add(new BinaryRefAddr(SERVICE_REF_META_DATA, marshall(serviceRef)));
+
+ return myRef;
+ }
+
+ private byte[] marshall(Object obj) throws NamingException
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
+ try
+ {
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(obj);
+ oos.close();
+ }
+ catch (IOException e)
+ {
+ throw new NamingException("Cannot marshall object, cause: " + e.toString());
+ }
+ return baos.toByteArray();
+ }
+}
Added: stack/cxf/trunk/src/main/resources/jbossws-cxf.jar/META-INF/services/org.jboss.wsf.spi.serviceref.ServiceRefBinderFactory
===================================================================
--- stack/cxf/trunk/src/main/resources/jbossws-cxf.jar/META-INF/services/org.jboss.wsf.spi.serviceref.ServiceRefBinderFactory (rev 0)
+++ stack/cxf/trunk/src/main/resources/jbossws-cxf.jar/META-INF/services/org.jboss.wsf.spi.serviceref.ServiceRefBinderFactory 2007-12-06 16:37:59 UTC (rev 5213)
@@ -0,0 +1 @@
+org.jboss.wsf.stack.cxf.client.ServiceRefBinderFactoryImpl
\ No newline at end of file
Modified: stack/cxf/trunk/src/test/resources/test-excludes-jboss500.txt
===================================================================
--- stack/cxf/trunk/src/test/resources/test-excludes-jboss500.txt 2007-12-06 16:28:41 UTC (rev 5212)
+++ stack/cxf/trunk/src/test/resources/test-excludes-jboss500.txt 2007-12-06 16:37:59 UTC (rev 5213)
@@ -14,11 +14,6 @@
# [JBWS-1683] Fix JAXR samples for CXF
org/jboss/test/ws/jaxws/samples/jaxr/**
-# [JBWS-1756] Fix @WebServiceRef with CXF
-org/jboss/test/ws/jaxws/samples/retail/**
-org/jboss/test/ws/jaxws/samples/serviceref/**
-org/jboss/test/ws/jaxws/samples/webserviceref/**
-
# [JBWS-1774] Provide a tools implementation for CXF (WSContractProvider and WSContractConsumer)
org/jboss/test/ws/jaxws/smoke/tools/**
@@ -35,7 +30,7 @@
# [CXF-1253] CXF does not respect @HandlerChain on client SEI
org/jboss/test/ws/jaxws/samples/logicalhandler/**
-# [CXF-1261] Handler does not see XOP message properly
+# Won't Fix: [CXF-1261] Handler does not see XOP message properly
org/jboss/test/ws/jaxws/samples/xop/doclit/XOPHandlerTestCase.*
17 years, 1 month
JBossWS SVN: r5212 - stack/native/branches/jbossws-native-2.0.1.GA.CP01.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2007-12-06 11:28:41 -0500 (Thu, 06 Dec 2007)
New Revision: 5212
Modified:
stack/native/branches/jbossws-native-2.0.1.GA.CP01/version.properties
Log:
Set the version to 2.0.1.GA_CP01
Modified: stack/native/branches/jbossws-native-2.0.1.GA.CP01/version.properties
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.GA.CP01/version.properties 2007-12-06 16:23:38 UTC (rev 5211)
+++ stack/native/branches/jbossws-native-2.0.1.GA.CP01/version.properties 2007-12-06 16:28:41 UTC (rev 5212)
@@ -5,8 +5,8 @@
specification.vendor=JBoss (http://www.jboss.org)
specification.version=jbossws-2.0
-version.id=2.0.1.GA_CP
-repository.id=2.0.1.GA_CP
+version.id=2.0.1.GA_CP01
+repository.id=2.0.1.GA_CP01
implementation.title=JBoss Web Services - Native
implementation.url=http://www.jboss.org/products/jbossws
17 years, 1 month
JBossWS SVN: r5211 - stack/native/branches.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2007-12-06 11:23:38 -0500 (Thu, 06 Dec 2007)
New Revision: 5211
Added:
stack/native/branches/jbossws-native-2.0.1.GA.CP01/
Log:
Start release.
Copied: stack/native/branches/jbossws-native-2.0.1.GA.CP01 (from rev 5210, stack/native/branches/jbossws-native-2.0.1.GA.CP)
17 years, 1 month
JBossWS SVN: r5210 - stack/native/branches/jbossws-native-2.0.1.GA.CP.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2007-12-06 11:23:00 -0500 (Thu, 06 Dec 2007)
New Revision: 5210
Modified:
stack/native/branches/jbossws-native-2.0.1.GA.CP/version.properties
Log:
Accept JBoss EAP 4.3 as JBoss 4.2
Modified: stack/native/branches/jbossws-native-2.0.1.GA.CP/version.properties
===================================================================
--- stack/native/branches/jbossws-native-2.0.1.GA.CP/version.properties 2007-12-06 16:11:04 UTC (rev 5209)
+++ stack/native/branches/jbossws-native-2.0.1.GA.CP/version.properties 2007-12-06 16:23:00 UTC (rev 5210)
@@ -5,8 +5,8 @@
specification.vendor=JBoss (http://www.jboss.org)
specification.version=jbossws-2.0
-version.id=2.0.1.SP2
-repository.id=2.0.1.SP2
+version.id=2.0.1.GA_CP
+repository.id=2.0.1.GA_CP
implementation.title=JBoss Web Services - Native
implementation.url=http://www.jboss.org/products/jbossws
@@ -25,7 +25,7 @@
# Dependend integration projects
jbossws-spi=1.0.0.GA
-jbossws-common=1.0.2.GA
+jbossws-common=1.0.2.GA_CP01
jbossws-framework=2.0.1.GA
jbossws-jboss40=2.0.1.GA
jbossws-jboss42=2.0.1.GA
17 years, 1 month
JBossWS SVN: r5209 - stack/native/branches.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2007-12-06 11:11:04 -0500 (Thu, 06 Dec 2007)
New Revision: 5209
Added:
stack/native/branches/jbossws-native-2.0.1.GA.CP/
Removed:
stack/native/branches/jbossws-native-2.0.1.CP/
Log:
Naming consistency with JBossAS CP branches.
Copied: stack/native/branches/jbossws-native-2.0.1.GA.CP (from rev 5208, stack/native/branches/jbossws-native-2.0.1.CP)
17 years, 1 month
JBossWS SVN: r5208 - spi/trunk.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2007-12-06 11:08:23 -0500 (Thu, 06 Dec 2007)
New Revision: 5208
Modified:
spi/trunk/version.properties
Log:
update version id
Modified: spi/trunk/version.properties
===================================================================
--- spi/trunk/version.properties 2007-12-06 16:06:44 UTC (rev 5207)
+++ spi/trunk/version.properties 2007-12-06 16:08:23 UTC (rev 5208)
@@ -5,8 +5,8 @@
specification.vendor=JBoss (http://www.jboss.org)
specification.version=jbossws-2.0
-version.id=1.0.0.GA
-repository.id=1.0.0.GA
+version.id=1.0.1.GA
+repository.id=snapshot
implementation.title=JBoss Web Services - SPI
implementation.url=http://www.jboss.org/products/jbossws
17 years, 1 month
JBossWS SVN: r5207 - stack/native/branches.
by jbossws-commits@lists.jboss.org
Author: darran.lofthouse(a)jboss.com
Date: 2007-12-06 11:06:44 -0500 (Thu, 06 Dec 2007)
New Revision: 5207
Removed:
stack/native/branches/jbossws-native-2.0.1.CP01/
Log:
Start process again.
17 years, 1 month