Author: thomas.diesler(a)jboss.com
Date: 2007-01-19 07:13:27 -0500 (Fri, 19 Jan 2007)
New Revision: 2009
Added:
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/UnifiedServiceRefObjectFactory.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/NameValuePair.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/PortInfo.java
trunk/jbossws-core/src/main/resources/jboss-jaxws.jar/
trunk/jbossws-core/src/main/resources/jboss-jaxws.jar/META-INF/
trunk/jbossws-core/src/main/resources/jboss-jaxws.jar/META-INF/services/
trunk/jbossws-core/src/main/resources/jboss-jaxws.jar/META-INF/services/javax.xml.ws.spi.Provider
trunk/jbossws-tests/src/main/resources/jaxws/webserviceref/META-INF-override/jbossws-client-config.xml
Modified:
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceObjectFactory.java
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/WebServiceRefHandler.java
trunk/jbossws-core/build.xml
trunk/jbossws-core/src/main/java/org/jboss/ws/core/CommonClient.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/UnifiedServiceRef.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java
trunk/jbossws-tests/.classpath
trunk/jbossws-tests/ant-import/build-jars-jaxws.xml
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/StubPropertyTestCase.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/TestEndpointClientTwo.java
trunk/jbossws-tests/src/main/resources/jaxws/webserviceref/META-INF-override/jboss-client.xml
trunk/jbossws-tests/src/main/resources/jaxws/webserviceref/META-INF-secure/jboss-client.xml
Log:
Implement full support for @WebServiceRef overrides in service-ref_5_0.dtd
Modified:
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceObjectFactory.java
===================================================================
---
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceObjectFactory.java 2007-01-19
11:00:41 UTC (rev 2008)
+++
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/ServiceObjectFactory.java 2007-01-19
12:13:27 UTC (rev 2009)
@@ -48,6 +48,7 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.ConfigProvider;
import org.jboss.ws.core.jaxws.client.UnifiedServiceRef;
+import org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl;
import org.jboss.ws.core.server.UnifiedVirtualFile;
/**
@@ -88,19 +89,34 @@
{
Reference ref = (Reference)obj;
- String serviceClassName =
(String)ref.get(ServiceReferenceable.SERVICE_CLASS_NAME).getContent();
- String targetClassName =
(String)ref.get(ServiceReferenceable.TARGET_CLASS_NAME).getContent();
+ // Unmarshall the UnifiedServiceRef
UnifiedServiceRef usRef = unmarshallServiceRef(ref);
String serviceRefName = usRef.getServiceRefName();
+ QName serviceQName = usRef.getServiceQName();
+ // Associate the UnifiedServiceRef with this thread
+ ServiceDelegateImpl.associateUnifiedServiceRef(usRef);
+
+ String serviceClassName = usRef.getServiceClassName();
+ if (serviceClassName == null)
+ serviceClassName =
(String)ref.get(ServiceReferenceable.SERVICE_CLASS_NAME).getContent();
+
+ log.debug("Service class name: " + serviceClassName);
+
+ // Load the service class
ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
Class serviceClass = ctxLoader.loadClass(serviceClassName);
- 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 JAXWS dynamic proxy
+ // Load the target class
+ String targetClassName =
(String)ref.get(ServiceReferenceable.TARGET_CLASS_NAME).getContent();
+ Class targetClass = (targetClassName != null ?
ctxLoader.loadClass(targetClassName) : null);
+
+ log.debug("Target class name: " + serviceClassName);
+
+ // Receives either a javax.xml.ws.Service or a dynamic proxy
Object target;
// Get the URL to the wsdl
@@ -111,7 +127,7 @@
{
if (wsdlURL != null)
{
- target = Service.create(wsdlURL, null);
+ target = Service.create(wsdlURL, serviceQName);
}
else
{
@@ -124,7 +140,7 @@
if (wsdlURL != null)
{
Constructor ctor = serviceClass.getConstructor(new Class[] { URL.class,
QName.class });
- target = ctor.newInstance(new Object[] { wsdlURL, null });
+ target = ctor.newInstance(new Object[] { wsdlURL, serviceQName });
}
else
{
@@ -133,30 +149,25 @@
}
// Configure the service
- if (target instanceof ConfigProvider)
- {
- ConfigProvider cp = (ConfigProvider)target;
- if (usRef.getConfigFile() != null)
- cp.setConfigFile(usRef.getConfigFile());
- if (usRef.getConfigName() != null)
- cp.setConfigName(usRef.getConfigName());
+ configureService((Service)target, usRef);
- }
-
if (targetClassName != null && targetClassName.equals(serviceClassName)
== false)
{
try
{
Object port = null;
- for (Method method : serviceClass.getMethods())
+ if (serviceClass != Service.class)
{
- String methodName = method.getName();
- Class retType = method.getReturnType();
- if (methodName.startsWith("get") &&
targetClass.isAssignableFrom(retType))
+ for (Method method : serviceClass.getDeclaredMethods())
{
- port = method.invoke(target, new Object[0]);
- target = port;
- break;
+ 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;
+ }
}
}
@@ -182,6 +193,22 @@
}
}
+ private void configureService(Service service, UnifiedServiceRef usRef)
+ {
+ String configFile = usRef.getConfigFile();
+ String configName = usRef.getConfigName();
+ if (service instanceof ConfigProvider)
+ {
+ log.debug("Configure Service: [configName=" + configName +
",configFile=" + configFile + "]");
+
+ ConfigProvider cp = (ConfigProvider)service;
+ if (configFile != null)
+ cp.setConfigFile(configFile);
+ if (configName != null)
+ cp.setConfigName(configName);
+ }
+ }
+
private UnifiedServiceRef unmarshallServiceRef(Reference ref) throws
ClassNotFoundException, NamingException
{
UnifiedServiceRef sref;
Added:
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/UnifiedServiceRefObjectFactory.java
===================================================================
---
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/UnifiedServiceRefObjectFactory.java
(rev 0)
+++
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/UnifiedServiceRefObjectFactory.java 2007-01-19
12:13:27 UTC (rev 2009)
@@ -0,0 +1,182 @@
+/*
+ * 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;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+
+import org.jboss.ws.WSException;
+import org.jboss.ws.core.jaxws.client.NameValuePair;
+import org.jboss.ws.core.jaxws.client.PortInfo;
+import org.jboss.ws.core.jaxws.client.UnifiedServiceRef;
+import org.jboss.xb.binding.ObjectModelFactory;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.UnmarshallingContext;
+import org.xml.sax.Attributes;
+
+/**
+ * An ObjectModelFactory for UnifiedServiceRef
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 17-Jan-2007
+ */
+public class UnifiedServiceRefObjectFactory implements ObjectModelFactory
+{
+ // Hide constructor
+ private UnifiedServiceRefObjectFactory()
+ {
+ }
+
+ public static UnifiedServiceRefObjectFactory newInstance()
+ {
+ return new UnifiedServiceRefObjectFactory();
+ }
+
+ public UnifiedServiceRef parse(Source source)
+ {
+ // setup the XML binding Unmarshaller
+ try
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ StreamResult result = new StreamResult(baos);
+ TransformerFactory tf = TransformerFactory.newInstance();
+ tf.newTransformer().transform(source, result);
+
+ InputStream is = new ByteArrayInputStream(baos.toByteArray());
+
+ Unmarshaller unmarshaller =
UnmarshallerFactory.newInstance().newUnmarshaller();
+ return (UnifiedServiceRef)unmarshaller.unmarshal(is, this, null);
+ }
+ catch (Exception ex)
+ {
+ WSException.rethrow(ex);
+ return null;
+ }
+ }
+
+ /**
+ * This method is called on the factory by the object model builder when the parsing
starts.
+ */
+ public Object newRoot(Object root, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
+ {
+ return new UnifiedServiceRef();
+ }
+
+ public Object completeRoot(Object root, UnmarshallingContext ctx, String uri, String
name)
+ {
+ return root;
+ }
+
+ public void setValue(UnifiedServiceRef ref, UnmarshallingContext navigator, String
namespaceURI, String localName, String value)
+ {
+ if (localName.equals("service-ref-name"))
+ {
+ ref.setServiceRefName(value);
+ }
+ else if (localName.equals("service-class-name"))
+ {
+ ref.setServiceClassName(value);
+ }
+ else if (localName.equals("service-qname"))
+ {
+ ref.setServiceQName(navigator.resolveQName(value));
+ }
+ else if (localName.equals("config-name"))
+ {
+ ref.setConfigName(value);
+ }
+ else if (localName.equals("config-file"))
+ {
+ ref.setConfigFile(value);
+ }
+ else if (localName.equals("wsdl-override"))
+ {
+ ref.setWsdlLocation(value);
+ }
+ }
+
+ public Object newChild(UnifiedServiceRef parent, UnmarshallingContext navigator,
String namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+
+ if (localName.equals("port-info"))
+ child = new PortInfo(parent);
+
+ return child;
+ }
+
+ public void addChild(UnifiedServiceRef parent, PortInfo portInfo, UnmarshallingContext
navigator, String namespaceURI, String localName)
+ {
+ parent.getPortInfos().add(portInfo);
+ }
+
+ public void setValue(PortInfo portInfo, UnmarshallingContext navigator, String
namespaceURI, String localName, String value)
+ {
+ if (localName.equals("service-endpoint-interface"))
+ {
+ portInfo.setServiceEndpointInterface(value);
+ }
+ else if (localName.equals("port-qname"))
+ {
+ portInfo.setPortQName(navigator.resolveQName(value));
+ }
+ else if (localName.equals("config-name"))
+ {
+ portInfo.setConfigName(value);
+ }
+ else if (localName.equals("config-file"))
+ {
+ portInfo.setConfigFile(value);
+ }
+ }
+
+ public Object newChild(PortInfo portInfo, UnmarshallingContext navigator, String
namespaceURI, String localName, Attributes attrs)
+ {
+ Object child = null;
+ if (localName.equals("stub-property"))
+ child = new NameValuePair();
+ return child;
+ }
+
+ public void addChild(PortInfo parent, NameValuePair stubProp, UnmarshallingContext
navigator, String namespaceURI, String localName)
+ {
+ parent.getStubProperties().add(stubProp);
+ }
+
+ public void setValue(NameValuePair nvPair, UnmarshallingContext navigator, String
namespaceURI, String localName, String value)
+ {
+ if (localName.equals("name"))
+ {
+ nvPair.setName(value);
+ }
+ else if (localName.equals("value"))
+ {
+ nvPair.setValue(value);
+ }
+ }
+}
Property changes on:
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/UnifiedServiceRefObjectFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/WebServiceRefHandler.java
===================================================================
---
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/WebServiceRefHandler.java 2007-01-19
11:00:41 UTC (rev 2008)
+++
trunk/integration-jboss50/src/main/java/org/jboss/ws/integration/jboss50/WebServiceRefHandler.java 2007-01-19
12:13:27 UTC (rev 2009)
@@ -23,15 +23,10 @@
// $Id$
-import java.net.URL;
-
import javax.management.MBeanServer;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.xml.transform.Source;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMResult;
import javax.xml.ws.Service;
import javax.xml.ws.WebServiceRef;
@@ -41,9 +36,6 @@
import org.jboss.virtual.VirtualFile;
import org.jboss.ws.WSException;
import org.jboss.ws.core.jaxws.client.UnifiedServiceRef;
-import org.jboss.ws.core.utils.DOMUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
/**
* Binds a JAXWS Service object in the client's ENC
@@ -87,7 +79,9 @@
try
{
- UnifiedServiceRef usRef = getUnifiedServiceRef(vfsRoot, metadata);
+ UnifiedServiceRefObjectFactory factory =
UnifiedServiceRefObjectFactory.newInstance();
+ UnifiedServiceRef usRef = factory.parse(metadata);
+ usRef.setRootFile(new VirtualFileAdaptor(vfsRoot));
// Set the wsdlLocation if there is no override already
if (usRef.getWsdlLocation() == null && wsref.wsdlLocation().length()
> 0)
@@ -105,38 +99,6 @@
}
}
- private UnifiedServiceRef getUnifiedServiceRef(VirtualFile vfsRoot, Source metadata)
throws TransformerException
- {
- Element root = getElementFromSource(metadata);
-
- String encName = DOMUtils.getTextContent(DOMUtils.getFirstChildElement(root,
"service-ref-name"));
- UnifiedServiceRef ref = new UnifiedServiceRef(new VirtualFileAdaptor(vfsRoot),
encName);
-
- Element refEl = DOMUtils.getFirstChildElement(root, "config-name");
- if (refEl != null)
- ref.setConfigName(DOMUtils.getTextContent(refEl));
-
- refEl = DOMUtils.getFirstChildElement(root, "config-file");
- if (refEl != null)
- ref.setConfigFile(DOMUtils.getTextContent(refEl));
-
- refEl = DOMUtils.getFirstChildElement(root, "wsdl-override");
- if (refEl != null)
- ref.setWsdlLocation(DOMUtils.getTextContent(refEl));
-
- return ref;
- }
-
- private Element getElementFromSource(Source retObj) throws TransformerException
- {
- DOMResult domResult = new DOMResult();
- TransformerFactory tf = TransformerFactory.newInstance();
- tf.newTransformer().transform(retObj, domResult);
- Document doc = (Document)domResult.getNode();
- Element docElement = doc.getDocumentElement();
- return docElement;
- }
-
public void create() throws Exception
{
MBeanServer server = MBeanServerLocator.locateJBoss();
Modified: trunk/jbossws-core/build.xml
===================================================================
--- trunk/jbossws-core/build.xml 2007-01-19 11:00:41 UTC (rev 2008)
+++ trunk/jbossws-core/build.xml 2007-01-19 12:13:27 UTC (rev 2009)
@@ -126,6 +126,7 @@
<include name="javax/xml/ws/**"/>
<include name="org/jboss/ws/jaxws/injection/**"/>
</fileset>
+ <metainf dir="${core.resources.dir}/jboss-jaxws.jar/META-INF"/>
</jar>
<!-- Build jbossws-core.jar -->
Modified: trunk/jbossws-core/src/main/java/org/jboss/ws/core/CommonClient.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/ws/core/CommonClient.java 2007-01-19
11:00:41 UTC (rev 2008)
+++ trunk/jbossws-core/src/main/java/org/jboss/ws/core/CommonClient.java 2007-01-19
12:13:27 UTC (rev 2009)
@@ -53,7 +53,6 @@
import org.jboss.ws.core.soap.SOAPConnectionImpl;
import org.jboss.ws.core.soap.UnboundHeader;
import org.jboss.ws.core.utils.HolderUtils;
-import org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS;
import org.jboss.ws.extensions.addressing.AddressingConstantsImpl;
import org.jboss.ws.metadata.umdm.ClientEndpointMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
Added: trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/NameValuePair.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/NameValuePair.java
(rev 0)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/NameValuePair.java 2007-01-19
12:13:27 UTC (rev 2009)
@@ -0,0 +1,69 @@
+/*
+ * 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.client;
+
+//$Id$
+
+import java.io.Serializable;
+
+/**
+ * Represents a name value pair
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ */
+public class NameValuePair implements Serializable
+{
+ private static final long serialVersionUID = -7833097600256899477L;
+
+ private String name;
+ private String value;
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer(100);
+ sb.append('[');
+ sb.append("name=").append(name);
+ sb.append(",value=").append(value);
+ sb.append(']');
+ return sb.toString();
+ }
+}
Property changes on:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/NameValuePair.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/PortInfo.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/PortInfo.java
(rev 0)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/PortInfo.java 2007-01-19
12:13:27 UTC (rev 2009)
@@ -0,0 +1,102 @@
+/*
+ * 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.client;
+
+//$Id$
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+/**
+ * Represents a <port-info> element in <service-ref>
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ */
+public class PortInfo implements Serializable
+{
+ private static final long serialVersionUID = -5517739021682888778L;
+
+ private UnifiedServiceRef serviceRef;
+ private String serviceEndpointInterface;
+ private QName portQName;
+ private String configName;
+ private String configFile;
+ private List<NameValuePair> stubProperties = new
ArrayList<NameValuePair>();
+
+ public PortInfo(UnifiedServiceRef serviceRef)
+ {
+ this.serviceRef = serviceRef;
+ }
+
+ public UnifiedServiceRef getServiceRef()
+ {
+ return serviceRef;
+ }
+
+ public QName getPortQName()
+ {
+ return portQName;
+ }
+
+ public void setPortQName(QName portName)
+ {
+ this.portQName = portName;
+ }
+
+ public String getServiceEndpointInterface()
+ {
+ return serviceEndpointInterface;
+ }
+
+ public void setServiceEndpointInterface(String serviceEndpointInterface)
+ {
+ this.serviceEndpointInterface = serviceEndpointInterface;
+ }
+
+ public String getConfigFile()
+ {
+ return configFile;
+ }
+
+ public void setConfigFile(String configFile)
+ {
+ this.configFile = configFile;
+ }
+
+ public String getConfigName()
+ {
+ return configName;
+ }
+
+ public void setConfigName(String configName)
+ {
+ this.configName = configName;
+ }
+
+ public List<NameValuePair> getStubProperties()
+ {
+ return stubProperties;
+ }
+}
Property changes on:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/PortInfo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/UnifiedServiceRef.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/UnifiedServiceRef.java 2007-01-19
11:00:41 UTC (rev 2008)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/UnifiedServiceRef.java 2007-01-19
12:13:27 UTC (rev 2009)
@@ -24,7 +24,11 @@
//$Id$
import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.namespace.QName;
+
import org.jboss.ws.core.server.UnifiedVirtualFile;
/**
@@ -35,30 +39,62 @@
*/
public class UnifiedServiceRef implements Serializable
{
- private static final long serialVersionUID = -5518998734737147195L;
+ private static final long serialVersionUID = -6242639118713373752L;
private UnifiedVirtualFile vfsRoot;
private String serviceRefName;
- private String wsdlLocation;
+ private String serviceClassName;
+ private QName serviceQName;
private String configName;
private String configFile;
+ private List<PortInfo> portInfos = new ArrayList<PortInfo>();
+ private String wsdlLocation;
- public UnifiedServiceRef(UnifiedVirtualFile vfsRoot, String name)
+ public UnifiedVirtualFile getRootFile()
{
+ return vfsRoot;
+ }
+
+ public void setRootFile(UnifiedVirtualFile vfsRoot)
+ {
this.vfsRoot = vfsRoot;
+ }
+
+ public String getServiceRefName()
+ {
+ return serviceRefName;
+ }
+
+ public void setServiceRefName(String name)
+ {
this.serviceRefName = name;
}
- public UnifiedVirtualFile getRootFile()
+ public String getServiceClassName()
{
- return vfsRoot;
+ return serviceClassName;
}
- public String getServiceRefName()
+ public void setServiceClassName(String serviceClassName)
{
- return serviceRefName;
+ this.serviceClassName = serviceClassName;
}
+ public QName getServiceQName()
+ {
+ return serviceQName;
+ }
+
+ public void setServiceQName(QName serviceQName)
+ {
+ this.serviceQName = serviceQName;
+ }
+
+ public List<PortInfo> getPortInfos()
+ {
+ return portInfos;
+ }
+
public String getWsdlLocation()
{
return wsdlLocation;
@@ -91,12 +127,9 @@
public String toString()
{
- StringBuilder sb = new StringBuilder();
+ StringBuffer sb = new StringBuffer(100);
sb.append("[");
sb.append("name=").append(serviceRefName);
- sb.append(",config-name=").append(configName);
- sb.append(",config-file=").append(configFile);
- sb.append(",wsdl=").append(wsdlLocation);
sb.append("]");
return sb.toString();
}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java 2007-01-19
11:00:41 UTC (rev 2008)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java 2007-01-19
12:13:27 UTC (rev 2009)
@@ -29,6 +29,9 @@
import org.jboss.ws.core.jaxws.client.ClientImpl;
import org.jboss.ws.core.jaxws.client.ClientProxy;
import org.jboss.ws.core.jaxws.client.DispatchImpl;
+import org.jboss.ws.core.jaxws.client.NameValuePair;
+import org.jboss.ws.core.jaxws.client.PortInfo;
+import org.jboss.ws.core.jaxws.client.UnifiedServiceRef;
import org.jboss.ws.core.jaxws.handler.HandlerResolverImpl;
import org.jboss.ws.metadata.builder.jaxws.JAXWSClientMetaDataBuilder;
import org.jboss.ws.metadata.umdm.ClientEndpointMetaData;
@@ -49,6 +52,7 @@
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -69,7 +73,8 @@
// The executor service
private static ExecutorService defaultExecutor = Executors.newCachedThreadPool();
-
+ // The UnifiedServiceRef association
+ private static ThreadLocal serviceRefAssociation = new ThreadLocal();
// The service meta data that is associated with this JAXWS Service
private ServiceMetaData serviceMetaData;
// The handler resolver
@@ -95,6 +100,11 @@
}
}
+ public static void associateUnifiedServiceRef(UnifiedServiceRef usRef)
+ {
+ serviceRefAssociation.set(usRef);
+ }
+
/**
* The getPort method returns a stub. A service client uses this stub to invoke
operations on the target service endpoint.
* The serviceEndpointInterface specifies the service endpoint interface that is
supported by the created dynamic proxy or stub instance.
@@ -298,6 +308,10 @@
ClientProxy handler = new ClientProxy(executor, new ClientImpl(epMetaData,
handlerResolver));
ClassLoader cl = epMetaData.getClassLoader();
T proxy = (T)Proxy.newProxyInstance(cl, new Class[] { seiClass,
BindingProvider.class, StubExt.class }, handler);
+
+ // Configure the stub
+ configureStub((StubExt)proxy);
+
return proxy;
}
catch (WebServiceException ex)
@@ -309,7 +323,64 @@
throw new WebServiceException("Cannot create proxy", ex);
}
}
+
+ private void configureStub(StubExt stub)
+ {
+ EndpointMetaData epMetaData = stub.getEndpointMetaData();
+ String seiName = epMetaData.getServiceEndpointInterfaceName();
+ QName portName = epMetaData.getPortName();
+ UnifiedServiceRef usRef = (UnifiedServiceRef)serviceRefAssociation.get();
+ if(usRef == null || usRef.getPortInfos().size() == 0)
+ {
+ log.debug("No port configuration for: " + portName);
+ return;
+ }
+
+ String configFile = usRef.getConfigFile();
+ String configName = usRef.getConfigName();
+
+ boolean match = false;
+ for (PortInfo pi : usRef.getPortInfos())
+ {
+ String piSEI = pi.getServiceEndpointInterface();
+ QName piPort = pi.getPortQName();
+ match = (piSEI == null && piPort == null);
+ if (match == false)
+ {
+ if (piSEI != null && piPort != null)
+ match = seiName.equals(piSEI) && portName.equals(piPort);
+ else
+ match = seiName.equals(piSEI) || portName.equals(piPort);
+ }
+ if (match == true)
+ {
+ if (pi.getConfigFile() != null)
+ configFile = pi.getConfigFile();
+ if (pi.getConfigName() != null)
+ configName = pi.getConfigName();
+
+ BindingProvider bp = (BindingProvider)stub;
+ Map<String, Object> reqCtx = bp.getRequestContext();
+ for (NameValuePair nvp : pi.getStubProperties())
+ {
+ log.debug("Set stub property: " + nvp);
+ reqCtx.put(nvp.getName(), nvp.getValue());
+ }
+ break;
+ }
+ }
+
+ if (match == false)
+ log.debug("No matching port configuration for: [portName=" + portName
+ ",seiName=" + seiName + "]");
+
+ log.debug("Configure Stub: [configName=" + configName +
",configFile=" + configFile + "]");
+ if (configFile != null)
+ stub.setConfigFile(configFile);
+ if (configName != null)
+ stub.setConfigName(configName);
+ }
+
@Override
public <T> Dispatch<T> createDispatch(QName portName, Class<T> type,
Mode mode, WebServiceFeature... features)
{
Added:
trunk/jbossws-core/src/main/resources/jboss-jaxws.jar/META-INF/services/javax.xml.ws.spi.Provider
===================================================================
---
trunk/jbossws-core/src/main/resources/jboss-jaxws.jar/META-INF/services/javax.xml.ws.spi.Provider
(rev 0)
+++
trunk/jbossws-core/src/main/resources/jboss-jaxws.jar/META-INF/services/javax.xml.ws.spi.Provider 2007-01-19
12:13:27 UTC (rev 2009)
@@ -0,0 +1 @@
+org.jboss.ws.core.jaxws.spi.ProviderImpl
\ No newline at end of file
Modified: trunk/jbossws-tests/.classpath
===================================================================
--- trunk/jbossws-tests/.classpath 2007-01-19 11:00:41 UTC (rev 2008)
+++ trunk/jbossws-tests/.classpath 2007-01-19 12:13:27 UTC (rev 2009)
@@ -28,8 +28,6 @@
<classpathentry kind="lib"
path="/build/thirdparty/jboss-xml-binding.jar"/>
<classpathentry kind="lib"
path="/build/thirdparty/wsdl4j.jar"/>
<classpathentry kind="lib"
path="/build/thirdparty/xmlsec.jar"/>
- <classpathentry kind="lib"
path="/build/thirdparty/ejb3.deployer/jboss-annotations-ejb3.jar"/>
- <classpathentry kind="lib"
path="/build/thirdparty/ejb3.deployer/jboss-ejb3x.jar"/>
<classpathentry kind="lib"
path="/build/thirdparty/jaxb-xjc.jar"/>
<classpathentry kind="lib"
path="/build/thirdparty/jboss-dependency.jar"/>
<classpathentry kind="lib"
path="/build/thirdparty/jboss-microcontainer.jar"/>
Modified: trunk/jbossws-tests/ant-import/build-jars-jaxws.xml
===================================================================
--- trunk/jbossws-tests/ant-import/build-jars-jaxws.xml 2007-01-19 11:00:41 UTC (rev
2008)
+++ trunk/jbossws-tests/ant-import/build-jars-jaxws.xml 2007-01-19 12:13:27 UTC (rev
2009)
@@ -20,6 +20,16 @@
<mkdir dir="${tests.output.dir}/libs"/>
+ <!-- jaxws-anonymous -->
+ <war warfile="${tests.output.dir}/libs/jaxws-anonymous.war"
webxml="${tests.output.dir}/resources/jaxws/anonymous/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/classes">
+ <include
name="org/jboss/test/ws/jaxws/anonymous/Anonymous.class"/>
+ <include
name="org/jboss/test/ws/jaxws/anonymous/AnonymousRequest.class"/>
+ <include
name="org/jboss/test/ws/jaxws/anonymous/AnonymousResponse.class"/>
+ <include
name="org/jboss/test/ws/jaxws/anonymous/AnonymousImpl.class"/>
+ </classes>
+ </war>
+
<!-- jaxws-asynchronous -->
<war warfile="${tests.output.dir}/libs/jaxws-asynchronous.war"
webxml="${tests.output.dir}/resources/jaxws/asynchronous/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/classes">
@@ -98,6 +108,15 @@
</webinf>
</war>
+ <!-- jaxws-exception -->
+ <war warfile="${tests.output.dir}/libs/jaxws-exception.war"
webxml="${tests.output.dir}/resources/jaxws/exception/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/classes">
+ <include
name="org/jboss/test/ws/jaxws/exception/ExceptionEndpoint.class"/>
+ <include
name="org/jboss/test/ws/jaxws/exception/ExceptionEndpointImpl.class"/>
+ <include
name="org/jboss/test/ws/jaxws/exception/UserException.class"/>
+ </classes>
+ </war>
+
<!-- jaxws-handlerscope -->
<war warfile="${tests.output.dir}/libs/jaxws-handlerscope.war"
webxml="${tests.output.dir}/resources/jaxws/handlerscope/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/classes">
@@ -503,28 +522,21 @@
</metainf>
</jar>
- <!-- jaxws-xop-doclit -->
- <jar jarfile="${tests.output.dir}/libs/jaxws-xop-doclit.jar">
- <fileset dir="${tests.output.dir}/classes">
- <include name="org/jboss/test/ws/jaxws/xop/doclit/**/*.class"/>
- </fileset>
- <!--metainf
dir="${tests.output.dir}/resources/jaxws/xop/doclit/META-INF">
- <include name="wsdl/*"/>
- <include name="jaxws-handler.xml"/>
- </metainf-->
- </jar>
- <jar jarfile="${tests.output.dir}/libs/jaxws-xop-doclit-client.jar">
- <fileset dir="${tests.output.dir}/classes">
- <include name="org/jboss/test/ws/jaxws/xop/doclit/**/*.class"/>
- <exclude
name="org/jboss/test/ws/jaxws/xop/doclit/**/*Bean.class"/>
- </fileset>
- <!--metainf
dir="${tests.output.dir}/resources/jaxws/xop/doclit/META-INF">
- <include name="application-client.xml"/>
- <include name="jboss-client.xml"/>
- <include name="wsdl/**"/>
- </metainf-->
- </jar>
-
+ <!-- jaxws-samples-wseventing.war -->
+ <war warfile="${tests.output.dir}/libs/jaxws-samples-wseventing.war"
+
webxml="${tests.output.dir}/resources/jaxws/samples/wseventing/WEB-INF/web.xml">
+ <classes dir="${tests.output.dir}/classes">
+ <include
name="org/jboss/test/ws/jaxws/samples/wseventing/*.class"/>
+ </classes>
+ <webinf
dir="${tests.output.dir}/resources/jaxws/samples/wseventing/WEB-INF">
+ <include name="wsdl/jboss-web.xml"/>
+ <include name="wsdl/sysmon.wsdl"/>
+ <include name="wsdl/ws-eventing.wsdl"/>
+ <include name="wsdl/ws-eventing.xsd"/>
+ <include name="wsdl/ws-addr.xsd"/>
+ </webinf>
+ </war>
+
<!-- jaxws-webserviceref -->
<war warfile="${tests.output.dir}/libs/jaxws-webserviceref.war"
webxml="${tests.output.dir}/resources/jaxws/webserviceref/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/classes">
@@ -599,6 +611,7 @@
<include
name="org/jboss/test/ws/jaxws/webserviceref/TestEndpoint.class"/>
</fileset>
<metainf
dir="${tests.output.dir}/resources/jaxws/webserviceref/META-INF-override">
+ <include name="jbossws-client-config.xml"/>
<include name="application-client.xml"/>
<include name="jboss-client.xml"/>
</metainf>
@@ -619,25 +632,6 @@
</classes>
</war>
- <!-- jaxws-anonymous -->
- <war warfile="${tests.output.dir}/libs/jaxws-anonymous.war"
webxml="${tests.output.dir}/resources/jaxws/anonymous/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/classes">
- <include
name="org/jboss/test/ws/jaxws/anonymous/Anonymous.class"/>
- <include
name="org/jboss/test/ws/jaxws/anonymous/AnonymousRequest.class"/>
- <include
name="org/jboss/test/ws/jaxws/anonymous/AnonymousResponse.class"/>
- <include
name="org/jboss/test/ws/jaxws/anonymous/AnonymousImpl.class"/>
- </classes>
- </war>
-
- <!-- jaxws-exception -->
- <war warfile="${tests.output.dir}/libs/jaxws-exception.war"
webxml="${tests.output.dir}/resources/jaxws/exception/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/classes">
- <include
name="org/jboss/test/ws/jaxws/exception/ExceptionEndpoint.class"/>
- <include
name="org/jboss/test/ws/jaxws/exception/ExceptionEndpointImpl.class"/>
- <include
name="org/jboss/test/ws/jaxws/exception/UserException.class"/>
- </classes>
- </war>
-
<!-- jaxws-wsaddressing-action -->
<war
warfile="${tests.output.dir}/libs/jaxws-wsaddressing-action-rpc.war"
webxml="${tests.output.dir}/resources/jaxws/wsaddressing/action/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/classes">
@@ -712,10 +706,7 @@
</classes>
</war>
- <!-- Please add alphabetically -->
-
-
- <!-- jaxws-wseventing -->
+ <!-- jaxws-wseventing -->
<war warfile="${tests.output.dir}/libs/jaxws-wseventing.war"
webxml="${tests.output.dir}/resources/jaxws/wseventing/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/classes">
@@ -726,22 +717,31 @@
<include name="wsdl/**"/>
</webinf>
</war>
-
- <!-- jaxws-samples-wseventing.war -->
- <war warfile="${tests.output.dir}/libs/jaxws-samples-wseventing.war"
-
webxml="${tests.output.dir}/resources/jaxws/samples/wseventing/WEB-INF/web.xml">
- <classes dir="${tests.output.dir}/classes">
- <include
name="org/jboss/test/ws/jaxws/samples/wseventing/*.class"/>
- </classes>
- <webinf
dir="${tests.output.dir}/resources/jaxws/samples/wseventing/WEB-INF">
- <include name="wsdl/jboss-web.xml"/>
- <include name="wsdl/sysmon.wsdl"/>
- <include name="wsdl/ws-eventing.wsdl"/>
- <include name="wsdl/ws-eventing.xsd"/>
- <include name="wsdl/ws-addr.xsd"/>
- </webinf>
- </war>
-
+
+ <!-- jaxws-xop-doclit -->
+ <jar jarfile="${tests.output.dir}/libs/jaxws-xop-doclit.jar">
+ <fileset dir="${tests.output.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/xop/doclit/**/*.class"/>
+ </fileset>
+ <!--metainf
dir="${tests.output.dir}/resources/jaxws/xop/doclit/META-INF">
+ <include name="wsdl/*"/>
+ <include name="jaxws-handler.xml"/>
+ </metainf-->
+ </jar>
+ <jar jarfile="${tests.output.dir}/libs/jaxws-xop-doclit-client.jar">
+ <fileset dir="${tests.output.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/xop/doclit/**/*.class"/>
+ <exclude
name="org/jboss/test/ws/jaxws/xop/doclit/**/*Bean.class"/>
+ </fileset>
+ <!--metainf
dir="${tests.output.dir}/resources/jaxws/xop/doclit/META-INF">
+ <include name="application-client.xml"/>
+ <include name="jboss-client.xml"/>
+ <include name="wsdl/**"/>
+ </metainf-->
+ </jar>
+
+ <!-- Please add alphabetically -->
+
</target>
</project>
Modified:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/StubPropertyTestCase.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/StubPropertyTestCase.java 2007-01-19
11:00:41 UTC (rev 2008)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/StubPropertyTestCase.java 2007-01-19
12:13:27 UTC (rev 2009)
@@ -21,7 +21,6 @@
*/
package org.jboss.test.ws.jaxws.webserviceref;
-import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
@@ -32,7 +31,6 @@
import junit.framework.Test;
import org.jboss.ejb3.client.ClientLauncher;
-import org.jboss.ejb3.metamodel.JBossClientDDObjectFactory;
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
@@ -67,7 +65,7 @@
QName qname = new QName("http://org.jboss.ws/wsref",
"SecureEndpointService");
Service service = Service.create(wsdlURL, qname);
SecureEndpoint port = (SecureEndpoint)service.getPort(SecureEndpoint.class);
-
+
BindingProvider bindingProvider = (BindingProvider)port;
bindingProvider.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,
"kermit");
bindingProvider.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
"thefrog");
@@ -80,7 +78,14 @@
public void testUnconfiguredStub() throws Throwable
{
String reqMsg = "Hello World";
- new ClientLauncher().launch(SecureEndpointClient.class.getName(),
"jbossws-client", new String[]{reqMsg, "kermit",
"thefrog"});
+ new ClientLauncher().launch(SecureEndpointClient.class.getName(),
"jbossws-client", new String[] { reqMsg, "kermit", "thefrog"
});
assertEquals("Hello World|Hello World|Hello World",
SecureEndpointClient.retStr);
}
+
+ public void testConfiguredStub() throws Throwable
+ {
+ String reqMsg = "Hello World";
+ new ClientLauncher().launch(SecureEndpointClient.class.getName(),
"jbossws-client", new String[] { reqMsg });
+ assertEquals("Hello World|Hello World|Hello World",
SecureEndpointClient.retStr);
+ }
}
Modified:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/TestEndpointClientTwo.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/TestEndpointClientTwo.java 2007-01-19
11:00:41 UTC (rev 2008)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/webserviceref/TestEndpointClientTwo.java 2007-01-19
12:13:27 UTC (rev 2009)
@@ -21,21 +21,29 @@
*/
package org.jboss.test.ws.jaxws.webserviceref;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import javax.naming.InitialContext;
+import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
import javax.xml.ws.WebServiceRef;
import javax.xml.ws.WebServiceRefs;
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.ConfigProvider;
+
//Test on type
@WebServiceRef(name = "Service1")
// Test multiple on type
@WebServiceRefs( { @WebServiceRef(name = "Service2"), @WebServiceRef(name =
"Port1", type = TestEndpoint.class) })
public class TestEndpointClientTwo
{
+ // provide logging
+ private static final Logger log = Logger.getLogger(TestEndpointClientTwo.class);
+
// Test on field
@WebServiceRef(name = "Service3")
public static Service service3;
@@ -65,73 +73,136 @@
String retStr = (String)method.invoke(client, testName);
testResult.put(testName, retStr);
}
+ catch (InvocationTargetException ex)
+ {
+ log.error("Invocation error", ex);
+ testResult.put(testName, ex.getTargetException().toString());
+ }
catch (Exception ex)
{
+ log.error("Error", ex);
testResult.put(testName, ex.toString());
}
}
+ /**
+ * Customize service-class-name, service-qname
+ */
public String testService1(String reqStr) throws Exception
{
- Service service = (Service)iniCtx.lookup("java:comp/env/Service1");
- TestEndpoint port = service.getPort(TestEndpoint.class);
+ TestEndpointService service =
(TestEndpointService)iniCtx.lookup("java:comp/env/Service1");
+ TestEndpoint port = service.getTestEndpointPort();
return port.echo(reqStr);
}
+ /**
+ * Customize config-name, config-file
+ */
public String testService2(String reqStr) throws Exception
{
Service service = (Service)iniCtx.lookup("java:comp/env/Service2");
+ verifyConfig((ConfigProvider)service);
+
TestEndpoint port = service.getPort(TestEndpoint.class);
+ verifyConfig((ConfigProvider)port);
+
return port.echo(reqStr);
}
+ /**
+ * Customize service-class-name, service-qname
+ */
public String testService3(String reqStr) throws Exception
{
- TestEndpoint port = service3.getPort(TestEndpoint.class);
+ TestEndpoint port = ((TestEndpointService)service3).getTestEndpointPort();
String resStr1 = port.echo(reqStr);
- Service service = (Service)iniCtx.lookup("java:comp/env/Service3");
- port = service.getPort(TestEndpoint.class);
+ TestEndpointService service =
(TestEndpointService)iniCtx.lookup("java:comp/env/Service3");
+ port = service.getTestEndpointPort();
+
String resStr2 = port.echo(reqStr);
return resStr1 + resStr2;
}
+ /**
+ * Customize config-name, config-file
+ */
public String testService4(String reqStr) throws Exception
{
- TestEndpoint port = service4.getPort(TestEndpoint.class);
+ TestEndpoint port = service4.getTestEndpointPort();
String resStr1 = port.echo(reqStr);
+ verifyConfig((ConfigProvider)port);
- Service service = (Service)iniCtx.lookup("java:comp/env/Service4");
- port = service.getPort(TestEndpoint.class);
+ TestEndpointService service =
(TestEndpointService)iniCtx.lookup("java:comp/env/Service4");
+ port = service.getTestEndpointPort();
+ verifyConfig((ConfigProvider)port);
+
String resStr2 = port.echo(reqStr);
return resStr1 + resStr2;
}
+ /**
+ * Customize port-info: port-qname, config-name, config-file
+ */
public String testPort1(String reqStr) throws Exception
{
TestEndpoint port = (TestEndpoint)iniCtx.lookup("java:comp/env/Port1");
+ verifyConfig((ConfigProvider)port);
+
return port.echo(reqStr);
}
+ /**
+ * Customize port-info: service-endpoint-interface, config-name, config-file
+ */
public String testPort2(String reqStr) throws Exception
{
+ verifyConfig((ConfigProvider)port2);
String resStr1 = port2.echo(reqStr);
TestEndpoint port = (TestEndpoint)iniCtx.lookup("java:comp/env/Port2");
+ verifyConfig((ConfigProvider)port);
+
String resStr2 = port.echo(reqStr);
return resStr1 + resStr2;
}
+ /**
+ * Customize port-info: service-endpoint-interface, port-qname, stub-property
+ */
public String testPort3(String reqStr) throws Exception
{
String resStr1 = port3.echo(reqStr);
+
+ BindingProvider bp = (BindingProvider)port3;
+ verifyProperties(bp.getRequestContext());
TestEndpoint port = (TestEndpoint)iniCtx.lookup("java:comp/env/Port3");
String resStr2 = port.echo(reqStr);
return resStr1 + resStr2;
}
+
+ private void verifyProperties(Map<String, Object> ctx)
+ {
+ String username = (String)ctx.get(BindingProvider.USERNAME_PROPERTY);
+ if ("kermit".equals(username) == false)
+ throw new RuntimeException("Invalid username: " + username);
+
+ String password = (String)ctx.get(BindingProvider.PASSWORD_PROPERTY);
+ if ("thefrog".equals(password) == false)
+ throw new RuntimeException("Invalid password: " + password);
+ }
+
+ private void verifyConfig(ConfigProvider cp)
+ {
+ if ("Custom Client".equals(cp.getConfigName()) == false)
+ throw new RuntimeException("Invalid config name: " +
cp.getConfigName());
+
+ if ("META-INF/jbossws-client-config.xml".equals(cp.getConfigFile()) ==
false)
+ throw new RuntimeException("Invalid config file: " +
cp.getConfigFile());
+ }
}
Modified:
trunk/jbossws-tests/src/main/resources/jaxws/webserviceref/META-INF-override/jboss-client.xml
===================================================================
---
trunk/jbossws-tests/src/main/resources/jaxws/webserviceref/META-INF-override/jboss-client.xml 2007-01-19
11:00:41 UTC (rev 2008)
+++
trunk/jbossws-tests/src/main/resources/jaxws/webserviceref/META-INF-override/jboss-client.xml 2007-01-19
12:13:27 UTC (rev 2009)
@@ -11,6 +11,8 @@
-->
<service-ref>
<service-ref-name>Service1</service-ref-name>
+
<service-class-name>org.jboss.test.ws.jaxws.webserviceref.TestEndpointService</service-class-name>
+ <service-qname
xmlns:nss="http://org.jboss.ws/wsref">nss:TestEndpointService</service-qname>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -19,6 +21,8 @@
-->
<service-ref>
<service-ref-name>Service2</service-ref-name>
+ <config-name>Custom Client</config-name>
+ <config-file>META-INF/jbossws-client-config.xml</config-file>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -27,6 +31,8 @@
-->
<service-ref>
<service-ref-name>Service3</service-ref-name>
+
<service-class-name>org.jboss.test.ws.jaxws.webserviceref.TestEndpointService</service-class-name>
+ <service-qname
xmlns:nss="http://org.jboss.ws/wsref">nss:TestEndpointService</service-qname>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -35,6 +41,11 @@
-->
<service-ref>
<service-ref-name>Service4</service-ref-name>
+ <port-info>
+
<service-endpoint-interface>org.jboss.test.ws.jaxws.webserviceref.TestEndpoint</service-endpoint-interface>
+ <config-name>Custom Client</config-name>
+ <config-file>META-INF/jbossws-client-config.xml</config-file>
+ </port-info>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -43,6 +54,11 @@
-->
<service-ref>
<service-ref-name>Port1</service-ref-name>
+ <port-info>
+ <port-qname
xmlns:nsp='http://org.jboss.ws/wsref'>nsp:TestEndpointPort</port-qname>
+ <config-name>Custom Client</config-name>
+ <config-file>META-INF/jbossws-client-config.xml</config-file>
+ </port-info>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -51,6 +67,11 @@
-->
<service-ref>
<service-ref-name>Port2</service-ref-name>
+ <port-info>
+
<service-endpoint-interface>org.jboss.test.ws.jaxws.webserviceref.TestEndpoint</service-endpoint-interface>
+ <config-name>Custom Client</config-name>
+ <config-file>META-INF/jbossws-client-config.xml</config-file>
+ </port-info>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
@@ -59,6 +80,18 @@
-->
<service-ref>
<service-ref-name>Port3</service-ref-name>
+ <port-info>
+
<service-endpoint-interface>org.jboss.test.ws.jaxws.webserviceref.TestEndpoint</service-endpoint-interface>
+ <port-qname
xmlns:nsp='http://org.jboss.ws/wsref'>nsp:TestEndpointPort</port-qname>
+ <stub-property>
+ <name>javax.xml.ws.security.auth.username</name>
+ <value>kermit</value>
+ </stub-property>
+ <stub-property>
+ <name>javax.xml.ws.security.auth.password</name>
+ <value>thefrog</value>
+ </stub-property>
+ </port-info>
<wsdl-override>META-INF/wsdl/TestEndpoint.wsdl</wsdl-override>
</service-ref>
Added:
trunk/jbossws-tests/src/main/resources/jaxws/webserviceref/META-INF-override/jbossws-client-config.xml
===================================================================
---
trunk/jbossws-tests/src/main/resources/jaxws/webserviceref/META-INF-override/jbossws-client-config.xml
(rev 0)
+++
trunk/jbossws-tests/src/main/resources/jaxws/webserviceref/META-INF-override/jbossws-client-config.xml 2007-01-19
12:13:27 UTC (rev 2009)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Id$ -->
+
+<jaxrpc-config xmlns="urn:jboss:jaxrpc-config:2.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
+ xsi:schemaLocation="urn:jboss:jaxrpc-config:2.0 jaxrpc-config_2_0.xsd">
+
+ <client-config>
+ <config-name>Custom Client</config-name>
+ </client-config>
+
+</jaxrpc-config>
\ No newline at end of file
Property changes on:
trunk/jbossws-tests/src/main/resources/jaxws/webserviceref/META-INF-override/jbossws-client-config.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
trunk/jbossws-tests/src/main/resources/jaxws/webserviceref/META-INF-secure/jboss-client.xml
===================================================================
---
trunk/jbossws-tests/src/main/resources/jaxws/webserviceref/META-INF-secure/jboss-client.xml 2007-01-19
11:00:41 UTC (rev 2008)
+++
trunk/jbossws-tests/src/main/resources/jaxws/webserviceref/META-INF-secure/jboss-client.xml 2007-01-19
12:13:27 UTC (rev 2009)
@@ -13,12 +13,12 @@
<service-endpoint-interface>org.jboss.test.ws.jaxws.webserviceref.SecureEndpoint</service-endpoint-interface>
<port-qname
xmlns:nsp='http://org.jboss.ws/wsref'>nsp:SecureEndpointPort</port-qname>
<stub-property>
- <name>javax.xml.ws.security.auth.password</name>
- <value>j2ee</value>
+ <name>javax.xml.ws.security.auth.username</name>
+ <value>kermit</value>
</stub-property>
<stub-property>
- <name>javax.xml.ws.security.auth.username</name>
- <value>j2ee</value>
+ <name>javax.xml.ws.security.auth.password</name>
+ <value>thefrog</value>
</stub-property>
</port-info>
<wsdl-override>http://@jbosstest.host.name@:8080/jaxws-webserviceref-secure/SecureEndpoint?wsdl</wsdl-override>
@@ -29,12 +29,12 @@
<port-info>
<port-qname
xmlns:nsp='http://org.jboss.ws/wsref'>nsp:SecureEndpointPort</port-qname>
<stub-property>
- <name>javax.xml.ws.security.auth.password</name>
- <value>j2ee</value>
+ <name>javax.xml.ws.security.auth.username</name>
+ <value>kermit</value>
</stub-property>
<stub-property>
- <name>javax.xml.ws.security.auth.username</name>
- <value>j2ee</value>
+ <name>javax.xml.ws.security.auth.password</name>
+ <value>thefrog</value>
</stub-property>
</port-info>
<wsdl-override>http://@jbosstest.host.name@:8080/jaxws-webserviceref-secure/SecureEndpoint?wsdl</wsdl-override>
@@ -45,12 +45,12 @@
<port-info>
<service-endpoint-interface>org.jboss.test.ws.jaxws.webserviceref.SecureEndpoint</service-endpoint-interface>
<stub-property>
- <name>javax.xml.ws.security.auth.password</name>
- <value>j2ee</value>
+ <name>javax.xml.ws.security.auth.username</name>
+ <value>kermit</value>
</stub-property>
<stub-property>
- <name>javax.xml.ws.security.auth.username</name>
- <value>j2ee</value>
+ <name>javax.xml.ws.security.auth.password</name>
+ <value>thefrog</value>
</stub-property>
</port-info>
<wsdl-override>http://@jbosstest.host.name@:8080/jaxws-webserviceref-secure/SecureEndpoint?wsdl</wsdl-override>