Author: thomas.diesler(a)jboss.com
Date: 2006-11-22 10:29:15 -0500 (Wed, 22 Nov 2006)
New Revision: 1502
Removed:
trunk/src/main/java/org/jboss/ws/jaxrpc/MetaDataSynchronization.java
trunk/src/test/resources/jaxrpc/samples-override/handler/WEB-INF/wsdl/
Modified:
trunk/src/main/java/org/jboss/ws/common/CommonSOAPBinding.java
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceRefMetaDataAdaptor.java
trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceImpl.java
trunk/src/main/java/org/jboss/ws/jaxws/spi/ServiceDelegateImpl.java
trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java
trunk/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java
trunk/src/main/resources/schema/jaxrpc-config_2_0.xsd
trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/handler/ClientSideHandler.java
trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/handler/ServerSideHandler.java
trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefClientTestCase.java
trunk/src/test/resources/jaxrpc/samples-override/handler/WEB-INF/webservices.xml
trunk/src/test/resources/jaxrpc/samples/handler/META-INF/application-client.xml
trunk/src/test/resources/jaxrpc/samples/handler/wstools-config.xml
Log:
Fix handler init params
Disable MTOM for rpc/encoded
Fix CTS expected ServiceException on unsynchronized sei
Modified: trunk/src/main/java/org/jboss/ws/common/CommonSOAPBinding.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/common/CommonSOAPBinding.java 2006-11-22 13:27:13 UTC
(rev 1501)
+++ trunk/src/main/java/org/jboss/ws/common/CommonSOAPBinding.java 2006-11-22 15:29:15 UTC
(rev 1502)
@@ -52,7 +52,9 @@
import org.jboss.ws.binding.EndpointInvocation;
import org.jboss.ws.binding.UnboundHeader;
import org.jboss.ws.jaxrpc.ParameterWrapping;
+import org.jboss.ws.jaxrpc.StubExt;
import org.jboss.ws.jaxrpc.Style;
+import org.jboss.ws.jaxrpc.Use;
import org.jboss.ws.metadata.OperationMetaData;
import org.jboss.ws.metadata.ParameterMetaData;
import org.jboss.ws.metadata.TypesMetaData;
@@ -134,6 +136,10 @@
if (msgContext == null)
throw new WSException("MessageContext not available");
+ // Disable MTOM for rpc/encoded
+ if (opMetaData.isRPCEncoded())
+ msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
+
// Associate current message with message context
SOAPMessageImpl reqMessage = (SOAPMessageImpl)createMessage(opMetaData);
msgContext.setSOAPMessage(reqMessage);
@@ -262,6 +268,10 @@
if (msgContext == null)
throw new WSException("MessageContext not available");
+ // Disable MTOM for rpc/encoded
+ if (opMetaData.isRPCEncoded())
+ msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
+
// Get the namespace registry
NamespaceRegistry namespaceRegistry = msgContext.getNamespaceRegistry();
@@ -374,6 +384,10 @@
if (msgContext == null)
throw new WSException("MessageContext not available");
+ // Disable MTOM for rpc/encoded
+ if (opMetaData.isRPCEncoded())
+ msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
+
// Associate current message with message context
SOAPMessageImpl resMessage = (SOAPMessageImpl)createMessage(opMetaData);
msgContext.setSOAPMessage(resMessage);
@@ -526,6 +540,10 @@
if (msgContext == null)
throw new WSException("MessageContext not available");
+ // Disable MTOM for rpc/encoded
+ if (opMetaData.isRPCEncoded())
+ msgContext.setProperty(StubExt.PROPERTY_MTOM_ENABLED, Boolean.FALSE);
+
SOAPHeader soapHeader = soapEnvelope.getHeader();
SOAPBody soapBody = soapEnvelope.getBody();
Iterator bodyChildren = soapBody.getChildElements();
Modified:
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceRefMetaDataAdaptor.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceRefMetaDataAdaptor.java 2006-11-22
13:27:13 UTC (rev 1501)
+++
trunk/src/main/java/org/jboss/ws/integration/jboss50/ServiceRefMetaDataAdaptor.java 2006-11-22
15:29:15 UTC (rev 1502)
@@ -27,6 +27,8 @@
import java.util.Arrays;
import java.util.LinkedHashMap;
+import javax.xml.namespace.QName;
+
import org.jboss.webservice.metadata.serviceref.HandlerMetaData;
import org.jboss.webservice.metadata.serviceref.InitParamMetaData;
import org.jboss.webservice.metadata.serviceref.PortComponentRefMetaData;
@@ -70,8 +72,10 @@
UnifiedHandlerMetaData uhmd = new UnifiedHandlerMetaData(null);
uhmd.setHandlerName(hmd.getHandlerName());
uhmd.setHandlerClass(hmd.getHandlerClass());
- Arrays.asList(hmd.getSoapHeaders());
-
+ for(QName soapHeader : hmd.getSoapHeaders())
+ {
+ uhmd.addSoapHeader(soapHeader);
+ }
for(String portname : hmd.getPortNames())
{
uhmd.addPortName(portname);
Deleted: trunk/src/main/java/org/jboss/ws/jaxrpc/MetaDataSynchronization.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/MetaDataSynchronization.java 2006-11-22
13:27:13 UTC (rev 1501)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/MetaDataSynchronization.java 2006-11-22
15:29:15 UTC (rev 1502)
@@ -1,69 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-// $Id$
-package org.jboss.ws.jaxrpc;
-
-import java.lang.reflect.Method;
-
-import javax.xml.rpc.ServiceException;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.Constants;
-
-/** A helper that synchronizes the SEI with the endpoint meta data
- *
- * @author Thomas.Diesler(a)jboss.org
- * @author <a href="mailto:jason.greene@jboss.com">Jason T.
Greene</a>
- * @since 19-May-2005
- */
-public class MetaDataSynchronization
-{
- // provide logging
- private static final Logger log = Logger.getLogger(MetaDataSynchronization.class);
-
- public static void synchronizeServiceEndpointInterface(EndpointMetaData epMetaData,
Class seiClass) throws ServiceException
- {
- log.debug("synchronize: [epMetaData=" + epMetaData.getQName() +
",sei=" + seiClass.getName() + "]");
-
- if (epMetaData.getServiceEndpointInterface() != seiClass)
- throw new IllegalArgumentException("Endpoint meta data SEI missmatch,
expected: " + epMetaData.getServiceEndpointInterfaceName());
-
- /*
- Method[] methods = seiClass.getMethods();
- for (int i = 0; i < methods.length; i++)
- {
- Method method = methods[i];
-
- if(method.getName().endsWith(Constants.ASYNC_METHOD_SUFFIX))
- continue;
-
- log.debug("synchronize method: " + method);
-
- OperationMetaData opMetaData = epMetaData.getOperation(method);
- if (opMetaData == null)
- throw new ServiceException("Cannot obtain operation meta data for
method: " + method);
- }
- */
- }
-}
Modified: trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceImpl.java 2006-11-22 13:27:13 UTC (rev
1501)
+++ trunk/src/main/java/org/jboss/ws/jaxrpc/ServiceImpl.java 2006-11-22 15:29:15 UTC (rev
1502)
@@ -312,17 +312,28 @@
if (serviceMetaData == null)
throw new ServiceException("Service meta data not available");
- EndpointMetaData epMetaData =
serviceMetaData.getEndpointByServiceEndpointInterface(seiName);
- if (epMetaData == null && serviceMetaData.getEndpoints().size() == 1)
+ try
{
- epMetaData = serviceMetaData.getEndpoints().get(0);
- epMetaData.setServiceEndpointInterfaceName(seiName);
- }
+ EndpointMetaData epMetaData =
serviceMetaData.getEndpointByServiceEndpointInterface(seiName);
+ if (epMetaData == null && serviceMetaData.getEndpoints().size() == 1)
+ {
+ epMetaData = serviceMetaData.getEndpoints().get(0);
+ epMetaData.setServiceEndpointInterfaceName(seiName);
+ }
- if (epMetaData == null)
- throw new ServiceException("Cannot find endpoint meta data for: " +
seiName);
+ if (epMetaData == null)
+ throw new ServiceException("Cannot find endpoint meta data for: " +
seiName);
- return createProxy(seiClass, epMetaData);
+ return createProxy(seiClass, epMetaData);
+ }
+ catch (ServiceException ex)
+ {
+ throw ex;
+ }
+ catch (Exception ex)
+ {
+ throw new ServiceException("Cannot create proxy", ex);
+ }
}
/**
@@ -348,24 +359,12 @@
if (epMetaData == null)
throw new ServiceException("Cannot obtain endpoint meta data for: " +
portName);
- if (epMetaData.getServiceEndpointInterfaceName() == null)
- epMetaData.setServiceEndpointInterfaceName(seiName);
-
- return createProxy(seiClass, epMetaData);
- }
-
- private Remote createProxy(Class seiClass, EndpointMetaData epMetaData) throws
ServiceException
- {
try
{
- MetaDataSynchronization.synchronizeServiceEndpointInterface(epMetaData,
seiClass);
- CallImpl call = new CallImpl(this, epMetaData);
+ if (epMetaData.getServiceEndpointInterfaceName() == null)
+ epMetaData.setServiceEndpointInterfaceName(seiName);
- CallProxy handler = new CallProxy(call);
- ClassLoader cl = epMetaData.getClassLoader();
- Remote proxy = (Remote)Proxy.newProxyInstance(cl, new Class[] { seiClass,
StubExt.class }, handler);
-
- return proxy;
+ return createProxy(seiClass, epMetaData);
}
catch (ServiceException ex)
{
@@ -377,6 +376,17 @@
}
}
+ private Remote createProxy(Class seiClass, EndpointMetaData epMetaData) throws
Exception
+ {
+ CallImpl call = new CallImpl(this, epMetaData);
+
+ CallProxy handler = new CallProxy(call);
+ ClassLoader cl = epMetaData.getClassLoader();
+ Remote proxy = (Remote)Proxy.newProxyInstance(cl, new Class[] { seiClass,
StubExt.class }, handler);
+
+ return proxy;
+ }
+
/**
* Get the handler chain for the given endpoint name, maybe null.
*/
Modified: trunk/src/main/java/org/jboss/ws/jaxws/spi/ServiceDelegateImpl.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/jaxws/spi/ServiceDelegateImpl.java 2006-11-22
13:27:13 UTC (rev 1501)
+++ trunk/src/main/java/org/jboss/ws/jaxws/spi/ServiceDelegateImpl.java 2006-11-22
15:29:15 UTC (rev 1502)
@@ -25,7 +25,6 @@
import java.lang.reflect.Proxy;
import java.net.URL;
-import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -45,10 +44,9 @@
import javax.xml.ws.spi.ServiceDelegate;
import org.jboss.ws.Constants;
-import org.jboss.ws.jaxrpc.MetaDataSynchronization;
import org.jboss.ws.jaxws.client.ClientImpl;
-import org.jboss.ws.jaxws.client.DispatchImpl;
import org.jboss.ws.jaxws.client.ClientProxy;
+import org.jboss.ws.jaxws.client.DispatchImpl;
import org.jboss.ws.jaxws.handler.HandlerResolverImpl;
import org.jboss.ws.metadata.ClientEndpointMetaData;
import org.jboss.ws.metadata.EndpointMetaData;
@@ -273,8 +271,6 @@
{
try
{
- MetaDataSynchronization.synchronizeServiceEndpointInterface(epMetaData,
seiClass);
-
if (handlerResolver instanceof HandlerResolverImpl)
{
HandlerResolverImpl impl = ((HandlerResolverImpl)handlerResolver);
Modified: trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-11-22 13:27:13
UTC (rev 1501)
+++ trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-11-22 15:29:15
UTC (rev 1502)
@@ -197,7 +197,7 @@
{
this.seiName = seiName;
this.seiClass = null;
-
+
UnifiedMetaData wsMetaData = serviceMetaData.getUnifiedMetaData();
if (wsMetaData.isEagerInitialized())
{
@@ -503,6 +503,9 @@
private void initializeInternal()
{
+ // reset sei class
+ seiClass = null;
+
// Initialize handlers
for (HandlerMetaData handler : handlers)
handler.eagerInitialize();
Modified: trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java 2006-11-22 13:27:13 UTC
(rev 1501)
+++ trunk/src/main/java/org/jboss/ws/metadata/HandlerMetaData.java 2006-11-22 15:29:15 UTC
(rev 1502)
@@ -170,7 +170,7 @@
public static class HandlerInitParam implements Serializable
{
private static final long serialVersionUID = -8687875291620457318L;
-
+
// The required <handler-name> element
private String paramName;
// The required <handler-class> element
Modified: trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java 2006-11-22 13:27:13
UTC (rev 1501)
+++ trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java 2006-11-22 15:29:15
UTC (rev 1502)
@@ -141,6 +141,11 @@
return getStyle() == Style.RPC && getUse() == Use.LITERAL;
}
+ public boolean isRPCEncoded()
+ {
+ return getStyle() == Style.RPC && getUse() == Use.ENCODED;
+ }
+
public boolean isDocumentBare()
{
return getStyle() == Style.DOCUMENT && getParameterStyle() ==
ParameterStyle.BARE;
Modified: trunk/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java 2006-11-22 13:27:13
UTC (rev 1501)
+++ trunk/src/main/java/org/jboss/ws/metadata/ParameterMetaData.java 2006-11-22 15:29:15
UTC (rev 1502)
@@ -365,9 +365,10 @@
*/
public void eagerInitialize()
{
- // At some point we want to make this plugable, hardcoding
- // references like this is not very flexible.
- if (opMetaData.isDocumentWrapped())
+ // reset java type
+ javaType = null;
+
+ if (getOperationMetaData().isDocumentWrapped() && isMessageType() ==
false)
{
new DynamicWrapperGenerator(getClassLoader()).generate(this);
Modified: trunk/src/main/resources/schema/jaxrpc-config_2_0.xsd
===================================================================
--- trunk/src/main/resources/schema/jaxrpc-config_2_0.xsd 2006-11-22 13:27:13 UTC (rev
1501)
+++ trunk/src/main/resources/schema/jaxrpc-config_2_0.xsd 2006-11-22 15:29:15 UTC (rev
1502)
@@ -1,78 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
-<xsd:schema
xmlns="http://www.w3.org/2001/XMLSchema"
- targetNamespace="urn:jboss:jaxrpc-config:2.0"
- xmlns:tns="urn:jboss:jaxrpc-config:2.0"
-
xmlns:jbxb="http://www.jboss.org/xml/ns/jbxb"
-
xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
-
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- elementFormDefault="qualified" attributeFormDefault="unqualified"
version="1.1">
-
- <xsd:annotation>
- <xsd:documentation>
- <![CDATA[
+<xsd:schema
xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:jboss:jaxrpc-config:2.0"
xmlns:tns="urn:jboss:jaxrpc-config:2.0"
+
xmlns:jbxb="http://www.jboss.org/xml/ns/jbxb"
xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
+ attributeFormDefault="unqualified" version="1.1">
+
+ <xsd:annotation>
+ <xsd:documentation>
+ <![CDATA[
This is the schema definition for JBossWS configurations JAXRPC.
It relies on the handler definitions that are part of the standard J2EE-1.4
deployment descriptors.
]]>
- </xsd:documentation>
- </xsd:annotation>
-
- <xsd:import
namespace="http://java.sun.com/xml/ns/j2ee"
schemaLocation="j2ee_web_services_1_1.xsd"/>
-
- <xsd:complexType name="jaxrpcConfigType">
- <xsd:annotation>
- <xsd:appinfo>
- <jbxb:class impl="org.jboss.ws.metadata.config.WSConfig"/>
- </xsd:appinfo>
- </xsd:annotation>
- <xsd:choice>
- <xsd:element name="endpoint-config"
type="tns:endpointConfigType" minOccurs="0"
maxOccurs="unbounded"/>
- <xsd:element name="client-config" type="tns:clientConfigType"
minOccurs="0" maxOccurs="unbounded"/>
- </xsd:choice>
- </xsd:complexType>
-
- <xsd:element name="jaxrpc-config"
type="tns:jaxrpcConfigType"/>
-
- <xsd:complexType name="endpointConfigType">
- <xsd:annotation>
- <xsd:appinfo>
- <jbxb:class impl="org.jboss.ws.metadata.config.WSEndpointConfig"/>
- </xsd:appinfo>
- </xsd:annotation>
+ </xsd:documentation>
+ </xsd:annotation>
+
+ <xsd:import
namespace="http://java.sun.com/xml/ns/j2ee"
schemaLocation="j2ee_web_services_1_1.xsd"/>
+
+ <xsd:complexType name="jaxrpcConfigType">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class impl="org.jboss.ws.metadata.config.WSConfig"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+ <xsd:choice>
+ <xsd:element name="endpoint-config"
type="tns:endpointConfigType" minOccurs="0"
maxOccurs="unbounded"/>
+ <xsd:element name="client-config"
type="tns:clientConfigType" minOccurs="0"
maxOccurs="unbounded"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <xsd:element name="jaxrpc-config"
type="tns:jaxrpcConfigType"/>
+
+ <xsd:complexType name="endpointConfigType">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class
impl="org.jboss.ws.metadata.config.WSEndpointConfig"/>
+ </xsd:appinfo>
+ </xsd:annotation>
<xsd:complexContent>
<xsd:extension base="tns:commonConfigType"/>
</xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="clientConfigType">
- <xsd:annotation>
- <xsd:appinfo>
- <jbxb:class impl="org.jboss.ws.metadata.config.WSClientConfig"/>
- </xsd:appinfo>
- </xsd:annotation>
+ </xsd:complexType>
+
+ <xsd:complexType name="clientConfigType">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class impl="org.jboss.ws.metadata.config.WSClientConfig"/>
+ </xsd:appinfo>
+ </xsd:annotation>
<xsd:complexContent>
<xsd:extension base="tns:commonConfigType"/>
</xsd:complexContent>
- </xsd:complexType>
-
- <xsd:complexType name="commonConfigType">
- <xsd:sequence>
- <xsd:element name="config-name" type="xsd:string"/>
- <xsd:element name="pre-handler-chain"
type="tns:handlerChainType" minOccurs="0"/>
- <xsd:element name="post-handler-chain"
type="tns:handlerChainType" minOccurs="0"/>
- </xsd:sequence>
- </xsd:complexType>
-
- <xsd:complexType name="handlerChainType">
- <xsd:annotation>
- <xsd:appinfo>
- <jbxb:class
impl="org.jboss.ws.metadata.config.WSHandlerChainConfig"/>
- </xsd:appinfo>
- </xsd:annotation>
- <xsd:sequence>
- <xsd:element name="handler-chain-name" type="xsd:string"/>
- <xsd:element name="handler"
type="j2ee:port-component_handlerType" minOccurs="0"
maxOccurs="unbounded"/>
- </xsd:sequence>
- </xsd:complexType>
-
+ </xsd:complexType>
+
+ <xsd:complexType name="commonConfigType">
+ <xsd:sequence>
+ <xsd:element name="config-name" type="xsd:string"/>
+ <xsd:element name="pre-handler-chain"
type="tns:handlerChainType" minOccurs="0"/>
+ <xsd:element name="post-handler-chain"
type="tns:handlerChainType" minOccurs="0"/>
+ <xsd:element name="property" type="tns:propertyType"
minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="handlerChainType">
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class
impl="org.jboss.ws.metadata.config.WSHandlerChainConfig"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+ <xsd:sequence>
+ <xsd:element name="handler-chain-name"
type="xsd:string"/>
+ <xsd:element name="handler"
type="j2ee:port-component_handlerType" minOccurs="0"
maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="propertyType">
+ <xsd:sequence>
+ <xsd:element name="property-name" type="xsd:string"/>
+ <xsd:element name="property-value" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
</xsd:schema>
\ No newline at end of file
Modified:
trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/handler/ClientSideHandler.java
===================================================================
---
trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/handler/ClientSideHandler.java 2006-11-22
13:27:13 UTC (rev 1501)
+++
trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/handler/ClientSideHandler.java 2006-11-22
15:29:15 UTC (rev 1502)
@@ -24,6 +24,7 @@
import javax.xml.namespace.QName;
import javax.xml.rpc.JAXRPCException;
import javax.xml.rpc.handler.GenericHandler;
+import javax.xml.rpc.handler.HandlerInfo;
import javax.xml.rpc.handler.MessageContext;
import javax.xml.rpc.handler.soap.SOAPMessageContext;
import javax.xml.soap.SOAPBody;
@@ -35,28 +36,36 @@
import org.jboss.logging.Logger;
+import sun.reflect.ReflectionFactory.GetReflectionFactoryAction;
+
public class ClientSideHandler extends GenericHandler
{
// Provide logging
private static Logger log = Logger.getLogger(ClientSideHandler.class);
- protected QName[] headers = new QName[]{
- new QName("http://somens", "InHeader"),
- new QName("http://somens", "OutHeader"),
- new QName("http://somens", "InOutHeader")
- };
+ protected QName[] headers;
public QName[] getHeaders()
{
return headers;
}
+ public void init(HandlerInfo info)
+ {
+ log.info("init: " + info);
+ headers = info.getHeaders();
+ }
+
public boolean handleRequest(MessageContext msgContext)
{
log.info("handleRequest");
+ QName[] headers = getHeaders();
+ if (headers == null || headers.length != 3)
+ throw new IllegalStateException("Invalid number of headers");
+
try
- {
+ {
SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
SOAPHeader soapHeader = soapMessage.getSOAPHeader();
Modified:
trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/handler/ServerSideHandler.java
===================================================================
---
trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/handler/ServerSideHandler.java 2006-11-22
13:27:13 UTC (rev 1501)
+++
trunk/src/test/java/org/jboss/test/ws/jaxrpc/samples/handler/ServerSideHandler.java 2006-11-22
15:29:15 UTC (rev 1502)
@@ -24,6 +24,7 @@
import javax.xml.namespace.QName;
import javax.xml.rpc.JAXRPCException;
import javax.xml.rpc.handler.GenericHandler;
+import javax.xml.rpc.handler.HandlerInfo;
import javax.xml.rpc.handler.MessageContext;
import javax.xml.rpc.handler.soap.SOAPMessageContext;
import javax.xml.soap.Name;
@@ -42,21 +43,27 @@
// Provide logging
private static Logger log = Logger.getLogger(ServerSideHandler.class);
- protected QName[] headers = new QName[]{
- new QName("http://somens", "InHeader"),
- new QName("http://somens", "OutHeader"),
- new QName("http://somens", "InOutHeader")
- };
+ protected QName[] headers;
public QName[] getHeaders()
{
return headers;
}
+ public void init(HandlerInfo info)
+ {
+ log.info("init: " + info);
+ headers = info.getHeaders();
+ }
+
public boolean handleRequest(MessageContext msgContext)
{
log.info("handleRequest");
+ QName[] headers = getHeaders();
+ if (headers == null || headers.length != 3)
+ throw new IllegalStateException("Invalid number of headers");
+
try
{
SOAPMessage soapMessage = ((SOAPMessageContext)msgContext).getMessage();
Modified:
trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefClientTestCase.java
===================================================================
---
trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefClientTestCase.java 2006-11-22
13:27:13 UTC (rev 1501)
+++
trunk/src/test/java/org/jboss/test/ws/jaxrpc/webserviceref/WebServiceRefClientTestCase.java 2006-11-22
15:29:15 UTC (rev 1502)
@@ -27,6 +27,8 @@
import javax.xml.namespace.QName;
import javax.xml.rpc.Service;
+import javax.xml.rpc.ServiceException;
+import javax.xml.rpc.ServiceFactory;
import junit.framework.Test;
@@ -45,7 +47,7 @@
public class WebServiceRefClientTestCase extends JBossWSTest
{
public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() +
":8080/jaxrpc-webserviceref";
-
+
public static Test suite()
{
return JBossWSTestSetup.newTestSetup(WebServiceRefClientTestCase.class,
"jaxrpc-webserviceref.war, jaxrpc-webserviceref-client.jar");
@@ -58,7 +60,7 @@
WSDLDefinitions wsdlDefinitions = factory.parse(wsdlURL);
assertNotNull(wsdlDefinitions);
}
-
+
public void testDynamicProxy() throws Exception
{
URL wsdlURL = new
File("resources/jaxrpc/webserviceref/META-INF/wsdl/TestEndpoint.wsdl").toURL();
@@ -72,11 +74,31 @@
assertEquals(helloWorld, retObj);
}
+ public void testDynamicProxyNeg() throws Exception
+ {
+ URL wsdlURL = new
File("resources/jaxrpc/webserviceref/META-INF/wsdl/TestEndpoint.wsdl").toURL();
+ QName qname = new QName("http://org.jboss.ws/wsref",
"TestEndpointService");
+ Service service = ServiceFactory.newInstance().createService(wsdlURL, qname);
+ try
+ {
+ TestEndpoint port =
(TestEndpoint)service.getPort(java.rmi.activation.Activator.class);
+ fail("Expected ServiceException, but got: " + port);
+ }
+ catch (ServiceException ex)
+ {
+ // this is tested by the CTS
+ }
+ catch (Exception ex)
+ {
+ fail("Expected ServiceException, but got: " + ex);
+ }
+ }
+
public void testApplicationClient() throws Exception
{
String helloWorld = "Hello World!";
ApplicationClient.encCtx = getInitialContext();
- ApplicationClient.main(new String[]{helloWorld});
+ ApplicationClient.main(new String[] { helloWorld });
assertEquals(helloWorld, ApplicationClient.retStr);
}
}
Modified: trunk/src/test/resources/jaxrpc/samples/handler/META-INF/application-client.xml
===================================================================
---
trunk/src/test/resources/jaxrpc/samples/handler/META-INF/application-client.xml 2006-11-22
13:27:13 UTC (rev 1501)
+++
trunk/src/test/resources/jaxrpc/samples/handler/META-INF/application-client.xml 2006-11-22
15:29:15 UTC (rev 1502)
@@ -18,6 +18,18 @@
<handler>
<handler-name>HeaderTestHandler</handler-name>
<handler-class>org.jboss.test.ws.jaxrpc.samples.handler.ClientSideHandler</handler-class>
+ <init-param>
+ <param-name>ClientParam1</param-name>
+ <param-value>value1</param-value>
+ </init-param>
+ <init-param>
+ <param-name>ClientParam2</param-name>
+ <param-value>value2</param-value>
+ </init-param>
+ <soap-header
xmlns:ns1='http://somens'>ns1:InHeader</soap-header>
+ <soap-header
xmlns:ns1='http://somens'>ns1:OutHeader</soap-header>
+ <soap-header
xmlns:ns1='http://somens'>ns1:InOutHeader</soap-header>
+ <soap-role>role1</soap-role>
</handler>
</service-ref>
Modified: trunk/src/test/resources/jaxrpc/samples/handler/wstools-config.xml
===================================================================
--- trunk/src/test/resources/jaxrpc/samples/handler/wstools-config.xml 2006-11-22 13:27:13
UTC (rev 1501)
+++ trunk/src/test/resources/jaxrpc/samples/handler/wstools-config.xml 2006-11-22 15:29:15
UTC (rev 1502)
@@ -34,5 +34,17 @@
<handler>
<handler-name>HeaderTestHandler</handler-name>
<handler-class>org.jboss.test.ws.jaxrpc.samples.handler.HeaderTestHandler</handler-class>
+ <init-param>
+ <param-name>ServerParam1</param-name>
+ <param-value>value1</param-value>
+ </init-param>
+ <init-param>
+ <param-name>ServerParam2</param-name>
+ <param-value>value2</param-value>
+ </init-param>
+ <soap-header
xmlns:ns1='http://somens'>ns1:InHeader</soap-header>
+ <soap-header
xmlns:ns1='http://somens'>ns1:OutHeader</soap-header>
+ <soap-header
xmlns:ns1='http://somens'>ns1:InOutHeader</soap-header>
+ <soap-role>role1</soap-role>
</handler>
-->
Modified:
trunk/src/test/resources/jaxrpc/samples-override/handler/WEB-INF/webservices.xml
===================================================================
---
trunk/src/test/resources/jaxrpc/samples-override/handler/WEB-INF/webservices.xml 2006-11-22
13:27:13 UTC (rev 1501)
+++
trunk/src/test/resources/jaxrpc/samples-override/handler/WEB-INF/webservices.xml 2006-11-22
15:29:15 UTC (rev 1502)
@@ -13,6 +13,18 @@
<handler>
<handler-name>HeaderTestHandler</handler-name>
<handler-class>org.jboss.test.ws.jaxrpc.samples.handler.ServerSideHandler</handler-class>
+ <init-param>
+ <param-name>ServerParam1</param-name>
+ <param-value>value1</param-value>
+ </init-param>
+ <init-param>
+ <param-name>ServerParam2</param-name>
+ <param-value>value2</param-value>
+ </init-param>
+ <soap-header
xmlns:ns1='http://somens'>ns1:InHeader</soap-header>
+ <soap-header
xmlns:ns1='http://somens'>ns1:OutHeader</soap-header>
+ <soap-header
xmlns:ns1='http://somens'>ns1:InOutHeader</soap-header>
+ <soap-role>role1</soap-role>
</handler>
</port-component>
</webservice-description>