JBossWS SVN: r3540 - branches/ropalka/trunk.
by jbossws-commits@lists.jboss.org
Author: richard_opalka
Date: 2007-06-11 16:25:52 -0400 (Mon, 11 Jun 2007)
New Revision: 3540
Added:
branches/ropalka/trunk/trunk/
Log:
Creating WS-RM branch
Copied: branches/ropalka/trunk/trunk (from rev 3539, trunk)
18 years, 10 months
JBossWS SVN: r3539 - branches/ropalka.
by jbossws-commits@lists.jboss.org
Author: richard_opalka
Date: 2007-06-11 16:25:21 -0400 (Mon, 11 Jun 2007)
New Revision: 3539
Added:
branches/ropalka/tags/
Log:
creating directory structure
18 years, 10 months
JBossWS SVN: r3538 - branches/ropalka.
by jbossws-commits@lists.jboss.org
Author: richard_opalka
Date: 2007-06-11 16:24:58 -0400 (Mon, 11 Jun 2007)
New Revision: 3538
Added:
branches/ropalka/trunk/
Log:
creating directory structure
18 years, 10 months
JBossWS SVN: r3537 - branches.
by jbossws-commits@lists.jboss.org
Author: richard_opalka
Date: 2007-06-11 16:24:12 -0400 (Mon, 11 Jun 2007)
New Revision: 3537
Added:
branches/ropalka/
Log:
creating directory structure
18 years, 10 months
JBossWS SVN: r3536 - trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/soap.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-06-11 12:11:41 -0400 (Mon, 11 Jun 2007)
New Revision: 3536
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java
Log:
- Assert on required elements
- Additional docs and coments
Modified: trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java 2007-06-11 16:10:41 UTC (rev 3535)
+++ trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/soap/SOAPAddressingPropertiesImpl.java 2007-06-11 16:11:41 UTC (rev 3536)
@@ -23,28 +23,6 @@
//$Id$
-import java.lang.reflect.Array;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.SOAPElement;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPFactory;
-import javax.xml.soap.SOAPHeader;
-import javax.xml.soap.SOAPHeaderElement;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.addressing.AddressingConstants;
-import javax.xml.ws.addressing.AddressingException;
-import javax.xml.ws.addressing.ReferenceParameters;
-import javax.xml.ws.addressing.Relationship;
-import javax.xml.ws.addressing.soap.SOAPAddressingBuilder;
-import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
-
import org.jboss.util.NotImplementedException;
import org.jboss.ws.core.soap.NameImpl;
import org.jboss.ws.core.soap.SOAPFactoryImpl;
@@ -57,7 +35,23 @@
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
-/**
+import javax.xml.namespace.QName;
+import javax.xml.soap.*;
+import javax.xml.ws.addressing.AddressingConstants;
+import javax.xml.ws.addressing.AddressingException;
+import javax.xml.ws.addressing.ReferenceParameters;
+import javax.xml.ws.addressing.Relationship;
+import javax.xml.ws.addressing.soap.SOAPAddressingBuilder;
+import javax.xml.ws.addressing.soap.SOAPAddressingProperties;
+import java.lang.reflect.Array;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
* Subimplementation of <code>AddressingProperties</code> includes methods that
* read and write the Message Addressing Properties to a <code>SOAPMessage</code>.
* All individual properties must implement <code>SOAPAddressingElement</code>.
@@ -67,270 +61,308 @@
*/
public class SOAPAddressingPropertiesImpl extends AddressingPropertiesImpl implements SOAPAddressingProperties
{
- private static AddressingConstants ADDR = new AddressingConstantsImpl();
+ private static AddressingConstants ADDR = new AddressingConstantsImpl();
- private NamespaceRegistry nsRegistry = new NamespaceRegistry();
+ private NamespaceRegistry nsRegistry = new NamespaceRegistry();
- public void readHeaders(SOAPMessage message) throws AddressingException
- {
- try
- {
- SOAPHeader soapHeader = message.getSOAPHeader();
+ private String getRequiredHeaderContent(SOAPHeader soapHeader, QName qname)
+ {
+ Element element = DOMUtils.getFirstChildElement(soapHeader, qname);
+ if(null == element) throw new IllegalArgumentException("Required element "+qname+" is missing");
- SOAPAddressingBuilder builder = new SOAPAddressingBuilderImpl();
- AddressingConstants ADDR = builder.newAddressingConstants();
+ String value = DOMUtils.getTextContent(element);
+ if(null == value || value.equals("")) throw new IllegalArgumentException("Required element "+qname+" is missing");
+
+ return value;
+ }
- Element wsaAction = DOMUtils.getFirstChildElement(soapHeader, ADDR.getActionQName());
- if (wsaAction != null)
- {
- // Register wsa namespace
- nsRegistry.registerURI(ADDR.getNamespaceURI(), ADDR.getNamespacePrefix());
+ private String getOptionalHeaderContent(SOAPHeader soapHeader, QName qname)
+ {
+ Element element = DOMUtils.getFirstChildElement(soapHeader, ADDR.getMessageIDQName());
+ if (element != null)
+ {
+ return DOMUtils.getTextContent(element);
+ }
- // Register namespaces
- NamedNodeMap attribs = soapHeader.getAttributes();
- for (int i = 0; i < attribs.getLength(); i++)
- {
- Attr attr = (Attr)attribs.item(i);
- String attrName = attr.getName();
- String attrValue = attr.getValue();
- if (attrName.startsWith("xmlns:"))
- {
- String prefix = attrName.substring(6);
- nsRegistry.registerURI(attrValue, prefix);
- }
- }
+ return null;
+ }
+
+ public void readHeaders(SOAPMessage message) throws AddressingException
+ {
+ try
+ {
+ SOAPHeader soapHeader = message.getSOAPHeader();
- // Read wsa:To
- Element wsaTo = DOMUtils.getFirstChildElement(soapHeader, ADDR.getToQName());
- if (wsaTo != null)
- {
- String to = DOMUtils.getTextContent(wsaTo);
- setTo(builder.newURI(to));
- }
+ SOAPAddressingBuilder builder = new SOAPAddressingBuilderImpl();
+ AddressingConstants ADDR = builder.newAddressingConstants();
+ registerNamespaces(ADDR, soapHeader);
+
+ // required elements
+ String action = getRequiredHeaderContent(soapHeader, ADDR.getActionQName());
+ String to = getRequiredHeaderContent(soapHeader, ADDR.getToQName());
- // Read wsa:From
- Element wsaFrom = DOMUtils.getFirstChildElement(soapHeader, ADDR.getFromQName());
- if (wsaFrom != null)
- {
- EndpointReferenceImpl ref = new EndpointReferenceImpl(wsaFrom);
- setReplyTo(ref);
- }
+ // wsa:Action
+ // This REQUIRED element of type xs:anyURI conveys the [action] property.
+ // The [children] of this element convey the value of this property.
+ setAction(builder.newURI(action));
- // Read wsa:ReplyTo
- Element wsaReplyTo = DOMUtils.getFirstChildElement(soapHeader, ADDR.getReplyToQName());
- if (wsaReplyTo != null)
- {
- EndpointReferenceImpl ref = new EndpointReferenceImpl(wsaReplyTo);
- setReplyTo(ref);
- }
+ // wsa:To
+ // This REQUIRED element (of type xs:anyURI) provides the value for the [destination] property.
+ setTo(builder.newURI(to));
- // Read wsa:FaultTo
- Element wsaFaultTo = DOMUtils.getFirstChildElement(soapHeader, ADDR.getFaultToQName());
- if (wsaFaultTo != null)
- {
- EndpointReferenceImpl ref = new EndpointReferenceImpl(wsaFaultTo);
- setFaultTo(ref);
- }
+ // Read wsa:From
+ // This OPTIONAL element (of type wsa:EndpointReferenceType) provides the value for the [source endpoint] property.
+ Element wsaFrom = DOMUtils.getFirstChildElement(soapHeader, ADDR.getFromQName());
+ if (wsaFrom != null)
+ {
+ EndpointReferenceImpl ref = new EndpointReferenceImpl(wsaFrom);
+ setReplyTo(ref);
+ }
- // Read wsa:Action
- String action = DOMUtils.getTextContent(wsaAction);
- setAction(builder.newURI(action));
+ // Read wsa:ReplyTo
+ // This OPTIONAL element (of type wsa:EndpointReferenceType) provides the value for the [reply endpoint] property.
+ // This element MUST be present if a reply is expected. If this element is present, wsa:MessageID MUST be present.
+ Element wsaReplyTo = DOMUtils.getFirstChildElement(soapHeader, ADDR.getReplyToQName());
+ if (wsaReplyTo != null)
+ {
+ EndpointReferenceImpl ref = new EndpointReferenceImpl(wsaReplyTo);
+ setReplyTo(ref);
+ }
+
+ // Read wsa:FaultTo
+ // This OPTIONAL element (of type wsa:EndpointReferenceType) provides the value for the [fault endpoint] property.
+ // If this element is present, wsa:MessageID MUST be present.
+ Element wsaFaultTo = DOMUtils.getFirstChildElement(soapHeader, ADDR.getFaultToQName());
+ if (wsaFaultTo != null)
+ {
+ EndpointReferenceImpl ref = new EndpointReferenceImpl(wsaFaultTo);
+ setFaultTo(ref);
+ }
- // Read wsa:MessageID
- Element wsaMessageId = DOMUtils.getFirstChildElement(soapHeader, ADDR.getMessageIDQName());
- if (wsaMessageId != null)
- {
- String messageID = DOMUtils.getTextContent(wsaMessageId);
- setMessageID(builder.newURI(messageID));
- }
+ // Read wsa:MessageID
+ // This OPTIONAL element conveys the [message id] property.
+ // This element MUST be present if wsa:ReplyTo or wsa:FaultTo is present.
+ if(wsaReplyTo!=null || wsaFaultTo!=null)
+ {
+ String msgIdValue = getRequiredHeaderContent(soapHeader, ADDR.getMessageIDQName());
+ setMessageID(builder.newURI(msgIdValue));
+ }
+ else
+ {
+ String messageID = getOptionalHeaderContent(soapHeader, ADDR.getMessageIDQName());
+ if(messageID!=null) setMessageID(builder.newURI(messageID));
+ }
+
+ // Read wsa:RelatesTo
+ // This OPTIONAL (repeating) element information item contributes one abstract [relationship] property value,
+ // in the form of a (URI, QName) pair.
+ // The [children] property of this element (which is of type xs:anyURI) conveys the [message id]
+ // of the related message. This element MUST be present if the message is a reply.
+ Iterator itRelatesTo = DOMUtils.getChildElements(soapHeader, ADDR.getRelatesToQName());
+ List<Relationship> relList = new ArrayList<Relationship>();
+ while (itRelatesTo.hasNext())
+ {
+ Element wsaRelatesTo = (Element)itRelatesTo.next();
+ QName type = DOMUtils.getAttributeValueAsQName(wsaRelatesTo, ADDR.getRelationshipTypeName());
+ String uri = DOMUtils.getTextContent(wsaRelatesTo);
+ Relationship rel = builder.newRelationship(new URI(uri));
+ rel.setType(type);
+ relList.add(rel);
+ }
+ Relationship[] relArr = (Relationship[])Array.newInstance(Relationship.class, relList.size());
+ relList.toArray(relArr);
+ setRelatesTo(relArr);
- // Read wsa:RelatesTo
- Iterator itRelatesTo = DOMUtils.getChildElements(soapHeader, ADDR.getRelatesToQName());
- List<Relationship> relList = new ArrayList<Relationship>();
- while (itRelatesTo.hasNext())
- {
- Element wsaRelatesTo = (Element)itRelatesTo.next();
- QName type = DOMUtils.getAttributeValueAsQName(wsaRelatesTo, ADDR.getRelationshipTypeName());
- String uri = DOMUtils.getTextContent(wsaRelatesTo);
- Relationship rel = builder.newRelationship(new URI(uri));
- rel.setType(type);
- relList.add(rel);
- }
- Relationship[] relArr = (Relationship[])Array.newInstance(Relationship.class, relList.size());
- relList.toArray(relArr);
- setRelatesTo(relArr);
- }
+ // Read wsa:ReferenceParameters
+ QName refQName = new QName(getNamespaceURI(), "IsReferenceParameter");
+ ReferenceParameters refParams = getReferenceParameters();
+ Iterator it = soapHeader.examineAllHeaderElements();
+ while (it.hasNext())
+ {
+ SOAPHeaderElement headerElement = (SOAPHeaderElement)it.next();
+ if ("true".equals(DOMUtils.getAttributeValue(headerElement, refQName)))
+ {
+ refParams.addElement(headerElement);
+ }
+ }
+ }
+ catch (SOAPException ex)
+ {
+ throw new AddressingException("Cannot read headers", ex);
+ }
+ catch (URISyntaxException ex)
+ {
+ throw new AddressingException("Cannot read headers", ex);
+ }
+ }
- // Read wsa:ReferenceParameters
- QName refQName = new QName(getNamespaceURI(), "IsReferenceParameter");
- ReferenceParameters refParams = getReferenceParameters();
- Iterator it = soapHeader.examineAllHeaderElements();
- while (it.hasNext())
- {
- SOAPHeaderElement headerElement = (SOAPHeaderElement)it.next();
- if ("true".equals(DOMUtils.getAttributeValue(headerElement, refQName)))
- {
- refParams.addElement(headerElement);
- }
- }
- }
- catch (SOAPException ex)
- {
- throw new AddressingException("Cannot read headers", ex);
- }
- catch (URISyntaxException ex)
- {
- throw new AddressingException("Cannot read headers", ex);
- }
- }
+ private void registerNamespaces(AddressingConstants ADDR, SOAPHeader soapHeader)
+ {
+ // Register wsa namespace
+ nsRegistry.registerURI(ADDR.getNamespaceURI(), ADDR.getNamespacePrefix());
- public void writeHeaders(SOAPMessage message) throws AddressingException
- {
- try
- {
- SOAPFactoryImpl factory = (SOAPFactoryImpl)SOAPFactory.newInstance();
+ // Register namespaces
+ NamedNodeMap attribs = soapHeader.getAttributes();
+ for (int i = 0; i < attribs.getLength(); i++)
+ {
+ Attr attr = (Attr)attribs.item(i);
+ String attrName = attr.getName();
+ String attrValue = attr.getValue();
+ if (attrName.startsWith("xmlns:"))
+ {
+ String prefix = attrName.substring(6);
+ nsRegistry.registerURI(attrValue, prefix);
+ }
+ }
+ }
- SOAPHeader soapHeader = message.getSOAPHeader();
+ public void writeHeaders(SOAPMessage message) throws AddressingException
+ {
+ try
+ {
+ SOAPFactoryImpl factory = (SOAPFactoryImpl)SOAPFactory.newInstance();
- if (getAction() == null)
- throw new AddressingException("Required addressing property wsa:Action");
+ SOAPHeader soapHeader = message.getSOAPHeader();
- // Add the xmlns:wsa declaration
- soapHeader.addNamespaceDeclaration(ADDR.getNamespacePrefix(), ADDR.getNamespaceURI());
+ if (getAction() == null)
+ throw new AddressingException("Required addressing property wsa:Action");
- // Write wsa:To
- if (getTo() != null)
- {
- SOAPElement wsaTo = soapHeader.addChildElement(new NameImpl(ADDR.getToQName()));
- wsaTo.addTextNode(getTo().getURI().toString());
- }
+ // Add the xmlns:wsa declaration
+ soapHeader.addNamespaceDeclaration(ADDR.getNamespacePrefix(), ADDR.getNamespaceURI());
- // Write wsa:From
- if (getFrom() != null)
- {
- EndpointReferenceImpl epr = (EndpointReferenceImpl)getFrom();
- epr.setRootQName(ADDR.getFromQName());
- SOAPElement soapElement = factory.createElement(epr.toElement());
- soapElement.removeNamespaceDeclaration(ADDR.getNamespacePrefix());
- soapHeader.addChildElement(soapElement);
- }
+ // Write wsa:To
+ if (getTo() != null)
+ {
+ SOAPElement wsaTo = soapHeader.addChildElement(new NameImpl(ADDR.getToQName()));
+ wsaTo.addTextNode(getTo().getURI().toString());
+ }
- // Write wsa:ReplyTo
- if (getReplyTo() != null)
- {
- EndpointReferenceImpl epr = (EndpointReferenceImpl)getReplyTo();
- epr.setRootQName(ADDR.getReplyToQName());
- SOAPElement soapElement = factory.createElement(epr.toElement());
- soapElement.removeNamespaceDeclaration(ADDR.getNamespacePrefix());
- soapHeader.addChildElement(soapElement);
- }
+ // Write wsa:From
+ if (getFrom() != null)
+ {
+ EndpointReferenceImpl epr = (EndpointReferenceImpl)getFrom();
+ epr.setRootQName(ADDR.getFromQName());
+ SOAPElement soapElement = factory.createElement(epr.toElement());
+ soapElement.removeNamespaceDeclaration(ADDR.getNamespacePrefix());
+ soapHeader.addChildElement(soapElement);
+ }
- // Write wsa:FaultTo
- if (getFaultTo() != null)
- {
- EndpointReferenceImpl epr = (EndpointReferenceImpl)getFaultTo();
- epr.setRootQName(ADDR.getFaultToQName());
- SOAPElement soapElement = factory.createElement(epr.toElement());
- soapElement.removeNamespaceDeclaration(ADDR.getNamespacePrefix());
- soapHeader.addChildElement(soapElement);
- }
+ // Write wsa:ReplyTo
+ if (getReplyTo() != null)
+ {
+ EndpointReferenceImpl epr = (EndpointReferenceImpl)getReplyTo();
+ epr.setRootQName(ADDR.getReplyToQName());
+ SOAPElement soapElement = factory.createElement(epr.toElement());
+ soapElement.removeNamespaceDeclaration(ADDR.getNamespacePrefix());
+ soapHeader.addChildElement(soapElement);
+ }
- // Write wsa:Action
- SOAPElement wsaAction = soapHeader.addChildElement(new NameImpl(ADDR.getActionQName()));
- wsaAction.addTextNode(getAction().getURI().toString());
+ // Write wsa:FaultTo
+ if (getFaultTo() != null)
+ {
+ EndpointReferenceImpl epr = (EndpointReferenceImpl)getFaultTo();
+ epr.setRootQName(ADDR.getFaultToQName());
+ SOAPElement soapElement = factory.createElement(epr.toElement());
+ soapElement.removeNamespaceDeclaration(ADDR.getNamespacePrefix());
+ soapHeader.addChildElement(soapElement);
+ }
- // Write wsa:MessageID
- if (getMessageID() != null)
- {
- SOAPElement wsaMessageId = soapHeader.addChildElement(new NameImpl(ADDR.getMessageIDQName()));
- wsaMessageId.addTextNode(getMessageID().getURI().toString());
- }
+ // Write wsa:Action
+ SOAPElement wsaAction = soapHeader.addChildElement(new NameImpl(ADDR.getActionQName()));
+ wsaAction.addTextNode(getAction().getURI().toString());
- // Write wsa:RelatesTo
- if (getRelatesTo() != null)
- {
- for (Relationship rel : getRelatesTo())
- {
- SOAPElement wsaRelatesTo = soapHeader.addChildElement(new NameImpl(ADDR.getRelatesToQName()));
- if (rel.getType() != null)
- {
- wsaRelatesTo.setAttribute(ADDR.getRelationshipTypeName(), getPrefixedName(rel.getType()));
- }
- wsaRelatesTo.addTextNode(rel.getID().toString());
- }
- }
+ // Write wsa:MessageID
+ if (getMessageID() != null)
+ {
+ SOAPElement wsaMessageId = soapHeader.addChildElement(new NameImpl(ADDR.getMessageIDQName()));
+ wsaMessageId.addTextNode(getMessageID().getURI().toString());
+ }
- // Write wsa:ReferenceParameters
- ReferenceParameters refParams = getReferenceParameters();
- if (refParams.getElements().size() > 0 || refParams.getAttributes().size() > 0)
- {
- SOAPElement wsaRefParams = soapHeader.addChildElement(new NameImpl(ADDR.getReferenceParametersQName()));
- appendAttributes(wsaRefParams, refParams.getAttributes());
- appendElements(wsaRefParams, refParams.getElements());
- }
+ // Write wsa:RelatesTo
+ if (getRelatesTo() != null)
+ {
+ for (Relationship rel : getRelatesTo())
+ {
+ SOAPElement wsaRelatesTo = soapHeader.addChildElement(new NameImpl(ADDR.getRelatesToQName()));
+ if (rel.getType() != null)
+ {
+ wsaRelatesTo.setAttribute(ADDR.getRelationshipTypeName(), getPrefixedName(rel.getType()));
+ }
+ wsaRelatesTo.addTextNode(rel.getID().toString());
+ }
+ }
- appendElements(soapHeader, getElements());
- }
- catch (SOAPException ex)
- {
- throw new AddressingException("Cannot read headers", ex);
- }
- }
+ // Write wsa:ReferenceParameters
+ ReferenceParameters refParams = getReferenceParameters();
+ if (refParams.getElements().size() > 0 || refParams.getAttributes().size() > 0)
+ {
+ SOAPElement wsaRefParams = soapHeader.addChildElement(new NameImpl(ADDR.getReferenceParametersQName()));
+ appendAttributes(wsaRefParams, refParams.getAttributes());
+ appendElements(wsaRefParams, refParams.getElements());
+ }
- public void setMu(boolean mu)
- {
- throw new NotImplementedException();
- }
+ appendElements(soapHeader, getElements());
+ }
+ catch (SOAPException ex)
+ {
+ throw new AddressingException("Cannot read headers", ex);
+ }
+ }
- private void appendAttributes(SOAPElement soapElement, Map<QName, String> attributes)
- {
- for (QName qname : attributes.keySet())
- {
- String qualname = getPrefixedName(qname);
- String value = attributes.get(qname);
- soapElement.setAttribute(qualname, value);
- }
- }
+ public void setMu(boolean mu)
+ {
+ throw new NotImplementedException();
+ }
- private void appendElements(SOAPElement soapElement, List<Object> elements)
- {
- try
- {
- SOAPFactoryImpl factory = (SOAPFactoryImpl)SOAPFactory.newInstance();
- for (Object obj : elements)
- {
- if (obj instanceof Element)
- {
- SOAPElement child = factory.createElement((Element)obj);
- soapElement.addChildElement(child);
- }
- else if (obj instanceof String)
- {
- Element el = DOMUtils.parse((String)obj);
- SOAPElement child = factory.createElement(el);
- soapElement.addChildElement(child);
- }
- else
- {
- throw new AddressingException("Unsupported element: " + obj.getClass().getName());
- }
- }
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new AddressingException("Cannot append elements", ex);
- }
- }
+ private void appendAttributes(SOAPElement soapElement, Map<QName, String> attributes)
+ {
+ for (QName qname : attributes.keySet())
+ {
+ String qualname = getPrefixedName(qname);
+ String value = attributes.get(qname);
+ soapElement.setAttribute(qualname, value);
+ }
+ }
- private String getPrefixedName(QName qname)
- {
- String prefix = qname.getPrefix();
- String localPart = qname.getLocalPart();
- String qualname = (prefix != null && prefix.length() > 0 ? prefix + ":" + localPart : localPart);
- return qualname;
- }
+ private void appendElements(SOAPElement soapElement, List<Object> elements)
+ {
+ try
+ {
+ SOAPFactoryImpl factory = (SOAPFactoryImpl)SOAPFactory.newInstance();
+ for (Object obj : elements)
+ {
+ if (obj instanceof Element)
+ {
+ SOAPElement child = factory.createElement((Element)obj);
+ soapElement.addChildElement(child);
+ }
+ else if (obj instanceof String)
+ {
+ Element el = DOMUtils.parse((String)obj);
+ SOAPElement child = factory.createElement(el);
+ soapElement.addChildElement(child);
+ }
+ else
+ {
+ throw new AddressingException("Unsupported element: " + obj.getClass().getName());
+ }
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new AddressingException("Cannot append elements", ex);
+ }
+ }
+
+ private String getPrefixedName(QName qname)
+ {
+ String prefix = qname.getPrefix();
+ String localPart = qname.getLocalPart();
+ String qualname = (prefix != null && prefix.length() > 0 ? prefix + ":" + localPart : localPart);
+ return qualname;
+ }
}
18 years, 10 months
JBossWS SVN: r3535 - in trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws: addressing and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-06-11 12:10:41 -0400 (Mon, 11 Jun 2007)
New Revision: 3535
Added:
trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/addressing/
trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/addressing/AddressingTestCase.java
Log:
Verify the addressing parsing logic
Added: trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/addressing/AddressingTestCase.java
===================================================================
--- trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/addressing/AddressingTestCase.java (rev 0)
+++ trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/addressing/AddressingTestCase.java 2007-06-11 16:10:41 UTC (rev 3535)
@@ -0,0 +1,75 @@
+/*
+ * 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.test.ws.jaxws.addressing;
+
+import junit.framework.TestCase;
+
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.addressing.AddressingException;
+import java.io.ByteArrayInputStream;
+
+import org.jboss.ws.extensions.addressing.soap.SOAPAddressingPropertiesImpl;
+
+/**
+ * Verify the ws-addressing parsing logic
+ *
+ * @author Heiko.Braun(a)jboss.com
+ * @version $Revision$
+ */
+public class AddressingTestCase extends TestCase
+{
+
+ private String ERRORNOUS_XML = "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>\n" +
+ " <soap:Header xmlns:wsa='http://www.w3.org/2005/08/addressing'>" +
+ "<wsa:Action></wsa:Action>\n" +
+ "<wsa:MessageID>urn:uuid:1fa5a31f-bbe7-4ad5-8b92-d765f4a32dc9</wsa:MessageID>\n" +
+ "<wsa:ReplyTo>\n" +
+ "<wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>\n" +
+ "<wsa:ReferenceParameters>\n" +
+ "<ns1:clientid xmlns:ns1=\"http://somens\">clientid-1</ns1:clientid>\n" +
+ "</wsa:ReferenceParameters>\n" +
+ "</wsa:ReplyTo>\n" +
+ "<wsa:To>http://mycomp:8080/testws</wsa:To>\n" +
+ "</soap:Header>" +
+ " <soap:Body/>\n" +
+ "</soap:Envelope>";
+
+
+ public void testReplyToWithoutAction() throws Exception
+ {
+ MessageFactory mf = MessageFactory.newInstance();
+ SOAPMessage message = mf.createMessage(null, new ByteArrayInputStream(ERRORNOUS_XML.getBytes()));
+
+ SOAPAddressingPropertiesImpl props = new SOAPAddressingPropertiesImpl();
+ try
+ {
+ props.readHeaders(message);
+ fail("ERRORNOUS_XML should cause a parsing exception due to missing wsa:Action value");
+ }
+ catch (AddressingException e)
+ {
+ // expected an exception
+ }
+
+ }
+}
Property changes on: trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/addressing/AddressingTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
18 years, 10 months
JBossWS SVN: r3534 - trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-06-11 12:10:05 -0400 (Mon, 11 Jun 2007)
New Revision: 3534
Modified:
trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/AddressingPropertiesImpl.java
Log:
Avoid double initialization
Modified: trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/AddressingPropertiesImpl.java
===================================================================
--- trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/AddressingPropertiesImpl.java 2007-06-11 14:05:40 UTC (rev 3533)
+++ trunk/jbossws-core/src/main/java/org/jboss/ws/extensions/addressing/AddressingPropertiesImpl.java 2007-06-11 16:10:05 UTC (rev 3534)
@@ -80,7 +80,9 @@
private Map<QName, AddressingType> addrTypes = new HashMap<QName, AddressingType>();
- public AttributedURI getTo()
+ private boolean initialized = false;
+
+ public AttributedURI getTo()
{
return to;
}
@@ -166,10 +168,12 @@
*/
public void initializeAsDestination(EndpointReference epr)
{
- if (epr == null)
+ if(initialized) return;
+
+ if (epr == null)
throw new IllegalArgumentException("Invalid null endpoint reference");
- this.to = epr.getAddress();
+ this.to = epr.getAddress();
ReferenceParameters srcParams = epr.getReferenceParameters();
for (Object obj : srcParams.getElements())
@@ -178,8 +182,10 @@
soapElement.setAttributeNS(getNamespaceURI(), "wsa:IsReferenceParameter", "true");
addElement(soapElement);
}
- }
+ this.initialized = true;
+ }
+
/**
* Initialize this <code>AddressingProperties</code> as a reply to the
* given message. As described in the WS-Addressing Core specification.
@@ -193,7 +199,9 @@
*/
public void initializeAsReply(AddressingProperties props, boolean isFault)
{
- EndpointReference epr = (isFault ? props.getFaultTo() : null);
+ if(initialized) return;
+
+ EndpointReference epr = (isFault ? props.getFaultTo() : null);
if (epr == null)
{
epr = props.getReplyTo();
@@ -216,8 +224,10 @@
Relationship rel = builder.newRelationship(props.getMessageID().getURI());
this.relatesTo = new Relationship[] { rel };
}
- }
+ this.initialized = true;
+ }
+
// Map interface ****************************************************************
public int size()
18 years, 10 months
JBossWS SVN: r3533 - in branches/jbossws-2.0/jbossws-core: src/test/java/org/jboss/test/ws/jaxws and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-06-11 10:05:40 -0400 (Mon, 11 Jun 2007)
New Revision: 3533
Added:
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvc.java
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvcImpl.java
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/JBWS1422TestCase.java
Modified:
branches/jbossws-2.0/jbossws-core/ant-import-tests/build-jars-jaxws.xml
Log:
Fix JBWS-1422
Modified: branches/jbossws-2.0/jbossws-core/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- branches/jbossws-2.0/jbossws-core/ant-import-tests/build-jars-jaxws.xml 2007-06-11 13:51:35 UTC (rev 3532)
+++ branches/jbossws-2.0/jbossws-core/ant-import-tests/build-jars-jaxws.xml 2007-06-11 14:05:40 UTC (rev 3533)
@@ -250,6 +250,13 @@
</fileset>
</jar>
+ <!-- jaxws-jbws1422 -->
+ <jar destfile="${tests.output.dir}/libs/jaxws-jbws1422.jar">
+ <fileset dir="${tests.output.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/jbws1422/*.*"/>
+ </fileset>
+ </jar>
+
<!-- jaxws-jbws1505 -->
<jar destfile="${tests.output.dir}/libs/jaxws-jbws1505.jar">
<fileset dir="${tests.output.dir}/classes">
Added: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvc.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvc.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvc.java 2007-06-11 14:05:40 UTC (rev 3533)
@@ -0,0 +1,35 @@
+/*
+ * 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.test.ws.jaxws.jbws1422;
+
+import javax.jws.WebService;
+import javax.jws.WebParam;
+import javax.jws.soap.SOAPBinding;
+import javax.ejb.Remote;
+
+@WebService(name="test")
+@SOAPBinding(style= SOAPBinding.Style.DOCUMENT, use= SOAPBinding.Use.LITERAL, parameterStyle= SOAPBinding.ParameterStyle.WRAPPED)
+@Remote
+public interface IWebsvc {
+
+ String cancel(@WebParam(name="nBarFoo") String myfoobar);
+}
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvc.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvcImpl.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvcImpl.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvcImpl.java 2007-06-11 14:05:40 UTC (rev 3533)
@@ -0,0 +1,46 @@
+/*
+ * 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.test.ws.jaxws.jbws1422;
+
+import javax.ejb.Stateless;
+import javax.jws.WebService;
+import javax.jws.WebParam;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ * @version $Revision$
+ */
+@Stateless
+@WebService(
+ endpointInterface = "org.jboss.test.ws.jaxws.jbws1422.IWebsvc",
+ serviceName = "JBWS1422Service",
+ targetNamespace = "http://org.jboss.test.ws/jbws1422"
+)
+
+public class IWebsvcImpl implements IWebsvc
+{
+
+ public String cancel(@WebParam(name = "nBarFoo")String myfoobar)
+ {
+ return "Cancelled";
+ }
+}
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvcImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/JBWS1422TestCase.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/JBWS1422TestCase.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/JBWS1422TestCase.java 2007-06-11 14:05:40 UTC (rev 3533)
@@ -0,0 +1,82 @@
+/*
+ * 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.test.ws.jaxws.jbws1422;
+
+import junit.framework.Test;
+import org.jboss.ws.WSException;
+import org.jboss.wsf.spi.test.JBossWSTest;
+import org.jboss.wsf.spi.test.JBossWSTestSetup;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import java.net.URL;
+
+/**
+ * If @WebParam.name starts with one lower-case character followed
+ * by an upper-case character a NPE is thrown on deployment.
+ *
+ * http://jira.jboss.org/jira/browse/JBWS-1422
+ *
+ * @version $Revision:1370 $
+ */
+public class JBWS1422TestCase extends JBossWSTest
+{
+ private String targetNS = "http://org.jboss.test.ws/jbws1422";
+ private IWebsvc port;
+ private URL wsdlURL;
+
+ public static Test suite()
+ {
+ return JBossWSTestSetup.newTestSetup(JBWS1422TestCase.class, "jaxws-jbws1422.jar");
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ QName serviceName = new QName(targetNS, "JBWS1422Service");
+ wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-jbws1422/IWebsvcImpl?wsdl");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ port = service.getPort(IWebsvc.class);
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testDeployment() throws Exception
+ {
+ try
+ {
+ String result = port.cancel("myFooBar");
+ assertNotNull(result);
+ assertEquals("Cancelled", result);
+ }
+ catch (Exception ex)
+ {
+ WSException.rethrow(ex);
+ }
+ }
+
+}
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/JBWS1422TestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
18 years, 10 months
JBossWS SVN: r3532 - in trunk/jbossws-core: src/test/java/org/jboss/test/ws/jaxws and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-06-11 09:51:35 -0400 (Mon, 11 Jun 2007)
New Revision: 3532
Added:
trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/
trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvc.java
trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvcImpl.java
trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/JBWS1422TestCase.java
Modified:
trunk/jbossws-core/ant-import-tests/build-jars-jaxws.xml
trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/JBWS1505TestCase.java
Log:
Fix JBWS-1422
Modified: trunk/jbossws-core/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- trunk/jbossws-core/ant-import-tests/build-jars-jaxws.xml 2007-06-11 13:21:12 UTC (rev 3531)
+++ trunk/jbossws-core/ant-import-tests/build-jars-jaxws.xml 2007-06-11 13:51:35 UTC (rev 3532)
@@ -250,12 +250,19 @@
</fileset>
</jar>
+ <!-- jaxws-jbws1422 -->
+ <jar destfile="${tests.output.dir}/libs/jaxws-jbws1422.jar">
+ <fileset dir="${tests.output.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/jbws1422/*.*"/>
+ </fileset>
+ </jar>
+
<!-- jaxws-jbws1505 -->
- <jar destfile="${tests.output.dir}/libs/jaxws-jbws1505.jar">
- <fileset dir="${tests.output.dir}/classes">
- <include name="org/jboss/test/ws/jaxws/jbws1505/*.*"/>
- </fileset>
- </jar>
+ <jar destfile="${tests.output.dir}/libs/jaxws-jbws1505.jar">
+ <fileset dir="${tests.output.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/jbws1505/*.*"/>
+ </fileset>
+ </jar>
<!-- jaxws namespace -->
<war warfile="${tests.output.dir}/libs/jaxws-namespace.war" webxml="${tests.output.dir}/resources/jaxws/namespace/WEB-INF/web.xml">
Added: trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvc.java
===================================================================
--- trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvc.java (rev 0)
+++ trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvc.java 2007-06-11 13:51:35 UTC (rev 3532)
@@ -0,0 +1,35 @@
+/*
+ * 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.test.ws.jaxws.jbws1422;
+
+import javax.jws.WebService;
+import javax.jws.WebParam;
+import javax.jws.soap.SOAPBinding;
+import javax.ejb.Remote;
+
+@WebService(name="test")
+@SOAPBinding(style= SOAPBinding.Style.DOCUMENT, use= SOAPBinding.Use.LITERAL, parameterStyle= SOAPBinding.ParameterStyle.WRAPPED)
+@Remote
+public interface IWebsvc {
+
+ String cancel(@WebParam(name="nBarFoo") String myfoobar);
+}
Property changes on: trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvc.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvcImpl.java
===================================================================
--- trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvcImpl.java (rev 0)
+++ trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvcImpl.java 2007-06-11 13:51:35 UTC (rev 3532)
@@ -0,0 +1,46 @@
+/*
+ * 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.test.ws.jaxws.jbws1422;
+
+import javax.ejb.Stateless;
+import javax.jws.WebService;
+import javax.jws.WebParam;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ * @version $Revision$
+ */
+@Stateless
+@WebService(
+ endpointInterface = "org.jboss.test.ws.jaxws.jbws1422.IWebsvc",
+ serviceName = "JBWS1422Service",
+ targetNamespace = "http://org.jboss.test.ws/jbws1422"
+)
+
+public class IWebsvcImpl implements IWebsvc
+{
+
+ public String cancel(@WebParam(name = "nBarFoo")String myfoobar)
+ {
+ return "Cancelled";
+ }
+}
Property changes on: trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/IWebsvcImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/JBWS1422TestCase.java
===================================================================
--- trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/JBWS1422TestCase.java (rev 0)
+++ trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/JBWS1422TestCase.java 2007-06-11 13:51:35 UTC (rev 3532)
@@ -0,0 +1,82 @@
+/*
+ * 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.test.ws.jaxws.jbws1422;
+
+import junit.framework.Test;
+import org.jboss.ws.WSException;
+import org.jboss.wsf.spi.test.JBossWSTest;
+import org.jboss.wsf.spi.test.JBossWSTestSetup;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import java.net.URL;
+
+/**
+ * If @WebParam.name starts with one lower-case character followed
+ * by an upper-case character a NPE is thrown on deployment.
+ *
+ * http://jira.jboss.org/jira/browse/JBWS-1422
+ *
+ * @version $Revision:1370 $
+ */
+public class JBWS1422TestCase extends JBossWSTest
+{
+ private String targetNS = "http://org.jboss.test.ws/jbws1422";
+ private IWebsvc port;
+ private URL wsdlURL;
+
+ public static Test suite()
+ {
+ return JBossWSTestSetup.newTestSetup(JBWS1422TestCase.class, "jaxws-jbws1422.jar");
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ QName serviceName = new QName(targetNS, "JBWS1422Service");
+ wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-jbws1422/IWebsvcImpl?wsdl");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ port = service.getPort(IWebsvc.class);
+ }
+
+ /**
+ *
+ * @throws Exception
+ */
+ public void testDeployment() throws Exception
+ {
+ try
+ {
+ String result = port.cancel("myFooBar");
+ assertNotNull(result);
+ assertEquals("Cancelled", result);
+ }
+ catch (Exception ex)
+ {
+ WSException.rethrow(ex);
+ }
+ }
+
+}
Property changes on: trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1422/JBWS1422TestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/JBWS1505TestCase.java
===================================================================
--- trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/JBWS1505TestCase.java 2007-06-11 13:21:12 UTC (rev 3531)
+++ trunk/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/JBWS1505TestCase.java 2007-06-11 13:51:35 UTC (rev 3532)
@@ -22,16 +22,15 @@
package org.jboss.test.ws.jaxws.jbws1505;
import junit.framework.Test;
-import org.jboss.wsf.spi.test.JBossWSTest;
-import org.jboss.wsf.spi.test.JBossWSTestSetup;
+import org.jboss.ws.WSException;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
-import org.jboss.ws.WSException;
+import org.jboss.wsf.spi.test.JBossWSTest;
+import org.jboss.wsf.spi.test.JBossWSTestSetup;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import java.net.URL;
-import java.io.File;
/**
* Verify wsdl gerneration on SEI inheritance.
18 years, 10 months
JBossWS SVN: r3531 - in branches/jbossws-2.0/jbossws-core: src/test/java/org/jboss/test/ws/jaxws and 1 other directories.
by jbossws-commits@lists.jboss.org
Author: heiko.braun(a)jboss.com
Date: 2007-06-11 09:21:12 -0400 (Mon, 11 Jun 2007)
New Revision: 3531
Added:
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/CustomType.java
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/Interface1.java
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/Interface2.java
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/JBWS1505EndpointImpl.java
branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/JBWS1505TestCase.java
Modified:
branches/jbossws-2.0/jbossws-core/ant-import-tests/build-jars-jaxws.xml
Log:
Fix JBWS-1505
Modified: branches/jbossws-2.0/jbossws-core/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- branches/jbossws-2.0/jbossws-core/ant-import-tests/build-jars-jaxws.xml 2007-06-11 13:16:27 UTC (rev 3530)
+++ branches/jbossws-2.0/jbossws-core/ant-import-tests/build-jars-jaxws.xml 2007-06-11 13:21:12 UTC (rev 3531)
@@ -250,6 +250,13 @@
</fileset>
</jar>
+ <!-- jaxws-jbws1505 -->
+ <jar destfile="${tests.output.dir}/libs/jaxws-jbws1505.jar">
+ <fileset dir="${tests.output.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/jbws1505/*.*"/>
+ </fileset>
+ </jar>
+
<!-- jaxws namespace -->
<war warfile="${tests.output.dir}/libs/jaxws-namespace.war" webxml="${tests.output.dir}/resources/jaxws/namespace/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/classes">
Added: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/CustomType.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/CustomType.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/CustomType.java 2007-06-11 13:21:12 UTC (rev 3531)
@@ -0,0 +1,57 @@
+/*
+ * 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.test.ws.jaxws.jbws1505;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ * @version $Revision$
+ */
+public final class CustomType implements Interface2
+{
+ private int member1 = 1;
+ private int member2 = 2;
+
+ public int getMember2()
+ {
+ return this.member2;
+ }
+
+ public void setMember2(int member2)
+ {
+
+ }
+
+ public CustomType getCustomType()
+ {
+ return null;
+ }
+
+ public int getMember1()
+ {
+ return this.member1;
+ }
+
+ public void setMember1(int member1)
+ {
+
+ }
+}
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/CustomType.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/Interface1.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/Interface1.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/Interface1.java 2007-06-11 13:21:12 UTC (rev 3531)
@@ -0,0 +1,32 @@
+/*
+ * 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.test.ws.jaxws.jbws1505;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ * @version $Revision$
+ */
+public interface Interface1
+{
+ public int getMember1();
+ public void setMember1(int member1);
+}
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/Interface1.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/Interface2.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/Interface2.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/Interface2.java 2007-06-11 13:21:12 UTC (rev 3531)
@@ -0,0 +1,39 @@
+/*
+ * 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.test.ws.jaxws.jbws1505;
+
+import javax.jws.WebService;
+import javax.ejb.Remote;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ * @version $Revision$
+ */
+@WebService(targetNamespace = "http://org.jboss.test.ws/jbws1505")
+@Remote
+public interface Interface2 extends Interface1
+{
+ public int getMember2();
+ public void setMember2(int member2);
+
+ public CustomType getCustomType();
+}
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/Interface2.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/JBWS1505EndpointImpl.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/JBWS1505EndpointImpl.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/JBWS1505EndpointImpl.java 2007-06-11 13:21:12 UTC (rev 3531)
@@ -0,0 +1,67 @@
+/*
+ * 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.test.ws.jaxws.jbws1505;
+
+import javax.jws.WebService;
+import javax.ejb.Stateless;
+
+/**
+ * @author Heiko.Braun(a)jboss.com
+ * @version $Revision$
+ */
+@WebService(
+ endpointInterface = "org.jboss.test.ws.jaxws.jbws1505.Interface2",
+ serviceName = "JBWS1505Service",
+ targetNamespace = "http://org.jboss.test.ws/jbws1505"
+)
+@Stateless
+public class JBWS1505EndpointImpl implements Interface2
+{
+
+ private int member = 1;
+ private int member2 = 2;
+
+ public int getMember2()
+ {
+ return this.member2;
+ }
+
+ public void setMember2(int member2)
+ {
+ this.member = member2;
+ }
+
+ public CustomType getCustomType()
+ {
+ return new CustomType();
+ }
+
+ public int getMember1()
+ {
+ return this.member;
+ }
+
+ public void setMember1(int member1)
+ {
+ this.member = member1;
+ }
+}
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/JBWS1505EndpointImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/JBWS1505TestCase.java
===================================================================
--- branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/JBWS1505TestCase.java (rev 0)
+++ branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/JBWS1505TestCase.java 2007-06-11 13:21:12 UTC (rev 3531)
@@ -0,0 +1,105 @@
+/*
+ * 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.test.ws.jaxws.jbws1505;
+
+import junit.framework.Test;
+import org.jboss.wsf.spi.test.JBossWSTest;
+import org.jboss.wsf.spi.test.JBossWSTestSetup;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+import org.jboss.ws.WSException;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import java.net.URL;
+import java.io.File;
+
+/**
+ * Verify wsdl gerneration on SEI inheritance.
+ *
+ * http://jira.jboss.org/jira/browse/JBWS-1505
+ *
+ * @version $Revision:1370 $
+ */
+public class JBWS1505TestCase extends JBossWSTest
+{
+ private String targetNS = "http://org.jboss.test.ws/jbws1505";
+ private Interface2 port;
+ private URL wsdlURL;
+
+ public static Test suite()
+ {
+ return JBossWSTestSetup.newTestSetup(JBWS1505TestCase.class, "jaxws-jbws1505.jar");
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ QName serviceName = new QName(targetNS, "JBWS1505Service");
+ wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-jbws1505/JBWS1505EndpointImpl?wsdl");
+
+ Service service = Service.create(wsdlURL, serviceName);
+ port = service.getPort(Interface2.class);
+ }
+
+ /**
+ * All methods on the SEI should be mapped.
+ *
+ * @throws Exception
+ */
+ public void testWSDLGeneration() throws Exception
+ {
+ try
+ {
+ WSDLDefinitions wsdl = WSDLDefinitionsFactory.newInstance().parse(wsdlURL);
+ assertTrue(wsdl.getInterfaces().length == 1); // a single port
+ assertTrue(wsdl.getInterfaces()[0].getOperations().length == 5); // with five op's
+ }
+ catch (Exception ex)
+ {
+ WSException.rethrow(ex);
+ }
+ }
+
+ /**
+ * Complex types that inherit from a SEI hirarchy shold expose
+ * all members in xml schema.
+ *
+ * @throws Exception
+ */
+ public void testTypeInheritance() throws Exception
+ {
+ try
+ {
+ CustomType ct = port.getCustomType();
+ assertTrue(ct.getMember1() == 1);
+ assertTrue(ct.getMember2() == 2);
+ }
+ catch (Exception ex)
+ {
+ WSException.rethrow(ex);
+ }
+ }
+
+}
Property changes on: branches/jbossws-2.0/jbossws-core/src/test/java/org/jboss/test/ws/jaxws/jbws1505/JBWS1505TestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
18 years, 10 months