Author: thomas.diesler(a)jboss.com
Date: 2006-12-15 10:59:56 -0500 (Fri, 15 Dec 2006)
New Revision: 1660
Added:
trunk/src/test/resources/jaxws/eardeployment/WEB-INF/wsdl/TestService.xsd
Removed:
trunk/src/main/java/org/jboss/ws/core/jaxws/util/
Modified:
trunk/
trunk/src/main/java/javax/xml/soap/FactoryLoader.java
trunk/src/main/java/javax/xml/soap/MessageFactory.java
trunk/src/main/java/javax/xml/soap/SOAPFactory.java
trunk/src/main/java/javax/xml/ws/spi/Provider.java
trunk/src/main/java/org/jboss/ws/core/server/HttpServer.java
trunk/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java
trunk/src/main/java/org/jboss/ws/core/utils/JBossWSEntityResolver.java
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSEntityResolver.java
trunk/src/main/java/org/jboss/ws/tools/JavaToXSD.java
trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanPayload.java
trunk/src/test/resources/jaxws/eardeployment/WEB-INF/wsdl/TestEndpoint.wsdl
Log:
Fix handling of wsdl/xsd imports. It now also uses ResourceURL
Property changes on: trunk
___________________________________________________________________
Name: svn:ignore
-
clipboard.xml
output
output-eclipse
thirdparty
ant.properties
version.properties.md5
clipboard.txt
+
clipboard.xml
output
output-eclipse
thirdparty
ant.properties
version.properties.md5
clipboard.txt
.settings
Modified: trunk/src/main/java/javax/xml/soap/FactoryLoader.java
===================================================================
--- trunk/src/main/java/javax/xml/soap/FactoryLoader.java 2006-12-15 14:53:18 UTC (rev
1659)
+++ trunk/src/main/java/javax/xml/soap/FactoryLoader.java 2006-12-15 15:59:56 UTC (rev
1660)
@@ -41,7 +41,7 @@
* @author Thomas.Diesler(a)jboss.com
* @since 14-Dec-2006
*/
-class FactoryLoader
+public class FactoryLoader
{
// provide logging
private static Logger log = Logger.getLogger(MessageFactory.class);
@@ -60,7 +60,7 @@
*
* @return the factory impl, or null
*/
- static Object loadFactory(String propertyName, String defaultFactory) throws
SOAPException
+ public static Object loadFactory(String propertyName, String defaultFactory)
{
Object factory = null;
ClassLoader loader = Thread.currentThread().getContextClassLoader();
@@ -78,7 +78,7 @@
}
catch (Throwable t)
{
- throw new SOAPException("Failed to load " + propertyName + ":
" + factoryName, t);
+ throw new IllegalStateException("Failed to load " + propertyName +
": " + factoryName, t);
}
}
@@ -105,7 +105,7 @@
}
catch (Throwable t)
{
- throw new SOAPException("Failed to load " + propertyName +
": " + factoryName, t);
+ throw new IllegalStateException("Failed to load " + propertyName
+ ": " + factoryName, t);
}
}
}
@@ -119,7 +119,7 @@
{
try
{
- BufferedReader br = new BufferedReader(new InputStreamReader(inStream));
+ BufferedReader br = new BufferedReader(new InputStreamReader(inStream,
"UTF-8"));
factoryName = br.readLine();
br.close();
if (factoryName != null)
@@ -131,7 +131,7 @@
}
catch (Throwable t)
{
- throw new SOAPException("Failed to load " + propertyName +
": " + factoryName, t);
+ throw new IllegalStateException("Failed to load " + propertyName
+ ": " + factoryName, t);
}
}
}
@@ -148,7 +148,7 @@
}
catch (Throwable t)
{
- throw new SOAPException("Failed to load " + propertyName + ":
" + factoryName, t);
+ throw new IllegalStateException("Failed to load " + propertyName +
": " + factoryName, t);
}
}
Modified: trunk/src/main/java/javax/xml/soap/MessageFactory.java
===================================================================
--- trunk/src/main/java/javax/xml/soap/MessageFactory.java 2006-12-15 14:53:18 UTC (rev
1659)
+++ trunk/src/main/java/javax/xml/soap/MessageFactory.java 2006-12-15 15:59:56 UTC (rev
1660)
@@ -66,8 +66,16 @@
*/
public static MessageFactory newInstance() throws SOAPException
{
- String propertyName = "javax.xml.soap.MessageFactory";
- MessageFactory factory = (MessageFactory)FactoryLoader.loadFactory(propertyName,
null);
+ MessageFactory factory = null;
+ try
+ {
+ String propertyName = "javax.xml.soap.MessageFactory";
+ factory = (MessageFactory)FactoryLoader.loadFactory(propertyName, null);
+ }
+ catch (RuntimeException rte)
+ {
+ throw new SOAPException(rte);
+ }
// Use the SAAJMetaFactory instance to locate the MessageFactory implementation
class.
if (factory == null)
Modified: trunk/src/main/java/javax/xml/soap/SOAPFactory.java
===================================================================
--- trunk/src/main/java/javax/xml/soap/SOAPFactory.java 2006-12-15 14:53:18 UTC (rev
1659)
+++ trunk/src/main/java/javax/xml/soap/SOAPFactory.java 2006-12-15 15:59:56 UTC (rev
1660)
@@ -58,8 +58,15 @@
{
if (soapFactory == null)
{
- String propertyName = "javax.xml.soap.SOAPFactory";
- soapFactory = (SOAPFactory)FactoryLoader.loadFactory(propertyName, null);
+ try
+ {
+ String propertyName = "javax.xml.soap.SOAPFactory";
+ soapFactory = (SOAPFactory)FactoryLoader.loadFactory(propertyName, null);
+ }
+ catch (RuntimeException rte)
+ {
+ throw new SOAPException(rte);
+ }
// Use the SAAJMetaFactory instance to locate the MessageFactory implementation
class.
if (soapFactory == null)
Modified: trunk/src/main/java/javax/xml/ws/spi/Provider.java
===================================================================
--- trunk/src/main/java/javax/xml/ws/spi/Provider.java 2006-12-15 14:53:18 UTC (rev 1659)
+++ trunk/src/main/java/javax/xml/ws/spi/Provider.java 2006-12-15 15:59:56 UTC (rev 1660)
@@ -26,6 +26,7 @@
import java.util.List;
import javax.xml.namespace.QName;
+import javax.xml.soap.FactoryLoader;
import javax.xml.transform.Source;
import javax.xml.ws.Endpoint;
import javax.xml.ws.EndpointReference;
@@ -33,7 +34,6 @@
import javax.xml.ws.WebServiceFeature;
import javax.xml.ws.wsaddressing.W3CEndpointReference;
-import org.jboss.ws.core.jaxws.util.FactoryFinder;
import org.w3c.dom.Element;
/**
@@ -47,258 +47,255 @@
public static final String JAXWSPROVIDER_PROPERTY =
"javax.xml.ws.spi.Provider";
private static final String DEFAULT_JAXWSPROVIDER =
"org.jboss.ws.core.jaxws.spi.ProviderImpl";
- /**
- * Creates a new instance of Provider
- */
- protected Provider() {
- }
-
- /**
- *
- * Creates a new provider object.
- * <p>
- * The algorithm used to locate the provider subclass to use consists
- * of the following steps:
- * <p>
- * <ul>
- * <li>
- * If a resource with the name of
- * <code>META-INF/services/javax.xml.ws.spi.Provider</code>
- * exists, then its first line, if present, is used as the UTF-8 encoded
- * name of the implementation class.
- * </li>
- * <li>
- * If the $java.home/lib/jaxws.properties file exists and it is readable by
- * the <code>java.util.Properties.load(InputStream)</code> method and
it contains
- * an entry whose key is <code>javax.xml.ws.spi.Provider</code>, then
the value of
- * that entry is used as the name of the implementation class.
- * </li>
- * <li>
- * If a system property with the name
<code>javax.xml.ws.spi.Provider</code>
- * is defined, then its value is used as the name of the implementation class.
- * </li>
- * <li>
- * Finally, a default implementation class name is used.
- * </li>
- * </ul>
- *
- */
- public static Provider provider() {
- try {
- return (Provider)
- FactoryFinder.find(JAXWSPROVIDER_PROPERTY,
- DEFAULT_JAXWSPROVIDER);
- } catch (WebServiceException ex) {
- throw ex;
- } catch (Exception ex) {
- throw new WebServiceException("Unable to createEndpointReference
Provider: "+
- ex.getMessage());
- }
-
- }
-
- /**
- * Creates a service delegate object.
- * <p>
- * @param wsdlDocumentLocation A URL pointing to the WSDL document
- * for the service, or <code>null</code> if there isn't one.
- * @param serviceName The qualified name of the service.
- * @param serviceClass The service class, which MUST be either
- * <code>javax.xml.ws.Service</code> or a subclass thereof.
- * @return The newly created service delegate.
- */
- public abstract ServiceDelegate createServiceDelegate(
- java.net.URL wsdlDocumentLocation,
- QName serviceName, Class serviceClass);
-
-
- /**
- *
- * Creates an endpoint object with the provided binding and implementation
- * object.
- *
- * @param bindingId A URI specifying the desired binding (e.g. SOAP/HTTP)
- * @param implementor A service implementation object to which
- * incoming requests will be dispatched. The corresponding
- * class MUST be annotated with all the necessary Web service
- * annotations.
- * @return The newly created endpoint.
- */
- public abstract Endpoint createEndpoint(String bindingId,
- Object implementor);
-
-
- /**
- * Creates and publishes an endpoint object with the specified
- * address and implementation object.
- *
- * @param address A URI specifying the address and transport/protocol
- * to use. A http: URI MUST result in the SOAP 1.1/HTTP
- * binding being used. Implementations may support other
- * URI schemes.
- * @param implementor A service implementation object to which
- * incoming requests will be dispatched. The corresponding
- * class MUST be annotated with all the necessary Web service
- * annotations.
- * @return The newly created endpoint.
- */
- public abstract Endpoint createAndPublishEndpoint(String address,
- Object implementor);
- /**
- * read an EndpointReference from the infoset contained in
- * <code>eprInfoset</code>.
- *
- * @returns the <code>EndpointReference</code> unmarshalled from
- * <code>eprInfoset</code>. This method never returns
<code>null</code>.
- *
- * @throws WebServiceException If there is an error creating the
- * <code>EndpointReference</code> from the specified
<code>eprInfoset</code>.
- *
- * @throws NullPointerException If the <code>null</code>
- * <code>eprInfoset</code> value is given.
- *
- * @since JAX-WS 2.1
- **/
- public abstract EndpointReference readEndpointReference(javax.xml.transform.Source
eprInfoset);
-
- /**
- * Create an EndpointReference for <code>serviceName</code>
- * service and <code>portName</code> port from the WSDL
<code>wsdlDocumentLocation</code>. The instance
- * returned will be of type <code>clazz</code> and contain the
<code>referenceParameters</code>
- * reference parameters. This method delegates to the vendor specific
- * implementation of the {@link
javax.xml.ws.spi.Provider#createEndpointReference(Class<T>,
javax.xml.namespace.QName, javax.xml.namespace.QName, javax.xml.transform.Source,
org.w3c.dom.Element...)} method.
- *
- * @param clazz Specifies the type of <code>EndpointReference</code> that
MUST be returned.
- * @param serviceName Qualified name of the service in the WSDL.
- * @param portName Qualified name of the endpoint in the WSDL.
- * @param wsdlDocumentLocation URL for the WSDL document location for the service.
- * @param referenceParameters Reference parameters to be associated with the
- * returned <code>EndpointReference</code> instance.
- *
- * @return the EndpointReference created from <code>serviceName</code>,
<code>portName</code>,
- * <code>wsdlDocumentLocation</code> and
<code>referenceParameters</code>. This method
- * never returns <code>null</code>.
- * @throws WebServiceException
- * <UL>
- * <li>If the <code>serviceName</code> service is not
present in the WSDL.
- * <li>If the <code>portName</code> port is not present
in <code>serviceName</code> service in the WSDL.
- * <li>If the <code>wsdlDocumentLocation</code> does
not represent a valid WSDL.
- * <li>If an error occurs while creating the
<code>EndpointReference</code>.
- * <li>If the Class <code>clazz</code> is not supported
by this implementation.
- * </UL>
- * @throws java.lang.IllegalArgumentException
- * if any of the <code>clazz</code>,
<code>serviceName</code>, <code>portName</code> and
<code>wsdlDocumentLocation</code> is null.
- */
- public abstract <T extends EndpointReference> T
createEndpointReference(Class<T> clazz, QName serviceName, QName portName, Source
wsdlDocumentLocation, Element... referenceParameters);
-
-
- /**
- * The getPort method returns a proxy. If there
- * are any reference parameters in the
- * <code>endpointReference</code>, then those reference
- * parameters MUST appear as SOAP headers, indicating them to be
- * reference parameters, on all messages sent to the endpoint.
- * The parameter <code>serviceEndpointInterface</code> specifies
- * the service endpoint interface that is supported by the
- * returned proxy.
- * The parameter <code>endpointReference</code> specifies the
- * endpoint that will be invoked by the returned proxy.
- * In the implementation of this method, the JAX-WS
- * runtime system takes the responsibility of selecting a protocol
- * binding (and a port) and configuring the proxy accordingly from
- * the WSDL Metadata from the <code>EndpointReference</code>.
- *
- *
- * @param endpointReference the EndpointReference that will
- * be invoked by the returned proxy.
- * @param serviceEndpointInterface Service endpoint interface
- * @param features A list of WebServiceFeatures to configure on the
- * proxy. Supported features not in the <code>features
- * </code> parameter will have their default values.
- * @return Object Proxy instance that supports the
- * specified service endpoint interface
- * @throws WebServiceException
- * <UL>
- * <LI>If there is an error during creation
- * of the proxy
- * <LI>If there is any missing WSDL metadata
- * as required by this method
- * <LI>If this
- * <code>endpointReference</code>
- * is illegal
- * <LI>If an illegal
- * <code>serviceEndpointInterface</code>
- * is specified
- * <LI>If feature is enabled that is not compatible with
- * this port or is unsupported.
- * </UL>
- *
- * @see WebServiceFeature
- *
- * @since JAX-WS 2.1
- **/
- public abstract <T> T getPort(EndpointReference endpointReference,
- Class<T> serviceEndpointInterface,
- WebServiceFeature... features);
-
- /**
- * Factory method to create a <code>W3CEndpointReference</code>.
- *
- * <p>
- * This method can be used to create a <code>W3CEndpointReference</code>
- * for any endpoint by specifying the <code>address</code> property
along
- * with any other desired properties. This method
- * can also be used to create a <code>W3CEndpointReference</code> for
- * an endpoint that is published by the same Java EE application.
- * To do so the <code>address</code> property can be provided or this
- * method can automatically determine the <code>address</code> of
- * an endpoint that is published by the same Java EE application and is
- * identified by the <code>serviceName</code> and
- * <code>portName</code> propeties. If the
<code>address</code> is
- * <code>null</code> and the <code>serviceName</code> and
- * <code>portName</code> do not identify an endpoint published by the
- * same Java EE application, a
- * <code>javax.lang.IllegalArgumentException</code> MUST be thrown.
- *
- * @param address Specifies the address of the target endpoint
- * @param serviceName Qualified name of the service in the WSDL.
- * @param portName Qualified name of the endpoint in the WSDL.
- * @param metadata A list of elements that should be added to the
- * <code>W3CEndpointReference</code> instances
<code>wsa:metadata</code>
- * element.
- * @param wsdlDocumentLocation URL for the WSDL document location for
- * the service.
- * @param referenceParameters Reference parameters to be associated
- * with the returned <code>EndpointReference</code> instance.
- *
- * @return the <code>W3CEndpointReference<code> created from
- * <code>serviceName</code>, <code>portName</code>,
- * <code>metadata</code>,
<code>wsdlDocumentLocation</code>
- * and <code>referenceParameters</code>. This method
- * never returns <code>null</code>.
- *
- * @throws javax.lang.IllegalArgumentException
- * <ul>
- * <li>If the <code>address</code>,
<code>serviceName</code> and
- * <code>portName</code> are all
<code>null</code>.
- * <li>If the <code>serviceName</code> service is
<code>null</code> and the
- * <code>portName> is NOT <code>null</code>.
- * <li>If the <code>address</code> property is
<code>null</code> and
- * the <code>serviceName</code> and
<code>portName</code> do not
- * specify a valid endpoint published by the same Java EE
- * application.
- * <li>If the <code>serviceName</code>is NOT
<code>null</code>
- * and is not present in the specified WSDL.
- * <li>If the <code>portName</code> port is not
<code>null<code> and it
- * is not present in <code>serviceName</code> service in the
WSDL.
- * <li>If the <code>wsdlDocumentLocation</code> is NOT
<code>null</code>
- * and does not represent a valid WSDL.
- * </ul>
- * @throws WebServiceException If an error occurs while creating the
- * <code>W3CEndpointReference</code>.
- *
- * @since JAX-WS 2.1
- */
- public abstract W3CEndpointReference createW3CEndpointReference(String address, QName
serviceName, QName portName,
- List<Element> metadata, String wsdlDocumentLocation,
List<Element> referenceParameters);
+ /**
+ * Creates a new instance of Provider
+ */
+ protected Provider()
+ {
+ }
+
+ /**
+ *
+ * Creates a new provider object.
+ * <p>
+ * The algorithm used to locate the provider subclass to use consists
+ * of the following steps:
+ * <p>
+ * <ul>
+ * <li>
+ * If a resource with the name of
+ * <code>META-INF/services/javax.xml.ws.spi.Provider</code>
+ * exists, then its first line, if present, is used as the UTF-8 encoded
+ * name of the implementation class.
+ * </li>
+ * <li>
+ * If the $java.home/lib/jaxws.properties file exists and it is readable by
+ * the <code>java.util.Properties.load(InputStream)</code> method and it
contains
+ * an entry whose key is <code>javax.xml.ws.spi.Provider</code>, then
the value of
+ * that entry is used as the name of the implementation class.
+ * </li>
+ * <li>
+ * If a system property with the name
<code>javax.xml.ws.spi.Provider</code>
+ * is defined, then its value is used as the name of the implementation class.
+ * </li>
+ * <li>
+ * Finally, a default implementation class name is used.
+ * </li>
+ * </ul>
+ *
+ */
+ public static Provider provider()
+ {
+ try
+ {
+ return (Provider)FactoryLoader.loadFactory(JAXWSPROVIDER_PROPERTY,
DEFAULT_JAXWSPROVIDER);
+ }
+ catch (WebServiceException ex)
+ {
+ throw ex;
+ }
+ catch (Exception ex)
+ {
+ throw new WebServiceException("Unable to createEndpointReference Provider:
" + ex.getMessage());
+ }
+
+ }
+
+ /**
+ * Creates a service delegate object.
+ * <p>
+ * @param wsdlDocumentLocation A URL pointing to the WSDL document
+ * for the service, or <code>null</code> if there isn't one.
+ * @param serviceName The qualified name of the service.
+ * @param serviceClass The service class, which MUST be either
+ * <code>javax.xml.ws.Service</code> or a subclass thereof.
+ * @return The newly created service delegate.
+ */
+ public abstract ServiceDelegate createServiceDelegate(java.net.URL
wsdlDocumentLocation, QName serviceName, Class serviceClass);
+
+ /**
+ *
+ * Creates an endpoint object with the provided binding and implementation
+ * object.
+ *
+ * @param bindingId A URI specifying the desired binding (e.g. SOAP/HTTP)
+ * @param implementor A service implementation object to which
+ * incoming requests will be dispatched. The corresponding
+ * class MUST be annotated with all the necessary Web service
+ * annotations.
+ * @return The newly created endpoint.
+ */
+ public abstract Endpoint createEndpoint(String bindingId, Object implementor);
+
+ /**
+ * Creates and publishes an endpoint object with the specified
+ * address and implementation object.
+ *
+ * @param address A URI specifying the address and transport/protocol
+ * to use. A http: URI MUST result in the SOAP 1.1/HTTP
+ * binding being used. Implementations may support other
+ * URI schemes.
+ * @param implementor A service implementation object to which
+ * incoming requests will be dispatched. The corresponding
+ * class MUST be annotated with all the necessary Web service
+ * annotations.
+ * @return The newly created endpoint.
+ */
+ public abstract Endpoint createAndPublishEndpoint(String address, Object
implementor);
+
+ /**
+ * read an EndpointReference from the infoset contained in
+ * <code>eprInfoset</code>.
+ *
+ * @returns the <code>EndpointReference</code> unmarshalled from
+ * <code>eprInfoset</code>. This method never returns
<code>null</code>.
+ *
+ * @throws WebServiceException If there is an error creating the
+ * <code>EndpointReference</code> from the specified
<code>eprInfoset</code>.
+ *
+ * @throws NullPointerException If the <code>null</code>
+ * <code>eprInfoset</code> value is given.
+ *
+ * @since JAX-WS 2.1
+ **/
+ public abstract EndpointReference readEndpointReference(javax.xml.transform.Source
eprInfoset);
+
+ /**
+ * Create an EndpointReference for <code>serviceName</code>
+ * service and <code>portName</code> port from the WSDL
<code>wsdlDocumentLocation</code>. The instance
+ * returned will be of type <code>clazz</code> and contain the
<code>referenceParameters</code>
+ * reference parameters. This method delegates to the vendor specific
+ * implementation of the {@link
javax.xml.ws.spi.Provider#createEndpointReference(Class<T>,
javax.xml.namespace.QName, javax.xml.namespace.QName, javax.xml.transform.Source,
org.w3c.dom.Element...)} method.
+ *
+ * @param clazz Specifies the type of <code>EndpointReference</code> that
MUST be returned.
+ * @param serviceName Qualified name of the service in the WSDL.
+ * @param portName Qualified name of the endpoint in the WSDL.
+ * @param wsdlDocumentLocation URL for the WSDL document location for the service.
+ * @param referenceParameters Reference parameters to be associated with the
+ * returned <code>EndpointReference</code> instance.
+ *
+ * @return the EndpointReference created from <code>serviceName</code>,
<code>portName</code>,
+ * <code>wsdlDocumentLocation</code> and
<code>referenceParameters</code>. This method
+ * never returns <code>null</code>.
+ * @throws WebServiceException
+ * <UL>
+ * <li>If the <code>serviceName</code> service is not
present in the WSDL.
+ * <li>If the <code>portName</code> port is not present
in <code>serviceName</code> service in the WSDL.
+ * <li>If the <code>wsdlDocumentLocation</code> does not
represent a valid WSDL.
+ * <li>If an error occurs while creating the
<code>EndpointReference</code>.
+ * <li>If the Class <code>clazz</code> is not supported
by this implementation.
+ * </UL>
+ * @throws java.lang.IllegalArgumentException
+ * if any of the <code>clazz</code>,
<code>serviceName</code>, <code>portName</code> and
<code>wsdlDocumentLocation</code> is null.
+ */
+ public abstract <T extends EndpointReference> T
createEndpointReference(Class<T> clazz, QName serviceName, QName portName, Source
wsdlDocumentLocation,
+ Element... referenceParameters);
+
+ /**
+ * The getPort method returns a proxy. If there
+ * are any reference parameters in the
+ * <code>endpointReference</code>, then those reference
+ * parameters MUST appear as SOAP headers, indicating them to be
+ * reference parameters, on all messages sent to the endpoint.
+ * The parameter <code>serviceEndpointInterface</code> specifies
+ * the service endpoint interface that is supported by the
+ * returned proxy.
+ * The parameter <code>endpointReference</code> specifies the
+ * endpoint that will be invoked by the returned proxy.
+ * In the implementation of this method, the JAX-WS
+ * runtime system takes the responsibility of selecting a protocol
+ * binding (and a port) and configuring the proxy accordingly from
+ * the WSDL Metadata from the <code>EndpointReference</code>.
+ *
+ *
+ * @param endpointReference the EndpointReference that will
+ * be invoked by the returned proxy.
+ * @param serviceEndpointInterface Service endpoint interface
+ * @param features A list of WebServiceFeatures to configure on the
+ * proxy. Supported features not in the <code>features
+ * </code> parameter will have their default values.
+ * @return Object Proxy instance that supports the
+ * specified service endpoint interface
+ * @throws WebServiceException
+ * <UL>
+ * <LI>If there is an error during creation
+ * of the proxy
+ * <LI>If there is any missing WSDL metadata
+ * as required by this method
+ * <LI>If this
+ * <code>endpointReference</code>
+ * is illegal
+ * <LI>If an illegal
+ * <code>serviceEndpointInterface</code>
+ * is specified
+ * <LI>If feature is enabled that is not compatible with
+ * this port or is unsupported.
+ * </UL>
+ *
+ * @see WebServiceFeature
+ *
+ * @since JAX-WS 2.1
+ **/
+ public abstract <T> T getPort(EndpointReference endpointReference,
Class<T> serviceEndpointInterface, WebServiceFeature... features);
+
+ /**
+ * Factory method to create a <code>W3CEndpointReference</code>.
+ *
+ * <p>
+ * This method can be used to create a <code>W3CEndpointReference</code>
+ * for any endpoint by specifying the <code>address</code> property along
+ * with any other desired properties. This method
+ * can also be used to create a <code>W3CEndpointReference</code> for
+ * an endpoint that is published by the same Java EE application.
+ * To do so the <code>address</code> property can be provided or this
+ * method can automatically determine the <code>address</code> of
+ * an endpoint that is published by the same Java EE application and is
+ * identified by the <code>serviceName</code> and
+ * <code>portName</code> propeties. If the
<code>address</code> is
+ * <code>null</code> and the <code>serviceName</code> and
+ * <code>portName</code> do not identify an endpoint published by the
+ * same Java EE application, a
+ * <code>javax.lang.IllegalArgumentException</code> MUST be thrown.
+ *
+ * @param address Specifies the address of the target endpoint
+ * @param serviceName Qualified name of the service in the WSDL.
+ * @param portName Qualified name of the endpoint in the WSDL.
+ * @param metadata A list of elements that should be added to the
+ * <code>W3CEndpointReference</code> instances
<code>wsa:metadata</code>
+ * element.
+ * @param wsdlDocumentLocation URL for the WSDL document location for
+ * the service.
+ * @param referenceParameters Reference parameters to be associated
+ * with the returned <code>EndpointReference</code> instance.
+ *
+ * @return the <code>W3CEndpointReference<code> created from
+ * <code>serviceName</code>, <code>portName</code>,
+ * <code>metadata</code>,
<code>wsdlDocumentLocation</code>
+ * and <code>referenceParameters</code>. This method
+ * never returns <code>null</code>.
+ *
+ * @throws javax.lang.IllegalArgumentException
+ * <ul>
+ * <li>If the <code>address</code>,
<code>serviceName</code> and
+ * <code>portName</code> are all
<code>null</code>.
+ * <li>If the <code>serviceName</code> service is
<code>null</code> and the
+ * <code>portName> is NOT <code>null</code>.
+ * <li>If the <code>address</code> property is
<code>null</code> and
+ * the <code>serviceName</code> and
<code>portName</code> do not
+ * specify a valid endpoint published by the same Java EE
+ * application.
+ * <li>If the <code>serviceName</code>is NOT
<code>null</code>
+ * and is not present in the specified WSDL.
+ * <li>If the <code>portName</code> port is not
<code>null<code> and it
+ * is not present in <code>serviceName</code> service in the
WSDL.
+ * <li>If the <code>wsdlDocumentLocation</code> is NOT
<code>null</code>
+ * and does not represent a valid WSDL.
+ * </ul>
+ * @throws WebServiceException If an error occurs while creating the
+ * <code>W3CEndpointReference</code>.
+ *
+ * @since JAX-WS 2.1
+ */
+ public abstract W3CEndpointReference createW3CEndpointReference(String address, QName
serviceName, QName portName, List<Element> metadata,
+ String wsdlDocumentLocation, List<Element> referenceParameters);
}
Modified: trunk/src/main/java/org/jboss/ws/core/server/HttpServer.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/server/HttpServer.java 2006-12-15 14:53:18 UTC
(rev 1659)
+++ trunk/src/main/java/org/jboss/ws/core/server/HttpServer.java 2006-12-15 15:59:56 UTC
(rev 1660)
@@ -26,10 +26,9 @@
import java.util.HashMap;
import java.util.Map;
+import javax.xml.soap.FactoryLoader;
import javax.xml.ws.Endpoint;
-import org.jboss.ws.core.jaxws.util.FactoryFinder;
-
/**
* An abstract HTTP Server
*
@@ -54,7 +53,7 @@
*/
public static HttpServer create()
{
- HttpServer server = (HttpServer)FactoryFinder.find(HTTP_SERVER_PROPERTY,
DEFAULT_HTTP_SERVER_PROPERTY);
+ HttpServer server = (HttpServer)FactoryLoader.loadFactory(HTTP_SERVER_PROPERTY,
DEFAULT_HTTP_SERVER_PROPERTY);
return server;
}
Modified: trunk/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java 2006-12-15
14:53:18 UTC (rev 1659)
+++ trunk/src/main/java/org/jboss/ws/core/server/WSDLFilePublisher.java 2006-12-15
15:59:56 UTC (rev 1660)
@@ -44,6 +44,7 @@
import org.jboss.ws.WSException;
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.core.utils.IOUtils;
+import org.jboss.ws.core.utils.ResourceURL;
import org.jboss.ws.metadata.umdm.ServiceMetaData;
import org.jboss.ws.metadata.umdm.UnifiedMetaData;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
@@ -214,7 +215,8 @@
resourcePath = resourcePath + "/";
resourcePath = expLocation + resourcePath + schemaLocation;
- InputStream is = udi.classLoader.getResourceAsStream(resourcePath);
+ URL resourceURL = udi.getMetaDataFile(resourcePath);
+ InputStream is = new ResourceURL(resourceURL).openStream();
if (is == null)
throw new IllegalArgumentException("Cannot find schema import
in deployment: " + resourcePath);
Modified: trunk/src/main/java/org/jboss/ws/core/utils/JBossWSEntityResolver.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/core/utils/JBossWSEntityResolver.java 2006-12-15
14:53:18 UTC (rev 1659)
+++ trunk/src/main/java/org/jboss/ws/core/utils/JBossWSEntityResolver.java 2006-12-15
15:59:56 UTC (rev 1660)
@@ -24,6 +24,8 @@
// $Id$
import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
import java.net.URL;
import org.jboss.logging.Logger;
@@ -47,7 +49,7 @@
registerEntity("urn:jboss:jaxrpc-config:2.0",
"schema/jaxrpc-config_2_0.xsd");
registerEntity("urn:jboss:jaxws-config:2.0",
"schema/jaxws-config_2_0.xsd");
registerEntity("http://java.sun.com/xml/ns/javaee",
"schema/javaee_web_services_1_2.xsd");
-
registerEntity("http://www.w3.org/2005/08/addressing",
"schema/ws-addr.xsd");
+
registerEntity("http://www.w3.org/2005/08/addressing",
"schema/ws-addr.xsd");
registerEntity("http://schemas.xmlsoap.org/ws/2004/08/eventing",
"eventing.xsd");
}
@@ -55,28 +57,62 @@
{
log.debug("resolveEntity: [pub=" + publicId + ",sysid=" +
systemId + "]");
InputSource inputSource = super.resolveEntity(publicId, systemId);
+
+ if (inputSource == null)
+ {
+ inputSource = resolveSystemIDasURL(systemId, log.isTraceEnabled());
+ }
+
return inputSource;
}
-
- public URL resolveNamespaceURI(String nsURI)
+
+ /** This method should be protected in the super class. */
+ protected InputSource resolveSystemIDasURL(String systemId, boolean trace)
{
- URL url = null;
-
- String resource = (String)getEntityMap().get(nsURI);
- if (resource != null)
+ if (systemId == null)
+ return null;
+
+ if (trace)
+ log.trace("resolveSystemIDasURL, systemId=" + systemId);
+
+ InputSource inputSource = null;
+
+ // Try to use the systemId as a URL to the schema
+ try
{
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
- url = loader.getResource(resource);
- if( url == null )
+ if (trace)
+ log.trace("Trying to resolve systemId as a URL");
+
+ URL url = new URL(systemId);
+ if (url.getProtocol().equalsIgnoreCase("file") == false)
{
- if( resource.endsWith(".dtd") )
- resource = "dtd/" + resource;
- else if( resource.endsWith(".xsd") )
- resource = "schema/" + resource;
- url = loader.getResource(resource);
+ log.warn("Trying to resolve systemId as a non-file URL: " +
systemId);
}
+
+ InputStream ins = new ResourceURL(url).openStream();
+ if (ins != null)
+ {
+ inputSource = new InputSource(ins);
+ inputSource.setSystemId(systemId);
+ }
+ else
+ {
+ log.warn("Cannot load systemId as URL: " + systemId);
+ }
+
+ if (trace)
+ log.trace("Resolved systemId as a URL");
}
-
- return url;
+ catch (MalformedURLException ignored)
+ {
+ if (trace)
+ log.trace("SystemId is not a url: " + systemId, ignored);
+ }
+ catch (IOException e)
+ {
+ if (trace)
+ log.trace("Failed to obtain URL.InputStream from systemId: " +
systemId, e);
+ }
+ return inputSource;
}
}
Modified:
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSEntityResolver.java
===================================================================
---
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSEntityResolver.java 2006-12-15
14:53:18 UTC (rev 1659)
+++
trunk/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSEntityResolver.java 2006-12-15
15:59:56 UTC (rev 1660)
@@ -35,6 +35,7 @@
import org.apache.xerces.xni.parser.XMLInputSource;
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
+import org.jboss.ws.core.utils.ResourceURL;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
@@ -162,7 +163,7 @@
private XMLInputSource getXMLInputSource(URL url, XMLResourceIdentifier resId) throws
IOException
{
- InputStream inputStream = url.openStream();
+ InputStream inputStream = new ResourceURL(url).openStream();
InputSource inputSource = new InputSource(inputStream);
return getXMLInputSource(inputSource, resId);
}
Modified: trunk/src/main/java/org/jboss/ws/tools/JavaToXSD.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/tools/JavaToXSD.java 2006-12-15 14:53:18 UTC (rev
1659)
+++ trunk/src/main/java/org/jboss/ws/tools/JavaToXSD.java 2006-12-15 15:59:56 UTC (rev
1660)
@@ -31,16 +31,19 @@
import javax.xml.namespace.QName;
+import org.apache.xerces.impl.xs.SchemaGrammar;
import org.apache.xerces.impl.xs.XMLSchemaLoader;
+import org.apache.xerces.impl.xs.XSModelImpl;
+import org.apache.xerces.xni.parser.XMLInputSource;
import org.apache.xerces.xs.XSModel;
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
import org.jboss.ws.core.utils.JBossWSEntityResolver;
+import org.jboss.ws.core.utils.ResourceURL;
import org.jboss.ws.metadata.wsdl.WSDLUtils;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSEntityResolver;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSErrorHandler;
import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel;
-import org.jboss.ws.metadata.wsdl.xmlschema.JBossXSStringList;
import org.jboss.ws.metadata.wsdl.xmlschema.WSSchemaUtils;
import org.jboss.ws.metadata.wsdl.xsd.SchemaUtils;
import org.jboss.ws.tools.helpers.JavaToXSDHelper;
@@ -129,11 +132,11 @@
JBossWSEntityResolver resolver = new JBossWSEntityResolver();
JBossXSEntityResolver xsresolve = new JBossXSEntityResolver(resolver, new
HashMap<String, URL>());
XMLSchemaLoader loader = (XMLSchemaLoader)schemautils.getXSLoader(xserr,
xsresolve);
-
+
XSModel xsmodel = loader.loadURI(xsdURL.toExternalForm());
if (xsmodel == null)
throw new WSException("Cannot load schema: " + xsdURL);
-
+
WSSchemaUtils sutils = WSSchemaUtils.getInstance(null, null);
JBossXSModel jbxs = new JBossXSModel();
sutils.copyXSModel(xsmodel, jbxs);
@@ -154,34 +157,61 @@
JBossWSEntityResolver resolver = new JBossWSEntityResolver();
JBossXSEntityResolver xsresolve = new JBossXSEntityResolver(resolver, locs);
XMLSchemaLoader loader = (XMLSchemaLoader)schemautils.getXSLoader(xserr,
xsresolve);
-
- JBossXSStringList slist = new JBossXSStringList();
- Iterator<String> keys = locs.keySet().iterator();
- while (keys.hasNext())
+
+ int index = 0;
+ SchemaGrammar[] gs = new SchemaGrammar[locs.size()];
+ Iterator<String> it = locs.keySet().iterator();
+ while (it.hasNext())
{
- String nsURI = keys.next();
- URL orgURL = locs.get(nsURI);
- URL resURL = resolver.resolveNamespaceURI(nsURI);
- URL url = resURL != null ? resURL : orgURL;
- log.debug("load schema: " + nsURI + "=" + url);
- slist.addItem(url.toExternalForm());
+ try
+ {
+ String nsURI = it.next();
+ URL orgURL = locs.get(nsURI);
+ URL resURL = resolveNamespaceURI(resolver, nsURI);
+ URL url = resURL != null ? resURL : orgURL;
+ log.debug("Load schema: " + nsURI + "=" + url);
+ XMLInputSource inputSource = new XMLInputSource(null, url.toExternalForm(),
null);
+ inputSource.setByteStream(new ResourceURL(url).openStream());
+ gs[index++] = (SchemaGrammar)loader.loadGrammar(inputSource);
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot parse schema", ex);
+ return null;
+ }
}
-
- XSModel xsmodel = loader.loadURIList(slist);
- if (xsmodel == null)
- throw new WSException("Cannot load schema: " + slist);
+ XSModel xsmodel = new XSModelImpl(gs);
- //TODO: Once JBXB-33 is fixed, migrate Schema Parsing to XB
- //XSModel xsmodel = Util.loadSchema(slist,this.getSchemaBindingResolver(locs));
-
// Convert Xerces XSModel into r/w JBossXSModel
WSSchemaUtils sutils = WSSchemaUtils.getInstance(null, null);
JBossXSModel jbxs = new JBossXSModel();
sutils.copyXSModel(xsmodel, jbxs);
-
+
return jbxs;
}
+ private URL resolveNamespaceURI(JBossWSEntityResolver resolver, String nsURI)
+ {
+ URL url = null;
+
+ String resource = (String)resolver.getEntityMap().get(nsURI);
+ if (resource != null)
+ {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ url = loader.getResource(resource);
+ if (url == null)
+ {
+ if (resource.endsWith(".dtd"))
+ resource = "dtd/" + resource;
+ else if (resource.endsWith(".xsd"))
+ resource = "schema/" + resource;
+ url = loader.getResource(resource);
+ }
+ }
+
+ return url;
+ }
+
/**
* @see
org.jboss.ws.tools.interfaces.JavaToXSDIntf#setPackageNamespaceMap(java.util.Map)
*/
@@ -207,7 +237,8 @@
*/
private SchemaBindingResolver getSchemaBindingResolver(final Map<String, URL>
map)
{
- return new SchemaBindingResolver() {
+ return new SchemaBindingResolver()
+ {
public String getBaseURI()
{
throw new UnsupportedOperationException("getBaseURI is not
implemented.");
Modified: trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2006-12-15 14:53:18 UTC
(rev 1659)
+++ trunk/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2006-12-15 15:59:56 UTC
(rev 1660)
@@ -70,6 +70,7 @@
import org.jboss.ws.core.jaxrpc.Style;
import org.jboss.ws.core.utils.DOMUtils;
import org.jboss.ws.core.utils.DOMWriter;
+import org.jboss.ws.core.utils.ResourceURL;
import org.jboss.ws.metadata.wsdl.NCName;
import org.jboss.ws.metadata.wsdl.WSDLBinding;
import org.jboss.ws.metadata.wsdl.WSDLBindingMessageReference;
@@ -320,7 +321,7 @@
throw new IllegalArgumentException("schemaLocation is null for
xsd:import");
URL locationURL = getLocationURL(wsdlLoc, location);
- Element rootElement = DOMUtils.parse(locationURL.openStream());
+ Element rootElement = DOMUtils.parse(new ResourceURL(locationURL).openStream());
URL newloc = processSchemaInclude(types, locationURL, rootElement);
if (newloc != null)
importEl.setAttribute("schemaLocation", newloc.toExternalForm());
@@ -354,7 +355,7 @@
throw new IllegalArgumentException("schemaLocation is null for
xsd:include");
URL locationURL = getLocationURL(wsdlLoc, location);
- Element rootElement = DOMUtils.parse(locationURL.openStream());
+ Element rootElement = DOMUtils.parse(new
ResourceURL(locationURL).openStream());
URL newloc = processSchemaInclude(types, locationURL, rootElement);
if (newloc != null)
includeEl.setAttribute("schemaLocation", newloc.toExternalForm());
Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanPayload.java
===================================================================
---
trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanPayload.java 2006-12-15
14:53:18 UTC (rev 1659)
+++
trunk/src/test/java/org/jboss/test/ws/jaxws/provider/ProviderBeanPayload.java 2006-12-15
15:59:56 UTC (rev 1660)
@@ -24,40 +24,43 @@
// $Id$
import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import javax.xml.ws.Provider;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceProvider;
-import org.jboss.ws.core.utils.DOMUtils;
-import org.jboss.ws.core.utils.DOMWriter;
-import org.w3c.dom.Element;
-
/**
* Test a Provider<Source>
*
* @author Thomas.Diesler(a)jboss.org
* @since 29-Jun-2006
*/
-@WebServiceProvider(
- serviceName = "ProviderService",
- portName = "ProviderPort",
- targetNamespace = "http://org.jboss.ws/provider",
- wsdlLocation = "WEB-INF/wsdl/Provider.wsdl")
-// in absence PAYLOAD is implicit
-// @ServiceMode(value = Service.Mode.PAYLOAD)
+@WebServiceProvider(serviceName = "ProviderService", portName =
"ProviderPort", targetNamespace = "http://org.jboss.ws/provider",
wsdlLocation = "WEB-INF/wsdl/Provider.wsdl")
+// @ServiceMode(value = Service.Mode.PAYLOAD) in absence PAYLOAD is implicit
public class ProviderBeanPayload implements Provider<Source>
{
public Source invoke(Source req)
{
try
{
- Element reqPayload = DOMUtils.parse(((StreamSource)req).getInputStream());
- String xmlReq = DOMWriter.printNode(reqPayload, false);
+ Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION,
"yes");
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+ OutputStream out = new ByteArrayOutputStream();
+ StreamResult streamResult = new StreamResult();
+ streamResult.setOutputStream(out);
+ transformer.transform(req, streamResult);
+ String xmlReq = streamResult.getOutputStream().toString();
- String expReq = "<ns1:somePayload
xmlns:ns1='http://org.jboss.ws/provider'/>";
+ String expReq = "<ns1:somePayload
xmlns:ns1=\"http://org.jboss.ws/provider\"/>";
if (!expReq.equals(xmlReq))
throw new WebServiceException("Unexpected payload: " + xmlReq);
Modified: trunk/src/test/resources/jaxws/eardeployment/WEB-INF/wsdl/TestEndpoint.wsdl
===================================================================
--- trunk/src/test/resources/jaxws/eardeployment/WEB-INF/wsdl/TestEndpoint.wsdl 2006-12-15
14:53:18 UTC (rev 1659)
+++ trunk/src/test/resources/jaxws/eardeployment/WEB-INF/wsdl/TestEndpoint.wsdl 2006-12-15
15:59:56 UTC (rev 1660)
@@ -7,7 +7,12 @@
-->
<definitions name="TestEndpointService"
targetNamespace="http://eardeployment.jaxws.ws.test.jboss.org/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://eardeployment.jaxws.ws.test.jboss.org/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <types/>
+
+ <!-- Test a schema import -->
+ <types>
+ <xsd:import namespace="http://org.jboss.ws/jaxrpc/types"
schemaLocation="TestService.xsd"/>
+ </types>
+
<message name="TestEndpoint_echoResponse">
<part name="return" type="xsd:string"/>
</message>
Copied: trunk/src/test/resources/jaxws/eardeployment/WEB-INF/wsdl/TestService.xsd (from
rev 1659,
branches/tdiesler/trunk/src/test/resources/jaxws/eardeployment/WEB-INF/wsdl/TestService.xsd)