Author: thomas.diesler(a)jboss.com
Date: 2007-01-16 07:18:26 -0500 (Tue, 16 Jan 2007)
New Revision: 1980
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/CommonClient.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/ServiceImpl.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerDelegateJAXWS.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/PortInfoImpl.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/soap/SOAPMessageDispatcher.java
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/jaxws/WSDLGenerator.java
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/provider/ProviderJAXBTestCase.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/provider/ProviderMessageTestCase.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/provider/ProviderPayloadTestCase.java
Log:
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-16
11:33:23 UTC (rev 1979)
+++ trunk/jbossws-core/src/main/java/org/jboss/ws/core/CommonClient.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -249,7 +249,7 @@
setOutboundContextProperties();
// Call the request handlers
- QName portName = epMetaData.getQName();
+ QName portName = epMetaData.getPortName();
boolean handlerPass = callRequestHandlerChain(portName, HandlerType.PRE);
handlerPass = handlerPass && callRequestHandlerChain(portName,
HandlerType.ENDPOINT);
handlerPass = handlerPass && callRequestHandlerChain(portName,
HandlerType.POST);
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/ParameterWrapping.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -281,7 +281,7 @@
String serviceName = serviceMetaData.getServiceName().getLocalPart();
String parameterName = pmd.getXmlName().getLocalPart();
- String endpointName = endpointMetaData.getQName().getLocalPart();
+ String endpointName = endpointMetaData.getPortName().getLocalPart();
String packageName =
endpointMetaData.getServiceEndpointInterface().getPackage().getName();
String wrapperName = packageName + "._JBossWS_" + serviceName +
"_" + endpointName + "_" + parameterName;
Modified: trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/ServiceImpl.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/ServiceImpl.java 2007-01-16
11:33:23 UTC (rev 1979)
+++ trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/ServiceImpl.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -295,7 +295,7 @@
{
for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
{
- list.add(epMetaData.getQName());
+ list.add(epMetaData.getPortName());
}
}
return list.iterator();
@@ -415,7 +415,7 @@
void setupHandlerChain(EndpointMetaData epMetaData)
{
- QName portName = epMetaData.getQName();
+ QName portName = epMetaData.getPortName();
Set<String> handlerRoles = new HashSet<String>();
ArrayList handlerInfos = new ArrayList();
for (HandlerMetaData handlerMetaData :
epMetaData.getHandlerMetaData(HandlerType.ALL))
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxrpc/handler/HandlerDelegateJAXRPC.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -171,7 +171,7 @@
hConfig.put(HandlerType.class.getName(), jaxrpcMetaData.getHandlerType());
HandlerInfo info = new HandlerInfo(hClass, hConfig, headerArr);
- log.debug("Adding server side handler to service '" +
sepMetaData.getQName() + "': " + info);
+ log.debug("Adding server side handler to service '" +
sepMetaData.getPortName() + "': " + info);
hInfos.add(info);
}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/client/DispatchImpl.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -40,6 +40,7 @@
import javax.xml.soap.SOAPMessage;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.AsyncHandler;
@@ -283,8 +284,7 @@
{
SOAPBodyImpl soapBody = (SOAPBodyImpl)resMsg.getSOAPBody();
SOAPElement soapElement =
(SOAPElement)soapBody.getChildElements().next();
- String xmlPayload = DOMWriter.printNode(soapElement, false);
- retObj = new StreamSource(new StringReader(xmlPayload));
+ retObj = new DOMSource(soapElement);
}
if (mode == Mode.MESSAGE)
{
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerDelegateJAXWS.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerDelegateJAXWS.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerDelegateJAXWS.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -136,7 +136,7 @@
private PortInfo getPortInfo(EndpointMetaData epMetaData)
{
QName serviceName = epMetaData.getServiceMetaData().getServiceName();
- QName portName = epMetaData.getQName();
+ QName portName = epMetaData.getPortName();
String bindingId = epMetaData.getBindingId();
PortInfo info = new PortInfoImpl(serviceName, portName, bindingId);
return info;
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/HandlerResolverImpl.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -238,7 +238,7 @@
ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
for (EndpointMetaData epmd : serviceMetaData.getEndpoints())
{
- QName qname = epmd.getQName();
+ QName qname = epmd.getPortName();
String nsURI = qname.getNamespaceURI();
String localPart = qname.getLocalPart();
if (nsURI.equals(namespaceURI) &&
localPart.startsWith(localPattern))
@@ -252,7 +252,7 @@
ServiceMetaData serviceMetaData = epMetaData.getServiceMetaData();
for (EndpointMetaData epmd : serviceMetaData.getEndpoints())
{
- QName qname = epmd.getQName();
+ QName qname = epmd.getPortName();
if (ports.equals(qname))
{
infos.add(new PortInfoImpl(null, qname, null));
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/PortInfoImpl.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/PortInfoImpl.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/handler/PortInfoImpl.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -46,7 +46,7 @@
public PortInfoImpl(EndpointMetaData epMetaData)
{
this.serviceName = epMetaData.getServiceMetaData().getServiceName();
- this.portName = epMetaData.getQName();
+ this.portName = epMetaData.getPortName();
this.bindingID = epMetaData.getBindingId();
}
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-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -26,7 +26,6 @@
import java.lang.reflect.Proxy;
import java.net.URL;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.Executor;
@@ -47,7 +46,6 @@
import org.jboss.logging.Logger;
import org.jboss.util.NotImplementedException;
-import org.jboss.ws.Constants;
import org.jboss.ws.core.jaxws.StubExt;
import org.jboss.ws.core.jaxws.client.ClientImpl;
import org.jboss.ws.core.jaxws.client.ClientProxy;
@@ -57,6 +55,7 @@
import org.jboss.ws.metadata.umdm.ClientEndpointMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.ws.metadata.umdm.ServiceMetaData;
+import org.jboss.ws.metadata.umdm.UnifiedMetaData;
import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
import org.jboss.ws.metadata.umdm.HandlerMetaData.HandlerType;
@@ -79,8 +78,6 @@
// The service meta data that is associated with this JAXWS Service
private ServiceMetaData serviceMetaData;
- // The ports known by this service
- private HashMap<QName, Port> ports = new HashMap<QName,Port>();
// The handler resolver
private HandlerResolver handlerResolver = new HandlerResolverImpl();
// The executor service
@@ -91,18 +88,17 @@
public ServiceDelegateImpl(URL wsdlURL, QName serviceName)
{
- JAXWSClientMetaDataBuilder builder = new JAXWSClientMetaDataBuilder();
-
- serviceMetaData = builder.buildMetaData(serviceName, wsdlURL);
-
- for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
+ if (wsdlURL != null)
{
- QName portName = epMetaData.getQName();
- String bindingId = epMetaData.getBindingId();
- String epAddress = epMetaData.getEndpointAddress();
- Port port = new Port (portName, bindingId, epAddress);
- ports.put(portName, port);
+ JAXWSClientMetaDataBuilder builder = new JAXWSClientMetaDataBuilder();
+ serviceMetaData = builder.buildMetaData(serviceName, wsdlURL);
}
+ else
+ {
+ UnifiedMetaData wsMetaData = new UnifiedMetaData();
+ serviceMetaData = new ServiceMetaData(wsMetaData, serviceName);
+ wsMetaData.addService(serviceMetaData);
+ }
}
/**
@@ -159,7 +155,7 @@
for(EndpointMetaData epmd : serviceMetaData.getEndpoints())
{
- QName interfaceQName = epmd.getInterfaceQName(); // skip namespaces here
+ QName interfaceQName = epmd.getPortTypeName(); // skip namespaces here
if( interfaceQName.getLocalPart().equals( portTypeName.getLocalPart() ) )
{
epmd.setServiceEndpointInterfaceName(seiClass.getName());
@@ -177,7 +173,7 @@
private <T> T getPortInternal(EndpointMetaData epMetaData, Class<T>
seiClass)
{
- QName portName = epMetaData.getQName();
+ QName portName = epMetaData.getPortName();
// Adjust the endpoint meta data according to the annotations
if (annotatedPorts.contains(portName) == false)
@@ -204,11 +200,12 @@
* Ports created in this way contain no WSDL port type information
* and can only be used for creating Dispatchinstances.
*/
-
public void addPort(QName portName, String bindingId, String epAddress)
{
- Port port = new Port (portName, bindingId, epAddress);
- ports.put(portName, port);
+ EndpointMetaData epMetaData = new ClientEndpointMetaData(serviceMetaData, portName,
null, Type.JAXWS);
+ epMetaData.setBindingId(bindingId);
+ epMetaData.setEndpointAddress(epAddress);
+ serviceMetaData.addEndpoint(epMetaData);
}
@Override
@@ -231,18 +228,10 @@
private EndpointMetaData getEndpointMetaData(QName portName)
{
- Port port = ports.get(portName);
- if (port == null)
- throw new WebServiceException("Cannot find port: " + portName);
-
- // Create an anonymous endpoint
EndpointMetaData epMetaData = serviceMetaData.getEndpoint(portName);
if (epMetaData == null)
- {
- epMetaData = new ClientEndpointMetaData(serviceMetaData, new
QName(Constants.NS_JBOSSWS_URI, "AnonymousPort"), new
QName(Constants.NS_JBOSSWS_URI, "Anonymous"), Type.JAXWS);
- epMetaData.setEndpointAddress(port.getEndpointAddress());
- epMetaData.setBindingId(port.getBindingId());
- }
+ throw new WebServiceException("Cannot find port: " + portName);
+
return epMetaData;
}
@@ -258,9 +247,9 @@
public Iterator<QName> getPorts()
{
ArrayList<QName> portNames = new ArrayList<QName>();
- for (Port port : ports.values())
+ for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
{
- portNames.add(port.getQName());
+ portNames.add(epMetaData.getPortName());
}
return portNames.iterator();
}
@@ -330,35 +319,6 @@
}
}
- private static class Port
- {
- private QName qname;
- private String bindingId;
- private String endpointAddress;
-
- public Port(QName qname, String bindingId, String endpointAddress)
- {
- this.qname = qname;
- this.bindingId = bindingId;
- this.endpointAddress = endpointAddress;
- }
-
- public String getBindingId()
- {
- return bindingId;
- }
-
- public String getEndpointAddress()
- {
- return endpointAddress;
- }
-
- public QName getQName()
- {
- return qname;
- }
- }
-
@Override
public <T> Dispatch<T> createDispatch(QName portName, Class<T> type,
Mode mode, WebServiceFeature... features)
{
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/AbstractServiceEndpointInvoker.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -241,11 +241,11 @@
{
SOAPBodyElement soapBodyElement =
(SOAPBodyElement)soapBody.getChildElements().next();
Name soapName = soapBodyElement.getElementName();
- faultString = "Endpoint " + epMetaData.getQName() + " does not
contain operation meta data for: " + soapName;
+ faultString = "Endpoint " + epMetaData.getPortName() + " does
not contain operation meta data for: " + soapName;
}
else
{
- faultString = "Endpoint " + epMetaData.getQName() + " does not
contain operation meta data for empty soap body";
+ faultString = "Endpoint " + epMetaData.getPortName() + " does
not contain operation meta data for empty soap body";
}
// R2724 If an INSTANCE receives a message that is inconsistent with its WSDL
description, it SHOULD generate a soap:Fault
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/soap/SOAPMessageDispatcher.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/soap/SOAPMessageDispatcher.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/soap/SOAPMessageDispatcher.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -77,7 +77,7 @@
// Dispatch to JAXWS Provider
if (opMetaData == null && epMetaData.getServiceMode() != null)
{
- QName xmlName = new QName(epMetaData.getQName().getNamespaceURI(),
"invoke");
+ QName xmlName = new QName(epMetaData.getPortName().getNamespaceURI(),
"invoke");
opMetaData = epMetaData.getOperation(xmlName);
}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/security/WSSecurityDispatcher.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -128,7 +128,7 @@
}
String operation = opMetaData.getQName().toString();
- String port = opMetaData.getEndpointMetaData().getQName().getLocalPart();
+ String port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
if (hasRequirements(config, operation, port))
throw convertToFault(new InvalidSecurityHeaderException("This service
requires <wsse:Security>, which is missing."));
@@ -155,7 +155,7 @@
}
String operation = opMetaData.getQName().toString();
- String port = opMetaData.getEndpointMetaData().getQName().getLocalPart();
+ String port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
List<OperationDescription<RequireOperation>> operations =
buildRequireOperations(config, operation, port);
@@ -228,7 +228,7 @@
OperationMetaData opMetaData = ctx.getOperationMetaData();
String operation = opMetaData.getQName().toString();
- String port = opMetaData.getEndpointMetaData().getQName().getLocalPart();
+ String port = opMetaData.getEndpointMetaData().getPortName().getLocalPart();
Config operationConfig = getConfig(config, port, operation);
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -89,7 +89,7 @@
{
for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
{
- if (epMetaData.getQName().equals(wsdlEndpoint.getQName()))
+ if (epMetaData.getPortName().equals(wsdlEndpoint.getQName()))
{
QName bindQName = wsdlEndpoint.getBinding();
NCName ncName = new NCName(bindQName.getLocalPart());
@@ -282,7 +282,7 @@
public static void replaceAddressLocation(ServerEndpointMetaData sepMetaData)
{
WSDLDefinitions wsdlDefinitions =
sepMetaData.getServiceMetaData().getWsdlDefinitions();
- QName portName = sepMetaData.getQName();
+ QName portName = sepMetaData.getPortName();
boolean endpointFound = false;
for (WSDLService wsdlService : wsdlDefinitions.getServices())
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSClientMetaDataBuilder.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -179,7 +179,7 @@
// Nuke parameterStyle
epMetaData.setParameterStyle(null);
-
+
// Process an optional @BindingType annotation
if (wsClass.isAnnotationPresent(BindingType.class))
processBindingType(epMetaData, wsClass);
@@ -202,6 +202,9 @@
createJAXBContext(epMetaData);
populateXmlTypes(epMetaData);
+ // Set SEI name
+ epMetaData.setServiceEndpointInterfaceName(wsClass.getName());
+
// Eager initialization
epMetaData.eagerInitialize();
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -1,24 +1,24 @@
/*
-* 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.
-*/
+ * 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.metadata.builder.jaxws;
// $Id$
@@ -105,37 +105,34 @@
protected void processBindingType(EndpointMetaData epMetaData, Class<?>
wsClass)
{
- if (! wsClass.isAnnotationPresent(BindingType.class))
- return;
-
- BindingType anBindingType = (BindingType)wsClass.getAnnotation(BindingType.class);
- String uri = anBindingType.value();
- if (uri.length() > 0)
+ if (wsClass.isAnnotationPresent(BindingType.class))
{
- epMetaData.setBindingId(uri);
+ log.debug("processBindingType on: " + wsClass.getName());
+ BindingType anBindingType =
(BindingType)wsClass.getAnnotation(BindingType.class);
+ epMetaData.setBindingId(anBindingType.value());
}
}
protected void processSOAPBinding(EndpointMetaData epMetaData, Class<?>
wsClass)
{
-
- if (!wsClass.isAnnotationPresent(SOAPBinding.class))
- return;
-
- SOAPBinding anSoapBinding = wsClass.getAnnotation(SOAPBinding.class);
-
- SOAPBinding.Style attrStyle = anSoapBinding.style();
- Style style = (attrStyle == SOAPBinding.Style.RPC ? Style.RPC : Style.DOCUMENT);
- epMetaData.setStyle(style);
-
- SOAPBinding.Use attrUse = anSoapBinding.use();
- if (attrUse == SOAPBinding.Use.ENCODED)
- throw new WSException("SOAP encoding is not supported for JSR-181
deployments");
-
- epMetaData.setEncodingStyle(Use.LITERAL);
-
- ParameterStyle paramStyle = anSoapBinding.parameterStyle();
- epMetaData.setParameterStyle(paramStyle);
+ if (wsClass.isAnnotationPresent(SOAPBinding.class))
+ {
+ log.debug("processSOAPBinding on: " + wsClass.getName());
+ SOAPBinding anSoapBinding = wsClass.getAnnotation(SOAPBinding.class);
+
+ SOAPBinding.Style attrStyle = anSoapBinding.style();
+ Style style = (attrStyle == SOAPBinding.Style.RPC ? Style.RPC :
Style.DOCUMENT);
+ epMetaData.setStyle(style);
+
+ SOAPBinding.Use attrUse = anSoapBinding.use();
+ if (attrUse == SOAPBinding.Use.ENCODED)
+ throw new WSException("SOAP encoding is not supported for JSR-181
deployments");
+
+ epMetaData.setEncodingStyle(Use.LITERAL);
+
+ ParameterStyle paramStyle = anSoapBinding.parameterStyle();
+ epMetaData.setParameterStyle(paramStyle);
+ }
}
/**
@@ -153,12 +150,13 @@
{
if (wsClass.isAnnotationPresent(SOAPMessageHandlers.class))
throw new WSException("Cannot combine @HandlerChain with
@SOAPMessageHandlers");
-
+
HandlerChain anHandlerChain = wsClass.getAnnotation(HandlerChain.class);
-
+
URL fileURL = null;
String filename = anHandlerChain.file();
-
+ log.debug("processHandlerChain [" + filename + "] on: " +
wsClass.getName());
+
// Try the filename as URL
try
{
@@ -168,7 +166,7 @@
{
// ignore
}
-
+
// Try the filename as File
if (fileURL == null)
{
@@ -183,23 +181,23 @@
// ignore
}
}
-
+
// Try the filename as Resource
if (fileURL == null)
{
fileURL = epMetaData.getClassLoader().getResource(filename);
}
-
+
// Try the filename relative to class
if (fileURL == null)
{
String packagePath = wsClass.getPackage().getName().replace('.',
'/');
fileURL = epMetaData.getClassLoader().getResource(packagePath + "/" +
filename);
}
-
+
if (fileURL == null)
throw new WSException("Cannot resolve handler file '" + filename +
"' on " + wsClass.getName());
-
+
try
{
HandlerChainsMetaData handlerChainsMetaData = null;
@@ -217,7 +215,7 @@
{
is.close();
}
-
+
// Setup the endpoint handlers
for (HandlerChainMetaData handlerChainMetaData :
handlerChainsMetaData.getHandlerChains())
{
@@ -242,16 +240,16 @@
if (omd.isOneWay())
throw new IllegalStateException("JSR-181 4.3.1 - A JSR-181 processor is
REQUIRED to report an error if an operation marked "
+ "@Oneway has a return value, declares any checked exceptions or has
any INOUT or OUT parameters.");
-
+
WebFault annotation = exception.getAnnotation(WebFault.class);
-
+
String name;
String namespace;
String faultBeanName = null;
-
+
// Only the element name is effected by @WebFault, the type uses the same
convention
QName xmlType = new QName(omd.getQName().getNamespaceURI(),
exception.getSimpleName());
-
+
/*
* If @WebFault is present, and the exception contains getFaultInfo, the
* return value should be used. Otherwise we need to generate the bean.
@@ -263,7 +261,7 @@
namespace = annotation.targetNamespace();
if (namespace.length() == 0)
namespace = omd.getQName().getNamespaceURI();
-
+
Class<?> faultBean = getFaultInfo(exception);
if (faultBean != null)
{
@@ -276,21 +274,21 @@
name = xmlType.getLocalPart();
namespace = xmlType.getNamespaceURI();
}
-
+
if (faultBeanName == null)
faultBeanName =
JavaUtils.getPackageName(omd.getEndpointMetaData().getServiceEndpointInterface()) +
".jaxws." + exception.getSimpleName() + "Bean";
-
+
QName xmlName = new QName(namespace, name);
-
+
FaultMetaData fmd = new FaultMetaData(omd, xmlName, xmlType, exception.getName());
fmd.setFaultBeanName(faultBeanName);
-
+
if (generate)
wrapperGenerator.generate(fmd);
-
+
javaTypes.add(fmd.getFaultBean());
typeRefs.add(new TypeReference(fmd.getXmlName(), fmd.getFaultBean()));
-
+
omd.addFault(fmd);
}
@@ -303,16 +301,16 @@
{
if (!Collection.class.isAssignableFrom(rawType) &&
!Map.class.isAssignableFrom(rawType))
return null;
-
+
if (!(type instanceof ParameterizedType))
return null;
-
+
ParameterizedType paramType = (ParameterizedType)type;
Type[] arguments = paramType.getActualTypeArguments();
String[] ret = new String[arguments.length];
for (int i = 0; i < arguments.length; i++)
ret[i] = JavaUtils.erasure(arguments[i]).getName();
-
+
return ret;
}
@@ -324,27 +322,27 @@
if (method.isAnnotationPresent(RequestWrapper.class))
{
RequestWrapper anReqWrapper = method.getAnnotation(RequestWrapper.class);
-
+
String localName = anReqWrapper.localName().length() > 0 ?
anReqWrapper.localName() : xmlName.getLocalPart();
String targetNamespace = anReqWrapper.targetNamespace().length() > 0 ?
anReqWrapper.targetNamespace() : xmlName.getNamespaceURI();
xmlName = new QName(targetNamespace, localName);
-
+
if (anReqWrapper.className().length() > 0)
requestWrapperType = anReqWrapper.className();
}
-
+
// Conformance 3.18, the default value must be the same as the method name
if (requestWrapperType == null)
{
String packageName = JavaUtils.getPackageName(method.getDeclaringClass()) +
".jaxws";
requestWrapperType = packageName + "." +
JavaUtils.capitalize(method.getName());
}
-
+
// JAX-WS p.37 pg.1, the annotation only affects the element name, not the type
name
ParameterMetaData wrapperParameter = new ParameterMetaData(operation, xmlName,
xmlType, requestWrapperType);
wrapperParameter.setAccessorFactoryCreator(JAXBAccessor.FACTORY_CREATOR);
operation.addParameter(wrapperParameter);
-
+
return wrapperParameter;
}
@@ -353,30 +351,30 @@
QName operationQName = operation.getQName();
QName xmlName = new QName(operationQName.getNamespaceURI(),
operationQName.getLocalPart() + "Response");
QName xmlType = xmlName;
-
+
String responseWrapperType = null;
if (method.isAnnotationPresent(ResponseWrapper.class))
{
ResponseWrapper anResWrapper = method.getAnnotation(ResponseWrapper.class);
-
+
String localName = anResWrapper.localName().length() > 0 ?
anResWrapper.localName() : xmlName.getLocalPart();
String targetNamespace = anResWrapper.targetNamespace().length() > 0 ?
anResWrapper.targetNamespace() : xmlName.getNamespaceURI();
xmlName = new QName(targetNamespace, localName);
-
+
if (anResWrapper.className().length() > 0)
responseWrapperType = anResWrapper.className();
}
-
+
if (responseWrapperType == null)
{
String packageName = JavaUtils.getPackageName(method.getDeclaringClass()) +
".jaxws";
responseWrapperType = packageName + "." +
JavaUtils.capitalize(method.getName()) + "Response";
}
-
+
ParameterMetaData retMetaData = new ParameterMetaData(operation, xmlName, xmlType,
responseWrapperType);
retMetaData.setAccessorFactoryCreator(JAXBAccessor.FACTORY_CREATOR);
operation.setReturnParameter(retMetaData);
-
+
return retMetaData;
}
@@ -388,7 +386,7 @@
Class<?> returnType = method.getReturnType();
if (returnType == void.class)
return null;
-
+
return returnType;
}
catch (SecurityException e)
@@ -410,7 +408,7 @@
if (anWebParam.mode() == WebParam.Mode.OUT)
return ParameterMode.OUT;
}
-
+
return HolderUtils.isHolderType(javaType) ? ParameterMode.INOUT :
ParameterMode.IN;
}
@@ -419,7 +417,7 @@
for (Annotation annotation : method.getParameterAnnotations()[pos])
if (annotation instanceof WebParam)
return (WebParam)annotation;
-
+
return null;
}
@@ -428,33 +426,33 @@
String namespace = null;
String name = null;
boolean header = false;
-
+
if (webParam != null)
{
if (webParam.targetNamespace().length() > 0)
namespace = webParam.targetNamespace();
-
+
// RPC types use the partName for their XML name
if (webParam.partName().length() > 0 && opMetaData.isRPCLiteral())
name = webParam.partName();
else if (webParam.name().length() > 0)
name = webParam.name();
-
+
header = webParam.header();
}
-
+
// Bare and headers must be qualified
if (namespace == null && (opMetaData.isDocumentBare() || header))
namespace = opMetaData.getQName().getNamespaceURI();
-
+
// RPC body parts must have no namespace
else if (opMetaData.isRPCLiteral() && !header)
namespace = null;
-
+
// Bare uses the operation name as the default, everything else is generated
if (name == null)
name = opMetaData.isDocumentBare() && !header ?
opMetaData.getQName().getLocalPart() : "arg" + index;
-
+
return (namespace != null) ? new QName(namespace, name) : new QName(name);
}
@@ -463,33 +461,33 @@
String name = null;
String namespace = null;
boolean header = false;
-
+
if (anWebResult != null)
{
if (anWebResult.targetNamespace().length() > 0)
namespace = anWebResult.targetNamespace();
-
+
// RPC types use the partName for their XML name
if (anWebResult.partName().length() > 0 &&
opMetaData.isRPCLiteral())
name = anWebResult.partName();
else if (anWebResult.name().length() > 0)
name = anWebResult.name();
-
+
header = anWebResult.header();
}
-
+
// Bare and headers must be qualified
if (namespace == null && (opMetaData.isDocumentBare() || header))
namespace = opMetaData.getQName().getNamespaceURI();
-
+
// RPC body parts must have no namespace
else if (opMetaData.isRPCLiteral() && !header)
namespace = null;
-
+
// Bare uses the operation name as the default, everything else is generated
if (name == null)
name = opMetaData.isDocumentBare() && !header ?
opMetaData.getResponseName().getLocalPart() : "return";
-
+
return (namespace != null) ? new QName(namespace, name) : new QName(name);
}
@@ -500,31 +498,31 @@
{
// Until there is a addressing annotion we fallback to implicit action association
// TODO: figure out a way to assign message name instead of IN and OUT
- String tns = epMetaData.getQName().getNamespaceURI();
- String portTypeName = epMetaData.getQName().getLocalPart();
-
+ String tns = epMetaData.getPortName().getNamespaceURI();
+ String portTypeName = epMetaData.getPortName().getLocalPart();
+
AddressingProperties ADDR = new AddressingPropertiesImpl();
AddressingOpMetaExt addrExt = new AddressingOpMetaExt(ADDR.getNamespaceURI());
addrExt.setInboundAction(tns + "/" + portTypeName + "/IN");
-
+
if (!opMetaData.isOneWay())
addrExt.setOutboundAction(tns + "/" + portTypeName +
"/OUT");
-
+
opMetaData.addExtension(addrExt);
}
private void processWebMethod(EndpointMetaData epMetaData, Method method)
{
String javaName = method.getName();
-
+
// skip asnyc methods, they dont need meta data representation
if (method.getName().endsWith(Constants.ASYNC_METHOD_SUFFIX))
return;
-
+
// reflection defaults
String soapAction = "";
String operationName = method.getName();
-
+
// annotation values that override defaults
if (method.isAnnotationPresent(WebMethod.class))
{
@@ -535,12 +533,12 @@
operationName = anWebMethod.operationName();
}
}
-
- String targetNS = epMetaData.getInterfaceQName().getNamespaceURI();
+
+ String targetNS = epMetaData.getPortTypeName().getNamespaceURI();
OperationMetaData opMetaData = new OperationMetaData(epMetaData, new
QName(targetNS, operationName), javaName);
opMetaData.setOneWay(method.isAnnotationPresent(Oneway.class));
opMetaData.setSOAPAction(soapAction);
-
+
if (method.isAnnotationPresent(SOAPBinding.class))
{
SOAPBinding anBinding = method.getAnnotation(SOAPBinding.class);
@@ -548,28 +546,28 @@
throw new IllegalArgumentException("@SOAPBinding must be specified using
DOCUMENT style when placed on a method");
opMetaData.setParameterStyle(anBinding.parameterStyle());
}
-
+
epMetaData.addOperation(opMetaData);
-
+
// Build parameter meta data
Class[] parameterTypes = method.getParameterTypes();
Type[] genericTypes = method.getGenericParameterTypes();
Annotation[][] parameterAnnotations = method.getParameterAnnotations();
ParameterMetaData wrapperParameter = null, wrapperOutputParameter = null;
List<WrappedParameter> wrappedParameters = null, wrappedOutputParameters =
null;
-
+
// Force paramter style to wrapped
if (method.isAnnotationPresent(RequestWrapper.class) ||
method.isAnnotationPresent(ResponseWrapper.class))
{
epMetaData.setParameterStyle(ParameterStyle.WRAPPED);
}
-
+
if (opMetaData.isDocumentWrapped())
{
wrapperParameter = createRequestWrapper(opMetaData, method);
wrappedParameters = new
ArrayList<WrappedParameter>(parameterTypes.length);
wrapperParameter.setWrappedParameters(wrappedParameters);
-
+
if (!opMetaData.isOneWay())
{
wrapperOutputParameter = createResponseWrapper(opMetaData, method);
@@ -577,7 +575,7 @@
wrapperOutputParameter.setWrappedParameters(wrappedOutputParameters);
}
}
-
+
for (int i = 0; i < parameterTypes.length; i++)
{
Class javaType = parameterTypes[i];
@@ -587,26 +585,26 @@
boolean isHeader = anWebParam != null && anWebParam.header();
boolean isWrapped = opMetaData.isDocumentWrapped() && !isHeader;
ParameterMode mode = getParameterMode(anWebParam, javaType);
-
+
// Assert one-way
if (opMetaData.isOneWay() && mode != ParameterMode.IN)
throw new IllegalArgumentException("A one-way operation can not have
output parameters [" + "method = " + method.getName() + ", parameter =
" + i + "]");
-
+
if (HolderUtils.isHolderType(javaType))
{
genericType = HolderUtils.getGenericValueType(genericType);
javaType = JavaUtils.erasure(genericType);
javaTypeName = javaType.getName();
}
-
+
if (isWrapped)
{
QName wrappedElementName = getWebParamName(opMetaData, i, anWebParam);
String variable = convertToVariable(wrappedElementName.getLocalPart());
-
+
WrappedParameter wrappedParameter = new WrappedParameter(wrappedElementName,
javaTypeName, variable, i);
wrappedParameter.setTypeArguments(convertTypeArguments(javaType,
genericType));
-
+
if (mode != ParameterMode.OUT)
wrappedParameters.add(wrappedParameter);
if (mode != ParameterMode.IN)
@@ -618,12 +616,12 @@
else
{
QName xmlName = getWebParamName(opMetaData, i, anWebParam);
-
+
ParameterMetaData paramMetaData = new ParameterMetaData(opMetaData, xmlName,
javaTypeName);
paramMetaData.setInHeader(isHeader);
paramMetaData.setIndex(i);
paramMetaData.setMode(mode);
-
+
/*
* Note: The TCK enforces the following rule in the spec regarding
* partName: "This is only used if the operation is rpc style or if
@@ -638,13 +636,13 @@
*/
if (anWebParam != null && !opMetaData.isDocumentWrapped() &&
anWebParam.partName().length() > 0)
paramMetaData.setPartName(anWebParam.partName());
-
+
opMetaData.addParameter(paramMetaData);
javaTypes.add(javaType);
typeRefs.add(new TypeReference(xmlName, genericType,
parameterAnnotations[i]));
}
}
-
+
// Build result meta data
Class returnType = method.getReturnType();
Type genericReturnType = method.getGenericReturnType();
@@ -653,17 +651,17 @@
{
if (opMetaData.isOneWay())
throw new IllegalArgumentException("[JSR-181 2.5.1] The method
'" + method.getName() + "' can not have a return value if it is marked
OneWay");
-
+
WebResult anWebResult = method.getAnnotation(WebResult.class);
boolean isHeader = anWebResult != null && anWebResult.header();
boolean isWrappedBody = opMetaData.isDocumentWrapped() && !isHeader;
QName xmlName = getWebResultName(opMetaData, anWebResult);
-
+
if (isWrappedBody)
{
WrappedParameter wrapped = new WrappedParameter(xmlName, returnTypeName,
convertToVariable(xmlName.getLocalPart()), -1);
wrapped.setTypeArguments(convertTypeArguments(returnType,
genericReturnType));
-
+
// insert at the beginning just for prettiness
wrappedOutputParameters.add(0, wrapped);
}
@@ -673,7 +671,7 @@
retMetaData.setInHeader(isHeader);
retMetaData.setIndex(-1);
retMetaData.setMode(ParameterMode.OUT);
-
+
// Special case: If we have a document/literal wrapped message, then
// the return metadata must be the wrapper type that is sent in the
// body. So, in order to handle headers that are mapped to the java
@@ -691,15 +689,15 @@
// header parameters.
if (anWebResult != null && anWebResult.partName().length() >
0)
retMetaData.setPartName(anWebResult.partName());
-
+
opMetaData.setReturnParameter(retMetaData);
}
-
+
javaTypes.add(returnType);
typeRefs.add(new TypeReference(xmlName, genericReturnType,
method.getAnnotations()));
}
}
-
+
// Generate wrapper beans
if (opMetaData.isDocumentWrapped())
{
@@ -717,12 +715,12 @@
typeRefs.add(new TypeReference(wrapperOutputParameter.getXmlName(),
wrapperClass));
}
}
-
+
// Add faults
for (Class exClass : method.getExceptionTypes())
if (!RemoteException.class.isAssignableFrom(exClass))
addFault(opMetaData, exClass);
-
+
// process op meta data extension
processMetaExtensions(epMetaData, opMetaData);
}
@@ -730,7 +728,7 @@
protected void processWebMethods(EndpointMetaData epMetaData, Class wsClass)
{
epMetaData.clearOperations();
-
+
// Process @WebMethod annotations
int webMethodCount = 0;
for (Method method : wsClass.getMethods())
@@ -743,7 +741,7 @@
webMethodCount++;
}
}
-
+
// @WebService should expose all inherited methods if @WebMethod is never
specified
if (webMethodCount == 0 && !wsClass.isInterface())
{
@@ -758,7 +756,7 @@
}
}
}
-
+
if (webMethodCount == 0)
throw new WSException("No exposable methods found");
}
@@ -775,7 +773,7 @@
{
try
{
- String targetNS = epMetaData.getInterfaceQName().getNamespaceURI();
+ String targetNS = epMetaData.getPortTypeName().getNamespaceURI();
log.debug("JAXBContext [types=" + javaTypes + ",tns=" +
targetNS + "]");
jaxbCtx = JAXBRIContext.newInstance(javaTypes.toArray(new Class[0]), typeRefs,
targetNS, false);
}
@@ -789,10 +787,10 @@
{
EndpointMetaData epMetaData =
faultMetaData.getOperationMetaData().getEndpointMetaData();
TypesMetaData types = epMetaData.getServiceMetaData().getTypesMetaData();
-
+
QName xmlType = faultMetaData.getXmlType();
String faultBeanName = faultMetaData.getFaultBeanName();
-
+
types.addTypeMapping(new TypeMappingMetaData(types, xmlType, faultBeanName));
}
@@ -800,12 +798,12 @@
{
EndpointMetaData epMetaData =
paramMetaData.getOperationMetaData().getEndpointMetaData();
TypesMetaData types = epMetaData.getServiceMetaData().getTypesMetaData();
-
+
QName xmlName = paramMetaData.getXmlName();
QName xmlType = paramMetaData.getXmlType();
Class javaType = paramMetaData.getJavaType();
String javaName = paramMetaData.getJavaTypeName();
-
+
if (xmlType == null)
{
try
@@ -816,7 +814,7 @@
{
throw new IllegalStateException("Cannot obtain xml type for:
[xmlName=" + xmlName + ",javaName=" + javaName + "]");
}
-
+
/* Anonymous type.
*
* Currently the design of our stack is based on the
@@ -826,10 +824,10 @@
*/
if (xmlType == null)
xmlType = new QName(xmlName.getNamespaceURI(), ">" +
xmlName.getLocalPart());
-
+
paramMetaData.setXmlType(xmlType);
}
-
+
types.addTypeMapping(new TypeMappingMetaData(types, xmlType, javaName));
}
@@ -842,12 +840,12 @@
{
populateXmlType(paramMetaData);
}
-
+
// return value
ParameterMetaData returnParameter = operation.getReturnParameter();
if (returnParameter != null)
populateXmlType(returnParameter);
-
+
// faults
for (FaultMetaData faultMetaData : operation.getFaults())
{
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSProviderMetaDataBuilder.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -146,7 +146,7 @@
private void processInvokeMethod(ServerEndpointMetaData epMetaData)
{
String javaName = "invoke";
- String targetNS = epMetaData.getQName().getNamespaceURI();
+ String targetNS = epMetaData.getPortName().getNamespaceURI();
OperationMetaData opMetaData = new OperationMetaData(epMetaData, new
QName(targetNS, javaName), javaName);
epMetaData.addOperation(opMetaData);
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -247,7 +247,7 @@
WSDLDefinitions wsdlDefinitions = generator.generate(serviceMetaData);
// Ensure that types are only in the interface qname
-
wsdlDefinitions.getWsdlTypes().setNamespace(epMetaData.getInterfaceQName().getNamespaceURI());
+
wsdlDefinitions.getWsdlTypes().setNamespace(epMetaData.getPortTypeName().getNamespaceURI());
final File tmpdir = IOUtils.createTempDirectory();
File wsdlTmpFile = File.createTempFile(serviceName, ".wsdl",
tmpdir);
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -36,12 +36,13 @@
*/
public class ClientEndpointMetaData extends EndpointMetaData
{
- public ClientEndpointMetaData(ServiceMetaData service, QName qname, QName
interfaceQName, Type type)
+ public ClientEndpointMetaData(ServiceMetaData service, QName qname, QName
portTypeName, Type type)
{
- super(service, qname, interfaceQName, type);
+ super(service, qname, portTypeName, type);
}
- public String getConfigName() {
+ public String getConfigName()
+ {
String configName = super.getConfigName();
if (configName == null)
{
@@ -51,7 +52,8 @@
return configName;
}
- public String getConfigFile() {
+ public String getConfigFile()
+ {
String configFile = super.getConfigFile();
if (configFile == null)
{
@@ -72,22 +74,22 @@
{
StringBuilder buffer = new StringBuilder("\nClientEndpointMetaData:");
buffer.append("\n type=").append(getType());
- buffer.append("\n qname=").append(getQName());
- buffer.append("\n address=" ).append(getEndpointAddress());
- buffer.append("\n binding=" ).append( getBindingId());
- buffer.append("\n seiName=" ).append(
getServiceEndpointInterfaceName());
- buffer.append("\n configFile=" ).append( getConfigFile());
- buffer.append("\n configName=" ).append( getConfigName());
- buffer.append("\n authMethod=" ).append( getAuthMethod());
- buffer.append("\n properties=" ).append( getProperties());
+ buffer.append("\n qname=").append(getPortName());
+ buffer.append("\n address=").append(getEndpointAddress());
+ buffer.append("\n binding=").append(getBindingId());
+ buffer.append("\n seiName=").append(getServiceEndpointInterfaceName());
+ buffer.append("\n configFile=").append(getConfigFile());
+ buffer.append("\n configName=").append(getConfigName());
+ buffer.append("\n authMethod=").append(getAuthMethod());
+ buffer.append("\n properties=").append(getProperties());
for (OperationMetaData opMetaData : getOperations())
{
- buffer.append("\n" ).append( opMetaData);
+ buffer.append("\n").append(opMetaData);
}
for (HandlerMetaData hdlMetaData : getHandlerMetaData(HandlerType.ALL))
{
- buffer.append("\n" ).append( hdlMetaData);
+ buffer.append("\n").append(hdlMetaData);
}
return buffer.toString();
}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -81,7 +81,7 @@
// The REQUIRED binding id
private String bindingId;
// The REQUIRED name of the WSDL interface/portType
- private QName interfaceQName;
+ private QName portTypeName;
// The REQUIRED config-name
private String configName;
// The REQUIRED config-file
@@ -117,11 +117,11 @@
private ConfigObservable configObservable = new ConfigObservable();
- public EndpointMetaData(ServiceMetaData service, QName qname, QName interfaceQName,
Type type)
+ public EndpointMetaData(ServiceMetaData service, QName portName, QName portTypeName,
Type type)
{
this.serviceMetaData = service;
- this.portName = qname;
- this.interfaceQName = interfaceQName;
+ this.portName = portName;
+ this.portTypeName = portTypeName;
this.type = type;
// The default binding
@@ -133,14 +133,14 @@
return serviceMetaData;
}
- public QName getQName()
+ public QName getPortName()
{
return portName;
}
- public QName getInterfaceQName()
+ public QName getPortTypeName()
{
- return interfaceQName;
+ return portTypeName;
}
public String getEndpointAddress()
@@ -595,7 +595,7 @@
{
CommonBindingProvider provider = (CommonBindingProvider)configurable;
((CommonSOAPBinding)provider.getCommonBinding()).setMTOMEnabled(true);
- log.debug("Enable MTOM on endpoint " + this.getQName());
+ log.debug("Enable MTOM on endpoint " + this.getPortName());
}
}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServerEndpointMetaData.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -63,9 +63,9 @@
// The bean that registers with the ServiceEndpointManager
private String managedEndpointBean =
"org.jboss.ws.core.server.ServiceEndpoint";
- public ServerEndpointMetaData(ServiceMetaData service, QName qname, QName
interfaceQName, Type type)
+ public ServerEndpointMetaData(ServiceMetaData service, QName portName, QName
portTypeName, Type type)
{
- super(service, qname, interfaceQName, type);
+ super(service, portName, portTypeName, type);
}
public String getLinkName()
@@ -206,7 +206,7 @@
{
StringBuilder buffer = new StringBuilder("\nServerEndpointMetaData:");
buffer.append("\n type=").append(getType());
- buffer.append("\n qname=").append(getQName());
+ buffer.append("\n qname=").append(getPortName());
buffer.append("\n
id=").append(getServiceEndpointID().getCanonicalName());
buffer.append("\n address=").append(getEndpointAddress());
buffer.append("\n binding=").append(getBindingId());
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -185,7 +185,7 @@
public void addEndpoint(EndpointMetaData epMetaData)
{
- QName portName = epMetaData.getQName();
+ QName portName = epMetaData.getPortName();
// This happends when we have multiple port components in sharing the same wsdl
port
// The EndpointMetaData name is the wsdl port, so we cannot have multiple meta data
for the same port.
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -183,7 +183,7 @@
serviceMapping.setServiceInterface(serviceInterfaceName);
serviceMapping.setWsdlServiceName(serviceQName);
- String endpointName = endpoint.getQName().getLocalPart();
+ String endpointName = endpoint.getPortName().getLocalPart();
PortMapping portMapping = new PortMapping(serviceMapping);
portMapping.setJavaPortName(endpointName);
portMapping.setPortName(endpointName);
@@ -191,7 +191,7 @@
javaWsdlMapping.addServiceInterfaceMappings(serviceMapping);
- String interfaceName = endpoint.getInterfaceQName().getLocalPart();
+ String interfaceName = endpoint.getPortTypeName().getLocalPart();
ServiceEndpointInterfaceMapping seiMapping = new
ServiceEndpointInterfaceMapping(javaWsdlMapping);
seiMapping.setServiceEndpointInterface(endpoint.getServiceEndpointInterfaceName());
seiMapping.setWsdlPortType(new QName(wsdl.getTargetNamespace(), interfaceName,
"portTypeNS"));
Modified: trunk/jbossws-core/src/main/java/org/jboss/ws/tools/jaxws/WSDLGenerator.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/jaxws/WSDLGenerator.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/jaxws/WSDLGenerator.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -70,14 +70,14 @@
protected void processEndpoint(WSDLService service, EndpointMetaData endpoint)
{
WSDLEndpoint wsdlEndpoint = new WSDLEndpoint(service);
- wsdlEndpoint.setQName(endpoint.getQName());
- wsdlEndpoint.setName(new NCName(endpoint.getQName().getLocalPart()));
+ wsdlEndpoint.setQName(endpoint.getPortName());
+ wsdlEndpoint.setName(new NCName(endpoint.getPortName().getLocalPart()));
String address = endpoint.getEndpointAddress();
wsdlEndpoint.setAddress(address == null ? "REPLACE_WITH_ACTUAL_URL" :
address);
service.addEndpoint(wsdlEndpoint);
WSDLInterface wsdlInterface = new WSDLInterface(wsdl);
- QName interfaceQName = endpoint.getInterfaceQName();
+ QName interfaceQName = endpoint.getPortTypeName();
wsdlInterface.setQName(interfaceQName);
wsdlInterface.setName(new NCName(interfaceQName));
wsdl.addInterface(wsdlInterface);
@@ -325,7 +325,7 @@
if (endpoint == null)
throw new IllegalStateException("A service must have an endpoint");
- wsdlService.setInterfaceName(endpoint.getQName());
+ wsdlService.setInterfaceName(endpoint.getPortName());
}
/**
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -68,7 +68,7 @@
{
this.seiClass = tmd.getServiceEndpointInterface();
checkServiceEndpointInterface();
- this.targetNamespace = tmd.getQName().getNamespaceURI();
+ this.targetNamespace = tmd.getPortName().getNamespaceURI();
this.tmd = tmd;
}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -37,8 +37,8 @@
{
public String typeNamespace;
- public ToolsEndpointMetaData(ServiceMetaData service, QName name, QName
interfaceQName)
+ public ToolsEndpointMetaData(ServiceMetaData service, QName portName, QName
portTypeName)
{
- super(service, name, interfaceQName, Type.JAXRPC);
+ super(service, portName, portTypeName, Type.JAXRPC);
}
}
\ No newline at end of file
Modified:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/provider/ProviderJAXBTestCase.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/provider/ProviderJAXBTestCase.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/provider/ProviderJAXBTestCase.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -40,6 +40,7 @@
import javax.xml.ws.Dispatch;
import javax.xml.ws.Service;
import javax.xml.ws.Service.Mode;
+import javax.xml.ws.soap.SOAPBinding;
import junit.framework.Test;
@@ -104,7 +105,9 @@
QName portName = new QName(targetNS, "ProviderPort");
URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-provider-jaxb/" + target + "?wsdl");
- Service service = Service.create(wsdlURL, serviceName);
+ Service service = Service.create(serviceName);
+ service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
wsdlURL.toExternalForm());
+
JAXBContext jbc = JAXBContext.newInstance(new Class[] { UserType.class });
Dispatch<Object> dispatch = service.createDispatch(portName, jbc,
Mode.PAYLOAD);
return dispatch;
Modified:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/provider/ProviderMessageTestCase.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/provider/ProviderMessageTestCase.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/provider/ProviderMessageTestCase.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -24,18 +24,28 @@
// $Id$
import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
import java.net.URL;
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.Service.Mode;
+import javax.xml.ws.soap.SOAPBinding;
import junit.framework.Test;
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
@@ -47,6 +57,14 @@
*/
public class ProviderMessageTestCase extends JBossWSTest
{
+ private String msgString =
+ "<env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
+ " <env:Header/>" +
+ " <env:Body>" +
+ " <ns1:somePayload
xmlns:ns1='http://org.jboss.ws/provider'/>" +
+ " </env:Body>" +
+ "</env:Envelope>";
+
public static Test suite()
{
return JBossWSTestSetup.newTestSetup(ProviderMessageTestCase.class,
"jaxws-provider-message.war");
@@ -60,25 +78,48 @@
assertNotNull(wsdlDefinitions);
}
+ public void testProviderDispatch() throws Exception
+ {
+ Dispatch<SOAPMessage> dispatch =
createDispatch("ProviderEndpoint");
+ SOAPMessage reqMsg = getRequestMessage();
+
+ SOAPMessage resMsg = dispatch.invoke(reqMsg);
+ SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();
+
+ assertEquals(DOMUtils.parse(msgString), resEnv);
+ }
+
+ private Dispatch<SOAPMessage> createDispatch(String target) throws
MalformedURLException, JAXBException
+ {
+ String targetNS = "http://org.jboss.ws/provider";
+ QName serviceName = new QName(targetNS, "ProviderService");
+ QName portName = new QName(targetNS, "ProviderPort");
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-provider-message/" + target + "?wsdl");
+
+ Service service = Service.create(serviceName);
+ service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
wsdlURL.toExternalForm());
+
+ Dispatch<SOAPMessage> dispatch = service.createDispatch(portName,
SOAPMessage.class, Mode.MESSAGE);
+ return dispatch;
+ }
+
public void testProviderMessage() throws Exception
{
- String msgString =
- "<env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
- " <env:Header/>" +
- " <env:Body>" +
- " <ns1:somePayload
xmlns:ns1='http://org.jboss.ws/provider'/>" +
- " </env:Body>" +
- "</env:Envelope>";
-
- MessageFactory msgFactory = MessageFactory.newInstance();
- SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
- SOAPMessage reqMsg = msgFactory.createMessage(null, new
ByteArrayInputStream(msgString.getBytes()));
+ SOAPMessage reqMsg = getRequestMessage();
SOAPEnvelope reqEnv = reqMsg.getSOAPPart().getEnvelope();
URL epURL = new URL("http://" + getServerHost() +
":8080/jaxws-provider-message");
+ SOAPConnection con = SOAPConnectionFactory.newInstance().createConnection();
SOAPMessage resMsg = con.call(reqMsg, epURL);
SOAPEnvelope resEnv = resMsg.getSOAPPart().getEnvelope();
assertEquals(reqEnv, resEnv);
}
+
+ private SOAPMessage getRequestMessage() throws SOAPException, IOException
+ {
+ MessageFactory msgFactory = MessageFactory.newInstance();
+ SOAPMessage reqMsg = msgFactory.createMessage(null, new
ByteArrayInputStream(msgString.getBytes()));
+ return reqMsg;
+ }
}
Modified:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/provider/ProviderPayloadTestCase.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/provider/ProviderPayloadTestCase.java 2007-01-16
11:33:23 UTC (rev 1979)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxws/provider/ProviderPayloadTestCase.java 2007-01-16
12:18:26 UTC (rev 1980)
@@ -24,20 +24,33 @@
// $Id$
import java.io.ByteArrayInputStream;
+import java.net.MalformedURLException;
import java.net.URL;
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.Service.Mode;
+import javax.xml.ws.soap.SOAPBinding;
import junit.framework.Test;
import org.jboss.test.ws.JBossWSTest;
import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.w3c.dom.Document;
/**
* Test a Provider<SOAPMessage>
@@ -47,6 +60,9 @@
*/
public class ProviderPayloadTestCase extends JBossWSTest
{
+ private String msgString =
+ "<ns1:somePayload
xmlns:ns1='http://org.jboss.ws/provider'/>";
+
public static Test suite()
{
return JBossWSTestSetup.newTestSetup(ProviderPayloadTestCase.class,
"jaxws-provider-payload.war");
@@ -60,11 +76,37 @@
assertNotNull(wsdlDefinitions);
}
+ public void testProviderDispatch() throws Exception
+ {
+ Dispatch<Source> dispatch = createDispatch("ProviderEndpoint");
+ Source resPayload = dispatch.invoke(new DOMSource(DOMUtils.parse(msgString)));
+
+ DOMResult domResult = new DOMResult();
+ TransformerFactory tf = TransformerFactory.newInstance();
+ tf.newTransformer().transform(resPayload, domResult);
+
+ Document doc = (Document)domResult.getNode();
+ assertEquals(DOMUtils.parse(msgString), doc.getDocumentElement());
+ }
+
+ private Dispatch<Source> createDispatch(String target) throws
MalformedURLException, JAXBException
+ {
+ String targetNS = "http://org.jboss.ws/provider";
+ QName serviceName = new QName(targetNS, "ProviderService");
+ QName portName = new QName(targetNS, "ProviderPort");
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-provider-payload/" + target + "?wsdl");
+
+ Service service = Service.create(serviceName);
+ service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING,
wsdlURL.toExternalForm());
+
+ Dispatch<Source> dispatch = service.createDispatch(portName, Source.class,
Mode.PAYLOAD);
+ return dispatch;
+ }
+
public void testProviderMessage() throws Exception
{
String reqString =
"<env:Envelope
xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>" +
- " <env:Header/>" +
" <env:Body>" +
" <ns1:somePayload
xmlns:ns1='http://org.jboss.ws/provider'/>" +
" </env:Body>" +