Author: heiko.braun(a)jboss.com
Date: 2007-01-15 11:31:58 -0500 (Mon, 15 Jan 2007)
New Revision: 1971
Added:
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/DispatchException.java
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/EventingUtils.java
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/Constants.java
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/deployment/EventingEndpoint.java
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/deployment/EventingEndpointDI.java
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/metadata/EventingEpMetaExt.java
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/mgmt/EventSource.java
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/mgmt/EventingBuilder.java
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/mgmt/SubscriptionManager.java
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/mgmt/SubscriptionManagerMBean.java
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
trunk/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/wseventing/SubscriptionManagerTestCase.java
trunk/jbossws-tests/src/main/resources/jaxrpc/wseventing/WEB-INF/wsdl/wind.wsdl
Log:
Fix JBWS-1388. Thanks to Allessio Soldano for the contribution
Modified: trunk/jbossws-core/src/main/java/org/jboss/ws/Constants.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/ws/Constants.java 2007-01-15 15:25:51 UTC
(rev 1970)
+++ trunk/jbossws-core/src/main/java/org/jboss/ws/Constants.java 2007-01-15 16:31:58 UTC
(rev 1971)
@@ -100,7 +100,15 @@
static final String URI_LITERAL_ENC = "";
/** WSDL 2.0 Encoding Rules */
static final String URI_STYLE_RPC =
"http://www.w3.org/2004/03/wsdl/style/rpc";
- static final String URI_STYLE_DOCUMENT =
"http://www.w3.org/2004/03/wsdl/style/iri";
+
+ static final String URI_STYLE_DOCUMENT =
"http://www.w3.org/2004/03/wsdl/style/iri";
+
+ /** WS-Eventing namespace uri **/
+ static final String URI_WS_EVENTING =
"http://schemas.xmlsoap.org/ws/2004/08/eventing";
+
+ /** WS-Addressing namespace uri **/
+ static final String URI_WS_ADDRESSING =
"http://www.w3.org/2005/08/addressing";
+
/**Style of WSDL */
static final String RPC_LITERAL = "RPC/Literal";
static final String DOCUMENT_LITERAL = "Document/Literal";
@@ -272,9 +280,10 @@
/** Indicates that an output is a return parameter */
static final String WSDL_PROPERTY_RETURN_PART =
"http://www.jboss.org/jbossws/return-part";
- static final QName WSDL_ATTRIBUTE_WSA_ACTION = new
QName("http://www.w3.org/2005/08/addressing", "Action");
+ static final QName WSDL_ATTRIBUTE_WSA_ACTION = new QName(URI_WS_ADDRESSING,
"Action");
- static final QName WSDL_ATTRIBUTE_WSE_EVENTSOURCE = new
QName("http://schemas.xmlsoap.org/ws/2004/08/eventing",
"EventSource");
+ static final QName WSDL_ATTRIBUTE_WSE_EVENTSOURCE = new QName(URI_WS_EVENTING,
"EventSource");
+
/** WSDL-2.0 exchange patterns */
static final String WSDL20_PATTERN_IN_ONLY =
"http://www.w3.org/2004/08/wsdl/in-only";
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java 2007-01-15
15:25:51 UTC (rev 1970)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/core/server/WSDLRequestHandler.java 2007-01-15
16:31:58 UTC (rev 1971)
@@ -111,7 +111,7 @@
Element childElement = (Element)childNode;
String nodeName = childElement.getLocalName();
- // Replace xsd:import location attributes
+ // Replace xsd:import and xsd:include location attributes
if ("import".equals(nodeName) ||
"include".equals(nodeName))
{
Attr locationAttr =
childElement.getAttributeNode("schemaLocation");
@@ -132,7 +132,7 @@
String reqPath = reqURL.getPath();
String completeHost = wsdlHost;
- if (! wsdlHost.startsWith("http://") &&
wsdlHost.startsWith("https://"))
+ if (! (wsdlHost.startsWith("http://") ||
wsdlHost.startsWith("https://")) )
{
String reqProtocol = reqURL.getProtocol();
int reqPort = reqURL.getPort();
@@ -141,6 +141,8 @@
}
String newLocation = completeHost + reqPath +
"?wsdl&resource=" + newResourcePath;
+ locationAttr.setNodeValue(newLocation);
+
log.debug("Mapping import from '" + orgLocation +
"' to '" + newLocation + "'");
}
}
@@ -161,7 +163,7 @@
if (reqURL.getProtocol().equals(locProtocol) &&
reqURL.getPath().equals(locPath))
{
String completeHost = wsdlHost;
- if (!completeHost.startsWith("http://") ||
!completeHost.startsWith("https://"))
+ if (! (completeHost.startsWith("http://") ||
completeHost.startsWith("https://")) )
{
int locPort = locURL.getPort();
String hostAndPort = wsdlHost + (locPort > 0 ? ":" +
locPort : "");
Added:
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/DispatchException.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/DispatchException.java 2007-01-15
15:25:51 UTC (rev 1970)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/DispatchException.java 2007-01-15
16:31:58 UTC (rev 1971)
@@ -0,0 +1,36 @@
+/*
+ * 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.extensions.eventing;
+
+
+import org.jboss.ws.WSException;
+
+public class DispatchException extends WSException {
+
+ public DispatchException() {
+ super();
+ }
+
+ public DispatchException(String message) {
+ super(message);
+ }
+}
\ No newline at end of file
Added:
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/EventingUtils.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/EventingUtils.java 2007-01-15
15:25:51 UTC (rev 1970)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/EventingUtils.java 2007-01-15
16:31:58 UTC (rev 1971)
@@ -0,0 +1,66 @@
+/*
+ * 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.extensions.eventing;
+
+import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
+import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSNamespaceItem;
+import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSStringList;
+import org.jboss.ws.Constants;
+
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Iterator;
+
+/**
+ * @author Heiko.Braun(a)jboss.org
+ * @version $Id$
+ * @since 15.01.2007
+ */
+public class EventingUtils {
+
+ public static String[] extractNotificationSchema(JBossXSModel schemaModel) {
+
+ List<String> list =
((JBossXSStringList)schemaModel.getNamespaces()).toList();
+ List<String> schemas = new LinkedList<String>();
+
+ for (Iterator it = list.iterator(); it.hasNext(); )
+ {
+
+ String ns = (String)it.next();
+
+ if (!Constants.URI_SOAP11_ENC.equalsIgnoreCase(ns) &&
+ !Constants.NS_SCHEMA_XSI.equalsIgnoreCase(ns) &&
+ !Constants.NS_SCHEMA_XSD.equalsIgnoreCase(ns) &&
+ !Constants.URI_WS_EVENTING.equalsIgnoreCase(ns) &&
+ !Constants.URI_WS_ADDRESSING.equalsIgnoreCase(ns))
+ {
+ JBossXSNamespaceItem item = schemaModel.getNamespaceItem(ns);
+ boolean qElem = item.isQualifiedElements();
+ item.setQualifiedElements(true);
+ schemas.add(item.toString());
+ item.setQualifiedElements(qElem);
+ }
+ }
+
+ return schemas.toArray(new String[schemas.size()]);
+ }
+}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/deployment/EventingEndpoint.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/deployment/EventingEndpoint.java 2007-01-15
15:25:51 UTC (rev 1970)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/deployment/EventingEndpoint.java 2007-01-15
16:31:58 UTC (rev 1971)
@@ -44,7 +44,7 @@
// See also
http://jira.jboss.org/jira/browse/JBWS-770
// create pending incomplete event source
- EventingEndpointDI desc = new EventingEndpointDI(ext.getEventSourceNS(),
ext.getNotificationSchema());
+ EventingEndpointDI desc = new EventingEndpointDI(ext.getEventSourceNS(),
ext.getNotificationSchema(), ext.getNotificationRootElementNS());
desc.setEndpointAddress(epMetaData.getEndpointAddress());
desc.setPortName(epMetaData.getPortComponentName());
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/deployment/EventingEndpointDI.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/deployment/EventingEndpointDI.java 2007-01-15
15:25:51 UTC (rev 1970)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/deployment/EventingEndpointDI.java 2007-01-15
16:31:58 UTC (rev 1971)
@@ -1,10 +1,5 @@
package org.jboss.ws.extensions.eventing.deployment;
-import java.io.IOException;
-
-import org.jboss.ws.core.utils.DOMUtils;
-import org.w3c.dom.Element;
-
/**
* Eventsource endpoint deployment info.
*
@@ -16,19 +11,20 @@
/* event source URI */
private String name;
- /* notification schema */
- private Object schema;
-
- private Element schemaElement;
-
private String portName;
// event source endpoint address
private String endpointAddress;
- public EventingEndpointDI(String name, Object schema) {
+ /* notification schema */
+ private String[] schema;
+
+ private String notificationRootElementNS;
+
+ public EventingEndpointDI(String name, String[] schema, String
notificationRootElementNS) {
this.name = name;
this.schema = schema;
+ this.notificationRootElementNS = notificationRootElementNS;
}
public String getPortName() {
@@ -43,7 +39,7 @@
return name;
}
- public Object getSchema() {
+ public String[] getSchema() {
return schema;
}
@@ -55,18 +51,12 @@
this.endpointAddress = endpointAddress;
}
- Element getSchemaElement() {
- try
- {
- if(null == this.schemaElement)
- this.schemaElement = DOMUtils.parse((String)getSchema());
- }
- catch (IOException e)
- {
- throw new IllegalArgumentException("Failed to parse notification
schema:" +e.getMessage());
- }
+ public String getNotificationRootElementNS() {
+ return notificationRootElementNS;
+ }
- return this.schemaElement;
+ public void setNotificationRootElementNS(String notificationRootElementNS) {
+ this.notificationRootElementNS = notificationRootElementNS;
}
}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/metadata/EventingEpMetaExt.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/metadata/EventingEpMetaExt.java 2007-01-15
15:25:51 UTC (rev 1970)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/metadata/EventingEpMetaExt.java 2007-01-15
16:31:58 UTC (rev 1971)
@@ -15,8 +15,10 @@
private boolean isEventSource = true;
private String eventSourceNS;
- private Object notificationSchema;
+ private String[] notificationSchema;
+ private String notificationRootElementNS;
+
public EventingEpMetaExt(String extensionNameSpace) {
super(extensionNameSpace);
}
@@ -48,12 +50,20 @@
throw new IllegalArgumentException("Illegal event source URI: " +
eventSourceNS);
}
}
-
- public Object getNotificationSchema() {
- return notificationSchema;
+
+ public String[] getNotificationSchema() {
+ return this.notificationSchema;
}
- public void setNotificationSchema(Object notificationSchema) {
+ public void setNotificationSchema(String[] notificationSchema) {
this.notificationSchema = notificationSchema;
}
+
+ public String getNotificationRootElementNS() {
+ return notificationRootElementNS;
+ }
+
+ public void setNotificationRootElementNS(String notificationRootElementNS) {
+ this.notificationRootElementNS = notificationRootElementNS;
+ }
}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/mgmt/EventSource.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/mgmt/EventSource.java 2007-01-15
15:25:51 UTC (rev 1970)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/mgmt/EventSource.java 2007-01-15
16:31:58 UTC (rev 1971)
@@ -44,22 +44,25 @@
private String name;
private URI nameSpace;
- private String notificationSchema;
private URI managerAddress;
private List<URI> supportedFilter = new ArrayList<URI>();
+ private String[] notificationSchema;
+ private String notificationRootElementNS;
+
public EventSource(String name, URI nameSpace) {
this.name = name;
this.nameSpace = nameSpace;
this.state = State.CREATED;
}
- public EventSource(String name, URI nameSpace, String schema)
+ public EventSource(String name, URI nameSpace, String[] schema, String
notificationRootElementNS)
{
this.name = name;
this.nameSpace = nameSpace;
this.notificationSchema = schema;
+ this.notificationRootElementNS = notificationRootElementNS;
this.state = State.CREATED;
}
@@ -97,7 +100,7 @@
return supportedFilter;
}
- public String getNotificationSchema() {
+ public String[] getNotificationSchema() {
return notificationSchema;
}
@@ -113,6 +116,10 @@
return managerAddress;
}
+ public String getNotificationRootElementNS() {
+ return notificationRootElementNS;
+ }
+
public void setManagerAddress(String managerAddress) {
try
{
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/mgmt/EventingBuilder.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/mgmt/EventingBuilder.java 2007-01-15
15:25:51 UTC (rev 1970)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/mgmt/EventingBuilder.java 2007-01-15
16:31:58 UTC (rev 1971)
@@ -22,7 +22,7 @@
public EventSource newEventSource(EventingEndpointDI desc) {
URI eventSourceNS = newEventSourceURI(desc.getName());
- EventSource eventSource = new EventSource(desc.getName(), eventSourceNS,
(String)desc.getSchema());
+ EventSource eventSource = new EventSource(desc.getName(), eventSourceNS,
desc.getSchema(), desc.getNotificationRootElementNS());
eventSource.getSupportedFilterDialects().add(EventingConstants.getDefaultFilterDialect());
return eventSource;
}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/mgmt/SubscriptionManager.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/mgmt/SubscriptionManager.java 2007-01-15
15:25:51 UTC (rev 1970)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/mgmt/SubscriptionManager.java 2007-01-15
16:31:58 UTC (rev 1971)
@@ -25,6 +25,7 @@
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.io.StringReader;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
@@ -43,18 +44,27 @@
import javax.management.ObjectName;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.DocumentBuilder;
import org.jboss.logging.Logger;
import org.jboss.util.naming.Util;
import org.jboss.ws.WSException;
import org.jboss.ws.core.utils.ObjectNameFactory;
import org.jboss.ws.core.utils.UUIDGenerator;
+import org.jboss.ws.core.utils.DOMUtils;
+import org.jboss.ws.core.utils.DOMWriter;
import org.jboss.ws.extensions.eventing.EventingConstants;
+import org.jboss.ws.extensions.eventing.DispatchException;
import org.jboss.ws.extensions.eventing.deployment.EventingEndpointDI;
import org.jboss.ws.extensions.eventing.element.EndpointReference;
import org.jboss.ws.extensions.eventing.element.ReferenceParameters;
import org.jboss.ws.extensions.eventing.element.NotificationFailure;
import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.SAXException;
+import org.apache.xml.utils.DefaultErrorHandler;
/**
* The SubscriptionManager maintains event sources and subscriptions.<br>
@@ -87,7 +97,7 @@
private static final Logger log = Logger.getLogger(SubscriptionManager.class);
public static final ObjectName OBJECT_NAME =
ObjectNameFactory.create("jboss.ws:service=SubscriptionManager,module=eventing");
-
+
/**
* Maps event source namespaces to event source instances.
*/
@@ -124,6 +134,11 @@
*/
private List<NotificationFailure> notificationFailures = new
ArrayList<NotificationFailure>();
+ /**
+ * True force validation of every notification message against its schema
+ */
+ private boolean validateNotifications = false;
+
public void create() throws Exception
{
MBeanServer server = getJMXServer();
@@ -147,31 +162,31 @@
public void start() throws Exception
{
log.debug("Start subscription manager");
-
+
// setup thread pool
threadPool = new ThreadPoolExecutor(5, 15, // core/max num threads
- 5000, TimeUnit.MILLISECONDS, // 5 seconds keepalive
- eventQueue);
+ 5000, TimeUnit.MILLISECONDS, // 5 seconds keepalive
+ eventQueue);
// start the subscription watchdog
watchDog = new WatchDog(subscriptionMapping);
watchDog.startup();
}
- public void stop()
+ public void stop()
{
log.debug("Stop subscription manager");
try
{
// remove event dispatcher
Util.unbind(new InitialContext(), EventingConstants.DISPATCHER_JNDI_NAME);
-
+
// stop thread pool
threadPool.shutdown();
-
+
// stop the watchdog
watchDog.shutdown();
-
+
for (URI eventSourceNS : eventSourceMapping.keySet())
{
removeEventSource(eventSourceNS);
@@ -180,7 +195,7 @@
catch (NamingException e)
{
// ignore
- }
+ }
}
private static URI generateSubscriptionID()
@@ -462,6 +477,9 @@
public void dispatch(URI eventSourceNS, Element payload)
{
DispatchJob dispatchJob = new DispatchJob(eventSourceNS, payload,
subscriptionMapping);
+ if (validateNotifications &&
!this.validateMessage(DOMWriter.printNode(payload,false),eventSourceNS)) {
+ throw new DispatchException("Notification message validation
failed!");
+ }
threadPool.execute(dispatchJob);
}
@@ -475,6 +493,48 @@
return notificationFailures;
}
+ private boolean validateMessage(String msg, URI eventSourceNS) {
+ try
+ {
+ EventSource es = eventSourceMapping.get(eventSourceNS);
+ log.info(new StringBuffer("Validating message: \n\n").append(msg)
+ .append("\n\nagainst the following schema(s): \n").toString());
+ for (int i=0;i<es.getNotificationSchema().length;i++) {
+ log.info(es.getNotificationSchema()[i]);
+ }
+ Element rootElement = DOMUtils.parse(msg);
+ if
(!es.getNotificationRootElementNS().equalsIgnoreCase(rootElement.getNamespaceURI())) {
+ log.error("Root element expected namespace:
"+es.getNotificationRootElementNS());
+ return false;
+ }
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ factory.setValidating(true);
+
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schema...;,
"http://www.w3.org/2001/XMLSchema");
+
+ String[] notificationSchemas = es.getNotificationSchema();
+ InputSource[] is = new InputSource[notificationSchemas.length];
+ for (int i=0; i<notificationSchemas.length; i++) {
+ is[i] = new InputSource(new
StringReader(notificationSchemas[notificationSchemas.length-1-i]));
+ //is[i] = new InputSource(new StringReader(notificationSchemas[i]));
+ }
+
+
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schema...;,
is);
+ DocumentBuilder docBuilder = factory.newDocumentBuilder();
+ DefaultErrorHandler errorHandler = new Validator();
+ docBuilder.setErrorHandler(errorHandler);
+ docBuilder.parse(new InputSource(new StringReader(msg)));
+ log.info("Document validated!");
+ return true;
+ }
+ catch (Exception e) {
+ log.error(e);
+ log.info("Cannot validate and/or parse the document!");
+ return false;
+ }
+
+ }
+
// ----------------------------------------------------------------------
// MBean support
@@ -518,6 +578,25 @@
threadPool.setKeepAliveTime(millies, TimeUnit.MILLISECONDS);
}
+ public boolean isValidateNotifications() {
+ return this.validateNotifications;
+ }
+
+ public void setValidateNotifications(boolean validateNotifications) {
+ this.validateNotifications = validateNotifications;
+ }
+
+ private MBeanServer getJMXServer()
+ {
+ MBeanServer server = null;
+ ArrayList servers = MBeanServerFactory.findMBeanServer(null);
+ if (servers.size() > 0)
+ {
+ server = (MBeanServer)servers.get(0);
+ }
+ return server;
+ }
+
/**
* The watchdog maintains subscription expirations.
*/
@@ -574,14 +653,14 @@
}
- private MBeanServer getJMXServer()
- {
- MBeanServer server = null;
- ArrayList servers = MBeanServerFactory.findMBeanServer(null);
- if (servers.size() > 0)
- {
- server = (MBeanServer)servers.get(0);
+ private class Validator extends DefaultErrorHandler {
+ public void error(SAXParseException exception) throws SAXException {
+ throw new SAXException(exception);
}
- return server;
+ public void fatalError(SAXParseException exception) throws SAXException {
+ throw new SAXException(exception);
+ }
+ public void warning(SAXParseException exception) throws SAXException { }
}
+
}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/mgmt/SubscriptionManagerMBean.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/mgmt/SubscriptionManagerMBean.java 2007-01-15
15:25:51 UTC (rev 1970)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/eventing/mgmt/SubscriptionManagerMBean.java 2007-01-15
16:31:58 UTC (rev 1971)
@@ -104,4 +104,8 @@
public void addNotificationFailure(NotificationFailure failure);
public List<NotificationFailure> showNotificationFailures();
+
+ public boolean isValidateNotifications();
+
+ public void setValidateNotifications(boolean validateNotifications);
}
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java
===================================================================
---
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java 2007-01-15
15:25:51 UTC (rev 1970)
+++
trunk/jbossws-core/src/main/java/org/jboss/ws/metadata/builder/jaxrpc/JAXRPCMetaDataBuilder.java 2007-01-15
16:31:58 UTC (rev 1971)
@@ -48,6 +48,7 @@
import org.jboss.ws.extensions.addressing.AddressingPropertiesImpl;
import org.jboss.ws.extensions.addressing.metadata.AddressingOpMetaExt;
import org.jboss.ws.extensions.eventing.EventingConstants;
+import org.jboss.ws.extensions.eventing.EventingUtils;
import org.jboss.ws.extensions.eventing.deployment.EventingEndpoint;
import org.jboss.ws.extensions.eventing.metadata.EventingEpMetaExt;
import org.jboss.ws.extensions.xop.jaxrpc.XOPScanner;
@@ -97,7 +98,7 @@
* A meta data builder that is based on webservices.xml.
*
* @author Thomas.Diesler(a)jboss.org
- * @authoer <a href="mailto:jason.greene@jboss.org">Jason T.
Greene</a>
+ * @author <a href="mailto:jason.greene@jboss.org">Jason T.
Greene</a>
* @since 19-Oct-2005
*/
public abstract class JAXRPCMetaDataBuilder extends MetaDataBuilder
@@ -953,11 +954,31 @@
{
ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
String eventSourceNS = wsdlInterface.getQName().getNamespaceURI() +
"/" + wsdlInterface.getQName().getLocalPart();
- Object notificationSchema = null; // todo: resolve schema from operation
message
+ // extract the schema model
+ JBossXSModel schemaModel =
WSDLUtils.getSchemaModel(wsdlDefinitions.getWsdlTypes());
+ String[] notificationSchema =
EventingUtils.extractNotificationSchema(schemaModel);
+
+ // extract the root element NS
+ String notificationRootElementNS = null;
+ WSDLInterfaceOperation wsdlInterfaceOperation =
wsdlInterface.getOperations()[0];
+ if(wsdlInterfaceOperation.getOutputs().length > 0 )
+ {
+ WSDLInterfaceOperationOutput wsdlInterfaceOperationOutput =
wsdlInterfaceOperation.getOutputs()[0];
+ notificationRootElementNS =
wsdlInterfaceOperationOutput.getElement().getNamespaceURI();
+ }
+ else
+ {
+ // WSDL operation of an WSDL interface that is marked as an event source
+ // requires to carry an output message.
+ throw new WSException("Unable to resolve eventing root element NS. No
operation output found at "+
+ wsdlInterfaceOperation.getQName());
+ }
+
EventingEpMetaExt ext = new
EventingEpMetaExt(EventingConstants.NS_EVENTING);
ext.setEventSourceNS(eventSourceNS);
ext.setNotificationSchema(notificationSchema);
+ ext.setNotificationRootElementNS(notificationRootElementNS);
sepMetaData.addExtension(ext);
sepMetaData.setManagedEndpointBean(EventingEndpoint.class.getName());
Modified: trunk/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2007-01-15
15:25:51 UTC (rev 1970)
+++ trunk/jbossws-core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2007-01-15
16:31:58 UTC (rev 1971)
@@ -35,23 +35,7 @@
import java.util.List;
import java.util.Map;
-import javax.wsdl.Binding;
-import javax.wsdl.BindingInput;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.BindingOutput;
-import javax.wsdl.Definition;
-import javax.wsdl.Fault;
-import javax.wsdl.Import;
-import javax.wsdl.Input;
-import javax.wsdl.Message;
-import javax.wsdl.Operation;
-import javax.wsdl.Output;
-import javax.wsdl.Part;
-import javax.wsdl.Port;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.wsdl.Types;
-import javax.wsdl.WSDLException;
+import javax.wsdl.*;
import javax.wsdl.extensions.ExtensibilityElement;
import javax.wsdl.extensions.UnknownExtensibilityElement;
import javax.wsdl.extensions.mime.MIMEContent;
@@ -509,7 +493,12 @@
destOperation.setName(new NCName(srcOperation.getName()));
destOperation.setStyle(getOperationStyle(srcWsdl, srcPortType, srcOperation));
- processOperationInput(srcWsdl, srcOperation, destOperation, srcPortType);
+ if(srcOperation.getStyle()!=null
+ && false ==
OperationType.NOTIFICATION.equals(srcOperation.getStyle()))
+ {
+ processOperationInput(srcWsdl, srcOperation, destOperation, srcPortType);
+ }
+
processOperationOutput(srcWsdl, srcOperation, destOperation, srcPortType);
processOperationFaults(srcOperation, destOperation, destInterface);
@@ -612,8 +601,11 @@
Message srcMessage = srcOutput.getMessage();
if (srcMessage == null)
- throw new WSDLException(WSDLException.INVALID_WSDL, "Cannot find output
message on operation " + srcOperation.getName() + " on port type: "
- + srcPortType.getQName());
+ throw new WSDLException(
+ WSDLException.INVALID_WSDL,
+ "Cannot find output message on operation " + srcOperation.getName()
+
+ " on port type: "+ srcPortType.getQName()
+ );
log.trace("processOperationOutput: " + srcMessage.getQName());
Modified:
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/wseventing/SubscriptionManagerTestCase.java
===================================================================
---
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/wseventing/SubscriptionManagerTestCase.java 2007-01-15
15:25:51 UTC (rev 1970)
+++
trunk/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/wseventing/SubscriptionManagerTestCase.java 2007-01-15
16:31:58 UTC (rev 1971)
@@ -79,7 +79,7 @@
{
try
{
- EventingEndpointDI deploymentInfo = new
EventingEndpointDI("http://schemas.xmlsoap.org/ws/2004/08/eventing/W...;,
null);
+ EventingEndpointDI deploymentInfo = new
EventingEndpointDI("http://schemas.xmlsoap.org/ws/2004/08/eventing/W...;,
null, null);
deploymentInfo.setEndpointAddress("http://localhost:8080/jaxrpc-wseventing/manage");
deploymentInfo.setPortName("SubscriptionManagerPort");
Modified: trunk/jbossws-tests/src/main/resources/jaxrpc/wseventing/WEB-INF/wsdl/wind.wsdl
===================================================================
---
trunk/jbossws-tests/src/main/resources/jaxrpc/wseventing/WEB-INF/wsdl/wind.wsdl 2007-01-15
15:25:51 UTC (rev 1970)
+++
trunk/jbossws-tests/src/main/resources/jaxrpc/wseventing/WEB-INF/wsdl/wind.wsdl 2007-01-15
16:31:58 UTC (rev 1971)
@@ -2,7 +2,7 @@
<wsdl:definitions
targetNamespace="http://schemas.xmlsoap.org/ws/2004/08/eventing"
-
xmlns:tns="http://www.example.org/oceanwatch"
+
xmlns:tns="http://schemas.xmlsoap.org/ws/2004/08/eventing"
xmlns:wse='http://schemas.xmlsoap.org/ws/2004/08/eventing'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
xmlns:wsa10='http://www.w3.org/2005/08/addressing'
@@ -12,13 +12,9 @@
<wsdl:types>
<xs:schema
targetNamespace='http://schemas.xmlsoap.org/ws/2004/08/eventing'>
+
<xs:include schemaLocation='eventing.xsd'/>
- </xs:schema>
- <xs:schema
-
targetNamespace="http://www.example.org/oceanwatch"
- elementFormDefault="qualified"
- blockDefault="#all">
<xs:element name="WindReport">
<xs:complexType>
<xs:sequence>
@@ -34,6 +30,7 @@
</xs:sequence>
</xs:complexType>
</xs:element>
+
</xs:schema>
</wsdl:types>
@@ -72,7 +69,6 @@
<wsdl:part name='body' element='tns:WindReport'/>
</wsdl:message>
-
<wsdl:portType name='EventSource'>
<wsdl:operation name='SubscribeOp'>
<wsdl:input message='wse:SubscribeMsg'
wsa10:Action='http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscrib...
@@ -104,7 +100,7 @@
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="WarningsBinding" type="wse:Warnings">
+ <wsdl:binding name="WarningsBinding" type="tns:Warnings">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="WindOp">
<soap:operation soapAction=""/>