[jboss-svn-commits] JBossWS SVN: r728 - in branches/tdiesler/trunk: . src/main/java/org/jboss/ws src/main/java/org/jboss/ws/deployment src/main/java/org/jboss/ws/jaxws/core src/main/java/org/jboss/ws/metadata src/main/java/org/jboss/ws/metadata/wsdl src/main/java/org/jboss/ws/soap src/main/java/org/jboss/ws/tools src/main/java/org/jboss/ws/tools/helpers src/test/ant src/test/java/org/jboss/test/ws src/test/java/org/jboss/test/ws/encoded/parametermode src/test/java/org/jboss/test/ws/samples/wsaddressing
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Aug 12 13:51:01 EDT 2006
Author: thomas.diesler at jboss.com
Date: 2006-08-12 13:50:27 -0400 (Sat, 12 Aug 2006)
New Revision: 728
Added:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java
Removed:
branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/AbstractAnnotationsMetaDataBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/AbstractMetaDataBuilder.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/jaxb/
Modified:
branches/tdiesler/trunk/progress.txt
branches/tdiesler/trunk/src/main/java/org/jboss/ws/Constants.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JAXWSClientMetaDataBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JAXWSMetaDataBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR109MetaDataBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/BindingImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Reader.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Writer.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLWriter.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL11.java
branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java
branches/tdiesler/trunk/src/test/ant/build-jars.xml
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/encoded/parametermode/ParameterModeTestCase.java
branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/samples/wsaddressing/AddressingHandler.java
Log:
Generate WSDL with SOAP-1.2 binding
Add SOAP-1.2 binding test case
Modified: branches/tdiesler/trunk/progress.txt
===================================================================
--- branches/tdiesler/trunk/progress.txt 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/progress.txt 2006-08-12 17:50:27 UTC (rev 728)
@@ -1 +1,3 @@
-* implement SOAP-1.2 binding
\ No newline at end of file
+Implement SOAP-1.2 binding
+Generate WSDL with SOAP-1.2 binding
+Add SOAP-1.2 binding test case
\ No newline at end of file
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/Constants.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/Constants.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/Constants.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -54,6 +54,8 @@
static final String NS_SOAP11 = "http://schemas.xmlsoap.org/wsdl/soap/";
/** SOAP-1.1 envelope namespace http://schemas.xmlsoap.org/soap/envelope/ */
static final String NS_SOAP11_ENV = "http://schemas.xmlsoap.org/soap/envelope/";
+ /** SOAP-1.2 namespace http://schemas.xmlsoap.org/wsdl/soap12/ */
+ static final String NS_SOAP12 = "http://schemas.xmlsoap.org/wsdl/soap12/";
/** SOAP-1.2 envelope namespace http://www.w3.org/2003/05/soap-envelope */
static final String NS_SOAP12_ENV = "http://www.w3.org/2003/05/soap-envelope";
/** The namespace for the SwA mime type */
@@ -69,7 +71,9 @@
/** SOAP-1.1 encoding URI */
static final String URI_SOAP11_ENC = "http://schemas.xmlsoap.org/soap/encoding/";
- /** Literal encoding URI */
+ /** SOAP-1.2 encoding URI */
+ static final String URI_SOAP12_ENC = "http://www.w3.org/2003/05/soap-encoding";
+ /** Literal encoding URI */
static final String URI_LITERAL_ENC = "";
/** WSDL 2.0 Encoding Rules */
static final String URI_STYLE_RPC = "http://www.w3.org/2004/03/wsdl/style/rpc";
@@ -81,7 +85,8 @@
// Some prefixes
static final String PREFIX_ENV = "env";
static final String PREFIX_XMIME = "xmime";
- static final String PREFIX_SOAP = "soap";
+ static final String PREFIX_SOAP11 = "soap";
+ static final String PREFIX_SOAP12 = "soap12";
static final String PREFIX_SOAP11_ENC = "soap11-enc";
static final String PREFIX_TNS = "tns";
static final String PREFIX_WSDL = "wsdl";
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/AbstractAnnotationsMetaDataBuilder.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/AbstractAnnotationsMetaDataBuilder.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/AbstractAnnotationsMetaDataBuilder.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -1,184 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.deployment;
-
-// $Id$
-
-import java.io.File;
-import java.io.IOException;
-import java.io.Writer;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.annotation.PortComponent;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.ServiceMetaData;
-import org.jboss.ws.metadata.UnifiedMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
-import org.jboss.ws.metadata.jaxrpcmapping.JavaWsdlMapping;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.server.ServerConfig;
-import org.jboss.ws.server.ServerConfigFactory;
-import org.jboss.ws.tools.JavaToWSDL;
-import org.jboss.ws.utils.IOUtils;
-
-/** An abstract annotation meta data builder.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 27-Jun-2005
- */
-public abstract class AbstractAnnotationsMetaDataBuilder extends AbstractMetaDataBuilder
-{
- // provide logging
- private final Logger log = Logger.getLogger(AbstractAnnotationsMetaDataBuilder.class);
-
- public AbstractAnnotationsMetaDataBuilder()
- {
- }
-
- protected void processOrGenerateWSDL(Class wsClass, ServiceMetaData serviceMetaData, String wsdlLocation, EndpointMetaData endpointMetaData)
- {
- if (wsdlLocation.length() > 0)
- {
- serviceMetaData.setWsdlFile(wsdlLocation);
- }
- else
- {
- // Generate the wsdl
- ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- UnifiedMetaData wsMetaData = serviceMetaData.getUnifiedMetaData();
- Thread.currentThread().setContextClassLoader(wsMetaData.getClassLoader());
- String serviceName = serviceMetaData.getQName().getLocalPart();
-
- JavaToWSDL javaToWSDL = new JavaToWSDL(Constants.NS_WSDL11);
- javaToWSDL.setUnifiedMetaData(wsMetaData);
- javaToWSDL.setQualifiedElements(true);
- WSDLDefinitions wsdlDefinitions = javaToWSDL.generate(wsClass);
-
- // Add generated mapping
- JavaWsdlMapping mapping = javaToWSDL.getJavaWsdlMapping();
- String fakeMappingName = serviceName + "-annotation-generated";
- serviceMetaData.setJaxrpcMappingFile(fakeMappingName);
- serviceMetaData.getUnifiedMetaData().addMappingDefinition(fakeMappingName, mapping);
-
- ServerConfigFactory factory = ServerConfigFactory.getInstance();
- ServerConfig config = factory.getServerConfig();
- File tmpdir = new File(config.getServerTempDir().getCanonicalPath() + "/jbossws");
- tmpdir.mkdirs();
-
- File wsdlTmpFile = File.createTempFile(serviceName, ".wsdl", tmpdir);
- wsdlTmpFile.deleteOnExit();
-
- Writer writer = IOUtils.getCharsetFileWriter(wsdlTmpFile, Constants.DEFAULT_XML_CHARSET);
- wsdlDefinitions.write(writer, Constants.DEFAULT_XML_CHARSET);
- writer.close();
-
- serviceMetaData.setWsdlFile(wsdlTmpFile.toURL().toExternalForm());
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (IOException e)
- {
- throw new WSException("Cannot write generated wsdl", e);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(ctxLoader);
- }
- }
- }
-
- protected void processPortComponent(UnifiedDeploymentInfo udi, Class wsClass, String linkName, ServerEndpointMetaData epMetaData)
- {
- String contextRoot = null;
-
- // init contextRoot from jboss-web.xml
- if (udi.metaData instanceof UnifiedWebMetaData)
- {
- UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
- contextRoot = webMetaData.getContextRoot();
- }
-
- PortComponent anPortComponent = (PortComponent)wsClass.getAnnotation(PortComponent.class);
- if (anPortComponent != null)
- {
- if (anPortComponent.contextRoot().length() > 0)
- {
- contextRoot = anPortComponent.contextRoot();
- }
- else
- {
- String shortName = udi.shortName;
- contextRoot = "/" + shortName.substring(0, shortName.indexOf('.'));
- }
- epMetaData.setContextRoot(contextRoot);
-
- String urlPattern;
- if (anPortComponent.urlPattern().length() > 0)
- {
- urlPattern = anPortComponent.urlPattern();
- }
- else
- {
- urlPattern = "/" + linkName;
- }
- epMetaData.setURLPattern(urlPattern);
-
- String servicePath = contextRoot + urlPattern;
- epMetaData.setEndpointAddress(getServiceEndpointAddress(null, servicePath));
-
- // setup authetication method
- String authMethod = anPortComponent.authMethod();
- if (authMethod.length() > 0)
- epMetaData.setAuthMethod(authMethod);
-
- // setup transport guarantee
- String transportGuarantee = anPortComponent.transportGuarantee();
- if (transportGuarantee.length() > 0)
- epMetaData.setTransportGuarantee(transportGuarantee);
- }
- else
- {
- if (contextRoot == null)
- {
- String shortName = udi.shortName;
- contextRoot = "/" + shortName.substring(0, shortName.indexOf('.'));
- }
- epMetaData.setContextRoot(contextRoot);
-
- String urlPattern = "/" + linkName;
- epMetaData.setURLPattern(urlPattern);
-
- String servicePath = contextRoot + urlPattern;
- epMetaData.setEndpointAddress(getServiceEndpointAddress(null, servicePath));
- }
-
- // replace the SOAP address
- replaceAddressLocation(epMetaData);
- }
-}
Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/AbstractMetaDataBuilder.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/AbstractMetaDataBuilder.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/AbstractMetaDataBuilder.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -1,416 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.deployment;
-
-// $Id$
-
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.management.ObjectName;
-import javax.wsdl.Definition;
-import javax.wsdl.Import;
-import javax.wsdl.Port;
-import javax.wsdl.Service;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.xml.namespace.QName;
-import javax.xml.ws.addressing.AddressingProperties;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
-import org.jboss.ws.addressing.AddressingPropertiesImpl;
-import org.jboss.ws.addressing.metadata.AddressingOpMetaExt;
-import org.jboss.ws.eventing.EventingConstants;
-import org.jboss.ws.eventing.deployment.EventingEndpoint;
-import org.jboss.ws.eventing.metadata.EventingEpMetaExt;
-import org.jboss.ws.jaxrpc.UnqualifiedFaultException;
-import org.jboss.ws.jaxrpc.Use;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.FaultMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.metadata.ServerEndpointMetaData;
-import org.jboss.ws.metadata.TypesMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
-import org.jboss.ws.metadata.j2ee.UnifiedMessageDrivenMetaData;
-import org.jboss.ws.metadata.wsdl.NCName;
-import org.jboss.ws.metadata.wsdl.WSDLBinding;
-import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
-import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
-import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
-import org.jboss.ws.metadata.wsdl.WSDLInterface;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceFault;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation;
-import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutfault;
-import org.jboss.ws.metadata.wsdl.WSDLProperty;
-import org.jboss.ws.metadata.wsdl.WSDLService;
-import org.jboss.ws.server.ServiceEndpointManager;
-import org.jboss.ws.server.ServiceEndpointManagerFactory;
-import org.jboss.ws.utils.ObjectNameFactory;
-
-/** An abstract meta data builder.
- *
- * @author Thomas.Diesler at jboss.org
- * @since 19-May-2005
- */
-public abstract class AbstractMetaDataBuilder
-{
- // provide logging
- private final static Logger log = Logger.getLogger(AbstractMetaDataBuilder.class);
-
- protected ClassLoader classLoader;
- protected URLClassLoader resourceLoader;
-
- public void setClassLoader(ClassLoader classLoader)
- {
- this.classLoader = classLoader;
- }
-
- public void setResourceLoader(URLClassLoader resourceLoader)
- {
- this.resourceLoader = resourceLoader;
- }
-
- /** Initialize the endpoint encoding style from the binding operations
- */
- protected void initEndpointEncodingStyle(EndpointMetaData epMetaData)
- {
- WSDLDefinitions wsdlDefinitions = epMetaData.getServiceMetaData().getWsdlDefinitions();
- for (WSDLService wsdlService : wsdlDefinitions.getServices())
- {
- for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
- {
- if (epMetaData.getQName().equals(wsdlEndpoint.getQName()))
- {
- QName bindQName = wsdlEndpoint.getBinding();
- NCName ncName = new NCName(bindQName.getLocalPart());
- WSDLBinding wsdlBinding = wsdlDefinitions.getBinding(ncName);
- if (wsdlBinding == null)
- throw new WSException("Cannot obtain binding: " + ncName);
-
- for (WSDLBindingOperation wsdlBindingOperation : wsdlBinding.getOperations())
- {
- String encStyle = wsdlBindingOperation.getEncodingStyle();
- epMetaData.setEncoding(Use.valueOf(encStyle));
- }
- }
- }
- }
- }
-
- protected void processEndpointMetaDataExtensions(EndpointMetaData epMetaData, WSDLDefinitions wsdlDefinitions)
- {
- for (WSDLInterface wsdlInterface : wsdlDefinitions.getInterfaces())
- {
- WSDLProperty eventSourceProp = wsdlInterface.getProperty(Constants.WSDL_PROPERTY_EVENTSOURCE);
- if (eventSourceProp != null && epMetaData instanceof ServerEndpointMetaData)
- {
- ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
- String eventSourceNS = wsdlInterface.getQName().getNamespaceURI() + "/" + wsdlInterface.getQName().getLocalPart();
- Object notificationSchema = null; // todo: resolve schema from operation message
-
- EventingEpMetaExt ext = new EventingEpMetaExt(EventingConstants.NS_EVENTING);
- ext.setEventSourceNS(eventSourceNS);
- ext.setNotificationSchema(notificationSchema);
-
- sepMetaData.addExtension(ext);
- sepMetaData.setManagedEndpointBean(EventingEndpoint.class.getName());
- }
- }
- }
-
- protected ObjectName getServiceEndpointID(UnifiedDeploymentInfo udi, ServerEndpointMetaData sepMetaData)
- {
- String endpoint = sepMetaData.getLinkName();
- String context = sepMetaData.getContextRoot();
- if (context.startsWith("/"))
- context = context.substring(1);
-
- StringBuilder idstr = new StringBuilder(ServerEndpointMetaData.SEPID_DOMAIN + ":");
- idstr.append(ServerEndpointMetaData.SEPID_PROPERTY_CONTEXT + "=" + context);
- idstr.append("," + ServerEndpointMetaData.SEPID_PROPERTY_ENDPOINT + "=" + endpoint);
-
- // Add JMS destination JNDI name for MDB endpoints
- if (udi.metaData instanceof UnifiedApplicationMetaData)
- {
- String ejbName = sepMetaData.getLinkName();
- if (ejbName == null)
- throw new WSException("Cannot obtain ejb-link from port component");
-
- UnifiedApplicationMetaData applMetaData = (UnifiedApplicationMetaData)udi.metaData;
- UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)applMetaData.getBeanByEjbName(ejbName);
- if (beanMetaData == null)
- throw new WSException("Cannot obtain ejb meta data for: " + ejbName);
-
- if (beanMetaData instanceof UnifiedMessageDrivenMetaData)
- {
- UnifiedMessageDrivenMetaData mdMetaData = (UnifiedMessageDrivenMetaData)beanMetaData;
- String jndiName = mdMetaData.getDestinationJndiName();
- idstr.append(",jms=" + jndiName);
- }
- }
-
- return ObjectNameFactory.create(idstr.toString());
- }
-
- protected void buildFaultMetaData(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation)
- {
- TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
-
- WSDLInterface wsdlInterface = wsdlOperation.getWsdlInterface();
- for (WSDLInterfaceOperationOutfault outFault : wsdlOperation.getOutfaults())
- {
- QName ref = outFault.getRef();
-
- WSDLInterfaceFault wsdlFault = wsdlInterface.getFault(new NCName(ref.getLocalPart()));
- QName xmlName = wsdlFault.getXmlName();
- QName xmlType = wsdlFault.getXmlType();
- String javaTypeName = null;
-
- if (typesMetaData.getTypeMappingByXMLType(xmlType) != null)
- javaTypeName = typesMetaData.getTypeMappingByXMLType(xmlType).getJavaTypeName();
-
- if (javaTypeName == null)
- {
- log.warn("Cannot obtain java type mapping for: " + xmlType);
- javaTypeName = new UnqualifiedFaultException(xmlType).getClass().getName();
- }
-
- FaultMetaData faultMetaData = new FaultMetaData(opMetaData, xmlName, xmlType, javaTypeName);
- opMetaData.addFault(faultMetaData);
- }
- }
-
- /** Process operation meta data extensions. */
- protected void processOpMetaExtensions(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation)
- {
-
- String tns = wsdlOperation.getQName().getNamespaceURI();
- String portTypeName = wsdlOperation.getQName().getLocalPart();
-
- AddressingProperties ADDR = new AddressingPropertiesImpl();
- AddressingOpMetaExt addrExt = new AddressingOpMetaExt(ADDR.getNamespaceURI());
-
- // inbound action
- WSDLProperty wsaInAction = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_ACTION_IN);
- if (wsaInAction != null)
- {
- addrExt.setInboundAction(wsaInAction.getValue());
- }
- else
- {
- WSDLProperty messageName = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_IN);
- addrExt.setInboundAction(tns + "/" + portTypeName + "/" + messageName);
- }
-
- // outbound action
- WSDLProperty wsaOutAction = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_ACTION_OUT);
- if (wsaOutAction != null)
- {
- addrExt.setOutboundAction(wsaOutAction.getValue());
- }
- else
- {
- WSDLProperty messageName = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_OUT);
- addrExt.setOutboundAction(tns + "/" + portTypeName + "/" + messageName);
- }
-
- opMetaData.addExtension(addrExt);
- }
-
- /** Get the web service address for a given path
- */
- public String getServiceEndpointAddress(String uriScheme, String servicePath)
- {
- if (servicePath == null || servicePath.length() == 0)
- throw new WSException("Service path cannot be null");
-
- if (servicePath.endsWith("/*"))
- servicePath = servicePath.substring(0, servicePath.length() - 2);
-
- if (uriScheme == null)
- uriScheme = "http";
-
- ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
- ServiceEndpointManager epManager = factory.getServiceEndpointManager();
- String host = epManager.getWebServiceHost();
- int port = epManager.getWebServicePort();
- if ("https".equals(uriScheme))
- port = epManager.getWebServiceSecurePort();
-
- String urlStr = uriScheme + "://" + host + ":" + port + servicePath;
- try
- {
- return new URL(urlStr).toExternalForm();
- }
- catch (MalformedURLException e)
- {
- throw new WSException("Malformed URL: " + urlStr);
- }
- }
-
- /** Replace the address locations for a given port component.
- */
- protected void replaceAddressLocation(ServerEndpointMetaData epMetaData)
- {
- WSDLDefinitions wsdlDefinitions = epMetaData.getServiceMetaData().getWsdlDefinitions();
- QName portName = epMetaData.getQName();
-
- boolean endpointFound = false;
- for (WSDLService wsdlService : wsdlDefinitions.getServices())
- {
- for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
- {
- QName wsdlPortName = wsdlEndpoint.getQName();
- if (wsdlPortName.equals(portName))
- {
- endpointFound = true;
-
- String orgAddress = wsdlEndpoint.getAddress();
- String uriScheme = getUriScheme(orgAddress);
-
- String transportGuarantee = epMetaData.getTransportGuarantee();
- if ("CONFIDENTIAL".equals(transportGuarantee))
- uriScheme = "https";
-
- String servicePath = epMetaData.getContextRoot() + epMetaData.getURLPattern();
- String serviceEndpointURL = getServiceEndpointAddress(uriScheme, servicePath);
-
- ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
- ServiceEndpointManager epManager = factory.getServiceEndpointManager();
- boolean alwaysModify = epManager.isAlwaysModifySOAPAddress();
-
- if (alwaysModify || uriScheme == null || orgAddress.indexOf("REPLACE_WITH_ACTUAL_URL") >= 0)
- {
- log.debug("Replace service endpoint address '" + orgAddress + "' with '" + serviceEndpointURL + "'");
- wsdlEndpoint.setAddress(serviceEndpointURL);
- epMetaData.setEndpointAddress(serviceEndpointURL);
-
- // modify the wsdl-1.1 definition
- if (wsdlDefinitions.getWsdlOneOneDefinition() != null)
- replaceWSDL11SOAPAddress(wsdlDefinitions, portName, serviceEndpointURL);
- }
- else
- {
- log.debug("Don't replace service endpoint address '" + orgAddress + "'");
- try
- {
- epMetaData.setEndpointAddress(new URL(orgAddress).toExternalForm());
- }
- catch (MalformedURLException e)
- {
- throw new WSException("Malformed URL: " + orgAddress);
- }
- }
- }
- }
- }
-
- if (endpointFound == false)
- throw new WSException("Cannot find port in wsdl: " + portName);
- }
-
- private void replaceWSDL11SOAPAddress(WSDLDefinitions wsdlDefinitions, QName portQName, String serviceEndpointURL)
- {
- Definition wsdlOneOneDefinition = wsdlDefinitions.getWsdlOneOneDefinition();
- String tnsURI = wsdlOneOneDefinition.getTargetNamespace();
-
- // search for matching portElement and replace the address URI
- Port wsdlOneOnePort = modifyPortAddress(tnsURI, portQName, serviceEndpointURL, wsdlOneOneDefinition.getServices());
-
- // recursivly process imports if none can be found
- if (wsdlOneOnePort == null && !wsdlOneOneDefinition.getImports().isEmpty())
- {
-
- Iterator imports = wsdlOneOneDefinition.getImports().values().iterator();
- while (imports.hasNext())
- {
- List l = (List)imports.next();
- Iterator importsByNS = l.iterator();
- while (importsByNS.hasNext())
- {
- Import anImport = (Import)importsByNS.next();
-
- wsdlOneOnePort = modifyPortAddress(anImport.getNamespaceURI(), portQName, serviceEndpointURL, anImport.getDefinition().getServices());
- }
- }
- }
-
- // if it still doesn't exist something is wrong
- if (wsdlOneOnePort == null)
- throw new IllegalArgumentException("Cannot find port with name '" + portQName + "' in wsdl document");
- }
-
- private Port modifyPortAddress(String tnsURI, QName portQName, String serviceEndpointURL, Map services)
- {
-
- Port wsdlOneOnePort = null;
- Iterator itServices = services.values().iterator();
- while (itServices.hasNext())
- {
- Service wsdlOneOneService = (Service)itServices.next();
- Map wsdlOneOnePorts = wsdlOneOneService.getPorts();
- Iterator itPorts = wsdlOneOnePorts.keySet().iterator();
- while (itPorts.hasNext())
- {
- String portLocalName = (String)itPorts.next();
- if (portQName.equals(new QName(tnsURI, portLocalName)))
- {
- wsdlOneOnePort = (Port)wsdlOneOnePorts.get(portLocalName);
- Iterator itElements = wsdlOneOnePort.getExtensibilityElements().iterator();
- while (itElements.hasNext())
- {
- Object obj = itElements.next();
- if (obj instanceof SOAPAddress)
- {
- SOAPAddress address = (SOAPAddress)obj;
- address.setLocationURI(serviceEndpointURL);
- }
- }
- }
- }
- }
-
- return wsdlOneOnePort;
- }
-
- private String getUriScheme(String addrStr)
- {
- try
- {
- URI addrURI = new URI(addrStr);
- String scheme = addrURI.getScheme();
- return scheme;
- }
- catch (URISyntaxException e)
- {
- return null;
- }
- }
-}
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java (from rev 726, branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/AbstractAnnotationsMetaDataBuilder.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/AbstractAnnotationsMetaDataBuilder.java 2006-08-11 17:29:16 UTC (rev 726)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/AnnotationsMetaDataBuilder.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -0,0 +1,189 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.deployment;
+
+// $Id$
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Writer;
+
+import javax.xml.ws.BindingType;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.annotation.PortComponent;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.ServiceMetaData;
+import org.jboss.ws.metadata.UnifiedMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.server.ServerConfig;
+import org.jboss.ws.server.ServerConfigFactory;
+import org.jboss.ws.tools.JavaToWSDL;
+import org.jboss.ws.utils.IOUtils;
+
+/** An abstract annotation meta data builder.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 27-Jun-2005
+ */
+public abstract class AnnotationsMetaDataBuilder extends MetaDataBuilder
+{
+ // provide logging
+ private final Logger log = Logger.getLogger(AnnotationsMetaDataBuilder.class);
+
+ public AnnotationsMetaDataBuilder()
+ {
+ }
+
+ protected void processBindingType(EndpointMetaData epMetaData, Class wsClass)
+ {
+ BindingType anBindingType = (BindingType)wsClass.getAnnotation(BindingType.class);
+ String uri = anBindingType.value();
+ if (uri.length() > 0)
+ {
+ epMetaData.setBindingId(uri);
+ }
+ }
+
+ protected void processOrGenerateWSDL(Class wsClass, ServiceMetaData serviceMetaData, String wsdlLocation, EndpointMetaData endpointMetaData)
+ {
+ if (wsdlLocation.length() > 0)
+ {
+ serviceMetaData.setWsdlFile(wsdlLocation);
+ }
+ else
+ {
+ // Generate the wsdl
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ UnifiedMetaData wsMetaData = serviceMetaData.getUnifiedMetaData();
+ Thread.currentThread().setContextClassLoader(wsMetaData.getClassLoader());
+ String serviceName = serviceMetaData.getQName().getLocalPart();
+
+ JavaToWSDL javaToWSDL = new JavaToWSDL(Constants.NS_WSDL11);
+ javaToWSDL.setUnifiedMetaData(wsMetaData);
+ javaToWSDL.setQualifiedElements(true);
+ WSDLDefinitions wsdlDefinitions = javaToWSDL.generate(wsClass);
+
+ ServerConfigFactory factory = ServerConfigFactory.getInstance();
+ ServerConfig config = factory.getServerConfig();
+ File tmpdir = new File(config.getServerTempDir().getCanonicalPath() + "/jbossws");
+ tmpdir.mkdirs();
+
+ File wsdlTmpFile = File.createTempFile(serviceName, ".wsdl", tmpdir);
+ wsdlTmpFile.deleteOnExit();
+
+ Writer writer = IOUtils.getCharsetFileWriter(wsdlTmpFile, Constants.DEFAULT_XML_CHARSET);
+ wsdlDefinitions.write(writer, Constants.DEFAULT_XML_CHARSET);
+ writer.close();
+
+ serviceMetaData.setWsdlFile(wsdlTmpFile.toURL().toExternalForm());
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (IOException e)
+ {
+ throw new WSException("Cannot write generated wsdl", e);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
+ }
+ }
+
+ protected void processPortComponent(UnifiedDeploymentInfo udi, Class wsClass, String linkName, ServerEndpointMetaData epMetaData)
+ {
+ String contextRoot = null;
+
+ // init contextRoot from jboss-web.xml
+ if (udi.metaData instanceof UnifiedWebMetaData)
+ {
+ UnifiedWebMetaData webMetaData = (UnifiedWebMetaData)udi.metaData;
+ contextRoot = webMetaData.getContextRoot();
+ }
+
+ PortComponent anPortComponent = (PortComponent)wsClass.getAnnotation(PortComponent.class);
+ if (anPortComponent != null)
+ {
+ if (anPortComponent.contextRoot().length() > 0)
+ {
+ contextRoot = anPortComponent.contextRoot();
+ }
+ else
+ {
+ String shortName = udi.shortName;
+ contextRoot = "/" + shortName.substring(0, shortName.indexOf('.'));
+ }
+ epMetaData.setContextRoot(contextRoot);
+
+ String urlPattern;
+ if (anPortComponent.urlPattern().length() > 0)
+ {
+ urlPattern = anPortComponent.urlPattern();
+ }
+ else
+ {
+ urlPattern = "/" + linkName;
+ }
+ epMetaData.setURLPattern(urlPattern);
+
+ String servicePath = contextRoot + urlPattern;
+ epMetaData.setEndpointAddress(getServiceEndpointAddress(null, servicePath));
+
+ // setup authetication method
+ String authMethod = anPortComponent.authMethod();
+ if (authMethod.length() > 0)
+ epMetaData.setAuthMethod(authMethod);
+
+ // setup transport guarantee
+ String transportGuarantee = anPortComponent.transportGuarantee();
+ if (transportGuarantee.length() > 0)
+ epMetaData.setTransportGuarantee(transportGuarantee);
+ }
+ else
+ {
+ if (contextRoot == null)
+ {
+ String shortName = udi.shortName;
+ contextRoot = "/" + shortName.substring(0, shortName.indexOf('.'));
+ }
+ epMetaData.setContextRoot(contextRoot);
+
+ String urlPattern = "/" + linkName;
+ epMetaData.setURLPattern(urlPattern);
+
+ String servicePath = contextRoot + urlPattern;
+ epMetaData.setEndpointAddress(getServiceEndpointAddress(null, servicePath));
+ }
+
+ // replace the SOAP address
+ replaceAddressLocation(epMetaData);
+ }
+}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JAXWSClientMetaDataBuilder.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JAXWSClientMetaDataBuilder.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JAXWSClientMetaDataBuilder.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -141,6 +141,9 @@
epMetaData.setEndpointAddress(wsdlEndpoint.getAddress());
serviceMetaData.addEndpoint(epMetaData);
+ // Init the endpoint binding
+ initEndpointBinding(wsdlEndpoint, epMetaData);
+
// Init the service encoding style
initEndpointEncodingStyle(epMetaData);
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JAXWSMetaDataBuilder.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JAXWSMetaDataBuilder.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JAXWSMetaDataBuilder.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -31,7 +31,7 @@
* @author Thomas.Diesler at jboss.org
* @since 27-Jun-2006
*/
-public abstract class JAXWSMetaDataBuilder extends AbstractAnnotationsMetaDataBuilder
+public abstract class JAXWSMetaDataBuilder extends AnnotationsMetaDataBuilder
{
// provide logging
private final Logger log = Logger.getLogger(JAXWSMetaDataBuilder.class);
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR109ClientMetaDataBuilder.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -187,6 +187,9 @@
epMetaData.setConfigFile(configFile);
}
+ // Init the endpoint binding
+ initEndpointBinding(wsdlEndpoint, epMetaData);
+
// Init the service encoding style
initEndpointEncodingStyle(epMetaData);
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR109MetaDataBuilder.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR109MetaDataBuilder.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR109MetaDataBuilder.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -51,7 +51,7 @@
* @author Thomas.Diesler at jboss.org
* @since 19-Oct-2005
*/
-public abstract class JSR109MetaDataBuilder extends AbstractMetaDataBuilder
+public abstract class JSR109MetaDataBuilder extends MetaDataBuilder
{
// provide logging
final Logger log = Logger.getLogger(JSR109MetaDataBuilder.class);
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -46,6 +46,7 @@
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.encoding.TypeMappingRegistry;
import javax.xml.rpc.holders.Holder;
+import javax.xml.ws.BindingType;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;
import javax.xml.ws.addressing.AddressingProperties;
@@ -90,7 +91,7 @@
* @author <a href="mailto:jason.greene at jboss.com">Jason T. Greene</a>
* @since 15-Oct-2005
*/
-public abstract class JSR181MetaDataBuilder extends AbstractAnnotationsMetaDataBuilder
+public abstract class JSR181MetaDataBuilder extends AnnotationsMetaDataBuilder
{
// provide logging
private final Logger log = Logger.getLogger(JSR181MetaDataBuilder.class);
@@ -156,6 +157,12 @@
processSOAPBinding(sepMetaData, wsClass);
}
+ // Process an optional @BindingType annotation
+ if (wsClass.isAnnotationPresent(BindingType.class))
+ {
+ processBindingType(sepMetaData, wsClass);
+ }
+
boolean includeAllMethods = (wsClass == seiClass);
processWebMethods(sepMetaData, wsClass, includeAllMethods);
Copied: branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java (from rev 726, branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/AbstractMetaDataBuilder.java)
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/AbstractMetaDataBuilder.java 2006-08-11 17:29:16 UTC (rev 726)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/MetaDataBuilder.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -0,0 +1,440 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.deployment;
+
+// $Id$
+
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.ObjectName;
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.Port;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.xml.namespace.QName;
+import javax.xml.ws.addressing.AddressingProperties;
+import javax.xml.ws.soap.SOAPBinding;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.Constants;
+import org.jboss.ws.WSException;
+import org.jboss.ws.addressing.AddressingPropertiesImpl;
+import org.jboss.ws.addressing.metadata.AddressingOpMetaExt;
+import org.jboss.ws.eventing.EventingConstants;
+import org.jboss.ws.eventing.deployment.EventingEndpoint;
+import org.jboss.ws.eventing.metadata.EventingEpMetaExt;
+import org.jboss.ws.jaxrpc.UnqualifiedFaultException;
+import org.jboss.ws.jaxrpc.Use;
+import org.jboss.ws.metadata.ClientEndpointMetaData;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.FaultMetaData;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.ServerEndpointMetaData;
+import org.jboss.ws.metadata.TypesMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedApplicationMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedBeanMetaData;
+import org.jboss.ws.metadata.j2ee.UnifiedMessageDrivenMetaData;
+import org.jboss.ws.metadata.wsdl.NCName;
+import org.jboss.ws.metadata.wsdl.WSDLBinding;
+import org.jboss.ws.metadata.wsdl.WSDLBindingOperation;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.metadata.wsdl.WSDLEndpoint;
+import org.jboss.ws.metadata.wsdl.WSDLInterface;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceFault;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperation;
+import org.jboss.ws.metadata.wsdl.WSDLInterfaceOperationOutfault;
+import org.jboss.ws.metadata.wsdl.WSDLProperty;
+import org.jboss.ws.metadata.wsdl.WSDLService;
+import org.jboss.ws.server.ServiceEndpointManager;
+import org.jboss.ws.server.ServiceEndpointManagerFactory;
+import org.jboss.ws.utils.ObjectNameFactory;
+import org.w3c.dom.Element;
+
+/** An abstract meta data builder.
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 19-May-2005
+ */
+public abstract class MetaDataBuilder
+{
+ // provide logging
+ private final static Logger log = Logger.getLogger(MetaDataBuilder.class);
+
+ protected ClassLoader classLoader;
+ protected URLClassLoader resourceLoader;
+
+ public void setClassLoader(ClassLoader classLoader)
+ {
+ this.classLoader = classLoader;
+ }
+
+ public void setResourceLoader(URLClassLoader resourceLoader)
+ {
+ this.resourceLoader = resourceLoader;
+ }
+
+ /** Inititialize the endpoint binding
+ */
+ protected void initEndpointBinding(WSDLEndpoint wsdlEndpoint, ClientEndpointMetaData epMetaData)
+ {
+ WSDLDefinitions wsdlDefinitions = wsdlEndpoint.getWsdlService().getWsdlDefinitions();
+ WSDLInterface wsdlInterface = wsdlEndpoint.getInterface();
+ WSDLBinding wsdlBinding = wsdlDefinitions.getBindingByInterfaceName(wsdlInterface.getQName());
+ String bindingType = wsdlBinding.getType();
+ if (Constants.NS_SOAP11.equals(bindingType))
+ epMetaData.setBindingId(SOAPBinding.SOAP11HTTP_BINDING);
+ else if (Constants.NS_SOAP12.equals(bindingType))
+ epMetaData.setBindingId(SOAPBinding.SOAP12HTTP_BINDING);
+ }
+
+ /** Initialize the endpoint encoding style from the binding operations
+ */
+ protected void initEndpointEncodingStyle(EndpointMetaData epMetaData)
+ {
+ WSDLDefinitions wsdlDefinitions = epMetaData.getServiceMetaData().getWsdlDefinitions();
+ for (WSDLService wsdlService : wsdlDefinitions.getServices())
+ {
+ for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
+ {
+ if (epMetaData.getQName().equals(wsdlEndpoint.getQName()))
+ {
+ QName bindQName = wsdlEndpoint.getBinding();
+ NCName ncName = new NCName(bindQName.getLocalPart());
+ WSDLBinding wsdlBinding = wsdlDefinitions.getBinding(ncName);
+ if (wsdlBinding == null)
+ throw new WSException("Cannot obtain binding: " + ncName);
+
+ for (WSDLBindingOperation wsdlBindingOperation : wsdlBinding.getOperations())
+ {
+ String encStyle = wsdlBindingOperation.getEncodingStyle();
+ epMetaData.setEncoding(Use.valueOf(encStyle));
+ }
+ }
+ }
+ }
+ }
+
+ protected void processEndpointMetaDataExtensions(EndpointMetaData epMetaData, WSDLDefinitions wsdlDefinitions)
+ {
+ for (WSDLInterface wsdlInterface : wsdlDefinitions.getInterfaces())
+ {
+ WSDLProperty eventSourceProp = wsdlInterface.getProperty(Constants.WSDL_PROPERTY_EVENTSOURCE);
+ if (eventSourceProp != null && epMetaData instanceof ServerEndpointMetaData)
+ {
+ ServerEndpointMetaData sepMetaData = (ServerEndpointMetaData)epMetaData;
+ String eventSourceNS = wsdlInterface.getQName().getNamespaceURI() + "/" + wsdlInterface.getQName().getLocalPart();
+ Object notificationSchema = null; // todo: resolve schema from operation message
+
+ EventingEpMetaExt ext = new EventingEpMetaExt(EventingConstants.NS_EVENTING);
+ ext.setEventSourceNS(eventSourceNS);
+ ext.setNotificationSchema(notificationSchema);
+
+ sepMetaData.addExtension(ext);
+ sepMetaData.setManagedEndpointBean(EventingEndpoint.class.getName());
+ }
+ }
+ }
+
+ protected ObjectName getServiceEndpointID(UnifiedDeploymentInfo udi, ServerEndpointMetaData sepMetaData)
+ {
+ String endpoint = sepMetaData.getLinkName();
+ String context = sepMetaData.getContextRoot();
+ if (context.startsWith("/"))
+ context = context.substring(1);
+
+ StringBuilder idstr = new StringBuilder(ServerEndpointMetaData.SEPID_DOMAIN + ":");
+ idstr.append(ServerEndpointMetaData.SEPID_PROPERTY_CONTEXT + "=" + context);
+ idstr.append("," + ServerEndpointMetaData.SEPID_PROPERTY_ENDPOINT + "=" + endpoint);
+
+ // Add JMS destination JNDI name for MDB endpoints
+ if (udi.metaData instanceof UnifiedApplicationMetaData)
+ {
+ String ejbName = sepMetaData.getLinkName();
+ if (ejbName == null)
+ throw new WSException("Cannot obtain ejb-link from port component");
+
+ UnifiedApplicationMetaData applMetaData = (UnifiedApplicationMetaData)udi.metaData;
+ UnifiedBeanMetaData beanMetaData = (UnifiedBeanMetaData)applMetaData.getBeanByEjbName(ejbName);
+ if (beanMetaData == null)
+ throw new WSException("Cannot obtain ejb meta data for: " + ejbName);
+
+ if (beanMetaData instanceof UnifiedMessageDrivenMetaData)
+ {
+ UnifiedMessageDrivenMetaData mdMetaData = (UnifiedMessageDrivenMetaData)beanMetaData;
+ String jndiName = mdMetaData.getDestinationJndiName();
+ idstr.append(",jms=" + jndiName);
+ }
+ }
+
+ return ObjectNameFactory.create(idstr.toString());
+ }
+
+ protected void buildFaultMetaData(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation)
+ {
+ TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
+
+ WSDLInterface wsdlInterface = wsdlOperation.getWsdlInterface();
+ for (WSDLInterfaceOperationOutfault outFault : wsdlOperation.getOutfaults())
+ {
+ QName ref = outFault.getRef();
+
+ WSDLInterfaceFault wsdlFault = wsdlInterface.getFault(new NCName(ref.getLocalPart()));
+ QName xmlName = wsdlFault.getXmlName();
+ QName xmlType = wsdlFault.getXmlType();
+ String javaTypeName = null;
+
+ if (typesMetaData.getTypeMappingByXMLType(xmlType) != null)
+ javaTypeName = typesMetaData.getTypeMappingByXMLType(xmlType).getJavaTypeName();
+
+ if (javaTypeName == null)
+ {
+ log.warn("Cannot obtain java type mapping for: " + xmlType);
+ javaTypeName = new UnqualifiedFaultException(xmlType).getClass().getName();
+ }
+
+ FaultMetaData faultMetaData = new FaultMetaData(opMetaData, xmlName, xmlType, javaTypeName);
+ opMetaData.addFault(faultMetaData);
+ }
+ }
+
+ /** Process operation meta data extensions. */
+ protected void processOpMetaExtensions(OperationMetaData opMetaData, WSDLInterfaceOperation wsdlOperation)
+ {
+
+ String tns = wsdlOperation.getQName().getNamespaceURI();
+ String portTypeName = wsdlOperation.getQName().getLocalPart();
+
+ AddressingProperties ADDR = new AddressingPropertiesImpl();
+ AddressingOpMetaExt addrExt = new AddressingOpMetaExt(ADDR.getNamespaceURI());
+
+ // inbound action
+ WSDLProperty wsaInAction = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_ACTION_IN);
+ if (wsaInAction != null)
+ {
+ addrExt.setInboundAction(wsaInAction.getValue());
+ }
+ else
+ {
+ WSDLProperty messageName = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_IN);
+ addrExt.setInboundAction(tns + "/" + portTypeName + "/" + messageName);
+ }
+
+ // outbound action
+ WSDLProperty wsaOutAction = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_ACTION_OUT);
+ if (wsaOutAction != null)
+ {
+ addrExt.setOutboundAction(wsaOutAction.getValue());
+ }
+ else
+ {
+ WSDLProperty messageName = wsdlOperation.getProperty(Constants.WSDL_PROPERTY_MESSAGE_NAME_OUT);
+ addrExt.setOutboundAction(tns + "/" + portTypeName + "/" + messageName);
+ }
+
+ opMetaData.addExtension(addrExt);
+ }
+
+ /** Get the web service address for a given path
+ */
+ public String getServiceEndpointAddress(String uriScheme, String servicePath)
+ {
+ if (servicePath == null || servicePath.length() == 0)
+ throw new WSException("Service path cannot be null");
+
+ if (servicePath.endsWith("/*"))
+ servicePath = servicePath.substring(0, servicePath.length() - 2);
+
+ if (uriScheme == null)
+ uriScheme = "http";
+
+ ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
+ ServiceEndpointManager epManager = factory.getServiceEndpointManager();
+ String host = epManager.getWebServiceHost();
+ int port = epManager.getWebServicePort();
+ if ("https".equals(uriScheme))
+ port = epManager.getWebServiceSecurePort();
+
+ String urlStr = uriScheme + "://" + host + ":" + port + servicePath;
+ try
+ {
+ return new URL(urlStr).toExternalForm();
+ }
+ catch (MalformedURLException e)
+ {
+ throw new WSException("Malformed URL: " + urlStr);
+ }
+ }
+
+ /** Replace the address locations for a given port component.
+ */
+ protected void replaceAddressLocation(ServerEndpointMetaData epMetaData)
+ {
+ WSDLDefinitions wsdlDefinitions = epMetaData.getServiceMetaData().getWsdlDefinitions();
+ QName portName = epMetaData.getQName();
+
+ boolean endpointFound = false;
+ for (WSDLService wsdlService : wsdlDefinitions.getServices())
+ {
+ for (WSDLEndpoint wsdlEndpoint : wsdlService.getEndpoints())
+ {
+ QName wsdlPortName = wsdlEndpoint.getQName();
+ if (wsdlPortName.equals(portName))
+ {
+ endpointFound = true;
+
+ String orgAddress = wsdlEndpoint.getAddress();
+ String uriScheme = getUriScheme(orgAddress);
+
+ String transportGuarantee = epMetaData.getTransportGuarantee();
+ if ("CONFIDENTIAL".equals(transportGuarantee))
+ uriScheme = "https";
+
+ String servicePath = epMetaData.getContextRoot() + epMetaData.getURLPattern();
+ String serviceEndpointURL = getServiceEndpointAddress(uriScheme, servicePath);
+
+ ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
+ ServiceEndpointManager epManager = factory.getServiceEndpointManager();
+ boolean alwaysModify = epManager.isAlwaysModifySOAPAddress();
+
+ if (alwaysModify || uriScheme == null || orgAddress.indexOf("REPLACE_WITH_ACTUAL_URL") >= 0)
+ {
+ log.debug("Replace service endpoint address '" + orgAddress + "' with '" + serviceEndpointURL + "'");
+ wsdlEndpoint.setAddress(serviceEndpointURL);
+ epMetaData.setEndpointAddress(serviceEndpointURL);
+
+ // modify the wsdl-1.1 definition
+ if (wsdlDefinitions.getWsdlOneOneDefinition() != null)
+ replaceWSDL11SOAPAddress(wsdlDefinitions, portName, serviceEndpointURL);
+ }
+ else
+ {
+ log.debug("Don't replace service endpoint address '" + orgAddress + "'");
+ try
+ {
+ epMetaData.setEndpointAddress(new URL(orgAddress).toExternalForm());
+ }
+ catch (MalformedURLException e)
+ {
+ throw new WSException("Malformed URL: " + orgAddress);
+ }
+ }
+ }
+ }
+ }
+
+ if (endpointFound == false)
+ throw new WSException("Cannot find port in wsdl: " + portName);
+ }
+
+ private void replaceWSDL11SOAPAddress(WSDLDefinitions wsdlDefinitions, QName portQName, String serviceEndpointURL)
+ {
+ Definition wsdlOneOneDefinition = wsdlDefinitions.getWsdlOneOneDefinition();
+ String tnsURI = wsdlOneOneDefinition.getTargetNamespace();
+
+ // search for matching portElement and replace the address URI
+ Port wsdlOneOnePort = modifySOAPAddress(tnsURI, portQName, serviceEndpointURL, wsdlOneOneDefinition.getServices());
+
+ // recursivly process imports if none can be found
+ if (wsdlOneOnePort == null && !wsdlOneOneDefinition.getImports().isEmpty())
+ {
+
+ Iterator imports = wsdlOneOneDefinition.getImports().values().iterator();
+ while (imports.hasNext())
+ {
+ List l = (List)imports.next();
+ Iterator importsByNS = l.iterator();
+ while (importsByNS.hasNext())
+ {
+ Import anImport = (Import)importsByNS.next();
+ wsdlOneOnePort = modifySOAPAddress(anImport.getNamespaceURI(), portQName, serviceEndpointURL, anImport.getDefinition().getServices());
+ }
+ }
+ }
+
+ // if it still doesn't exist something is wrong
+ if (wsdlOneOnePort == null)
+ throw new IllegalArgumentException("Cannot find port with name '" + portQName + "' in wsdl document");
+ }
+
+ private Port modifySOAPAddress(String tnsURI, QName portQName, String serviceEndpointURL, Map services)
+ {
+ QName SOAP12_ADDRESS = new QName(Constants.NS_SOAP12, "address");
+
+ Port wsdlOneOnePort = null;
+ Iterator itServices = services.values().iterator();
+ while (itServices.hasNext())
+ {
+ Service wsdlOneOneService = (Service)itServices.next();
+ Map wsdlOneOnePorts = wsdlOneOneService.getPorts();
+ Iterator itPorts = wsdlOneOnePorts.keySet().iterator();
+ while (itPorts.hasNext())
+ {
+ String portLocalName = (String)itPorts.next();
+ if (portQName.equals(new QName(tnsURI, portLocalName)))
+ {
+ wsdlOneOnePort = (Port)wsdlOneOnePorts.get(portLocalName);
+ List<ExtensibilityElement> extElements = wsdlOneOnePort.getExtensibilityElements();
+ for (ExtensibilityElement extElement : extElements)
+ {
+ QName elementType = extElement.getElementType();
+ if (extElement instanceof SOAPAddress)
+ {
+ SOAPAddress address = (SOAPAddress)extElement;
+ address.setLocationURI(serviceEndpointURL);
+ }
+ else if (SOAP12_ADDRESS.equals(elementType))
+ {
+ Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
+ domElement.setAttribute("location", serviceEndpointURL);
+ }
+ }
+ }
+ }
+ }
+
+ return wsdlOneOnePort;
+ }
+
+ private String getUriScheme(String addrStr)
+ {
+ try
+ {
+ URI addrURI = new URI(addrStr);
+ String scheme = addrURI.getScheme();
+ return scheme;
+ }
+ catch (URISyntaxException e)
+ {
+ return null;
+ }
+ }
+}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/BindingImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/BindingImpl.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/BindingImpl.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -21,7 +21,7 @@
*/
package org.jboss.ws.jaxws.core;
-// $Id: $
+// $Id$
import java.util.ArrayList;
import java.util.List;
@@ -49,6 +49,7 @@
*/
public abstract class BindingImpl implements Binding
{
+ // provide logging
private static Logger log = Logger.getLogger(BindingImpl.class);
private List<Handler> handlerChain = new ArrayList<Handler>();
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingImpl.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingImpl.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -23,10 +23,12 @@
// $Id: SOAPBindingImpl.java 716 2006-08-09 16:42:10Z thomas.diesler at jboss.com $
+import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import org.jboss.ws.Constants;
+import org.jboss.ws.jaxrpc.Use;
import org.jboss.ws.metadata.OperationMetaData;
import org.jboss.ws.soap.MessageFactoryImpl;
@@ -43,6 +45,15 @@
{
MessageFactoryImpl factory = new MessageFactoryImpl();
factory.setEnvelopeURI(Constants.NS_SOAP11_ENV);
- return factory.createMessage();
+ SOAPMessage soapMessage = factory.createMessage();
+
+ Use encStyle = opMetaData.getEndpointMetaData().getEncoding();
+ if (Use.ENCODED.equals(encStyle))
+ {
+ SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
+ soapEnvelope.addNamespaceDeclaration(Constants.PREFIX_SOAP11_ENC, Constants.URI_SOAP11_ENC);
+ }
+
+ return soapMessage;
}
}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAPBindingImpl.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -257,6 +257,9 @@
SOAPEnvelope soapEnvelope = reqMessage.getSOAPPart().getEnvelope();
SOAPHeader soapHeader = soapEnvelope.getHeader();
SOAPBody soapBody = soapEnvelope.getBody();
+
+ // Verify the SOAP version
+ verifySOAPVersion(opMetaData, soapEnvelope);
// Construct the endpoint invocation object
EndpointInvocation epInv = new EndpointInvocation(opMetaData);
@@ -521,6 +524,9 @@
return;
}
+ // Verify the SOAP version
+ verifySOAPVersion(opMetaData, soapEnvelope);
+
// Get the SOAP message context that is associated with the current thread
SOAPMessageContextBase msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext == null)
@@ -642,6 +648,17 @@
}
}
+ private void verifySOAPVersion(OperationMetaData opMetaData, SOAPEnvelope soapEnvelope)
+ {
+ String envNS = soapEnvelope.getNamespaceURI();
+ String bindingId = opMetaData.getEndpointMetaData().getBindingId();
+ if (SOAPBinding.SOAP11HTTP_BINDING.equals(bindingId) && Constants.NS_SOAP11_ENV.equals(envNS) == false)
+ log.warn("Expected SOAP-1.1 envelope, but got: " + envNS);
+
+ if (SOAPBinding.SOAP12HTTP_BINDING.equals(bindingId) && Constants.NS_SOAP12_ENV.equals(envNS) == false)
+ log.warn("Expected SOAP-1.2 envelope, but got: " + envNS);
+ }
+
private AttachmentPart createAttachmentPart(ParameterMetaData paramMetaData, Object value, CIDGenerator cidGenerator) throws SOAPException, BindingException
{
String partName = paramMetaData.getXmlName().getLocalPart();
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/EndpointMetaData.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -32,6 +32,7 @@
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
import javax.xml.ws.Service.Mode;
+import javax.xml.ws.http.HTTPBinding;
import javax.xml.ws.soap.SOAPBinding;
import org.jboss.logging.Logger;
@@ -65,7 +66,7 @@
{
JAXRPC, JAXWS
}
-
+
// The parent meta data.
private ServiceMetaData service;
@@ -109,7 +110,7 @@
this.service = service;
this.portName = portName;
this.type = type;
-
+
// The default binding
this.bindingId = SOAPBinding.SOAP11HTTP_BINDING;
}
@@ -161,6 +162,8 @@
public void setBindingId(String bindingId)
{
+ if (!SOAPBinding.SOAP11HTTP_BINDING.equals(bindingId) && !SOAPBinding.SOAP12HTTP_BINDING.equals(bindingId) && !HTTPBinding.HTTP_BINDING.equals(bindingId))
+ throw new WSException("Unsupported binding: " + bindingId);
this.bindingId = bindingId;
}
@@ -386,7 +389,7 @@
{
operations.clear();
}
-
+
public void addHandler(UnifiedHandlerMetaData handler)
{
handlers.add(handler);
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Reader.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Reader.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Reader.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -91,6 +91,11 @@
// provide logging
private static final Logger log = Logger.getLogger(WSDL11Reader.class);
+ private static QName SOAP12_BINDING = new QName(Constants.NS_SOAP12, "binding");
+ private static QName SOAP12_BODY = new QName(Constants.NS_SOAP12, "body");
+ private static QName SOAP12_OPERATION = new QName(Constants.NS_SOAP12, "operation");
+ private static QName SOAP12_ADDRESS = new QName(Constants.NS_SOAP12, "address");
+
private WSDLDefinitions destWsdl;
// Maps wsdl message parts to their corresponding element names
@@ -276,8 +281,8 @@
log.trace("processSchemaImport: " + wsdlLoc);
- String location = importEl.getAttribute("schemaLocation");
- if (location == null || location.length() == 0)
+ String location = getOptionalAttribute(importEl, "schemaLocation");
+ if (location == null)
throw new IllegalArgumentException("schemaLocation is null for xsd:import");
URL locationURL = getLocationURL(wsdlLoc, location);
@@ -310,8 +315,8 @@
while (it.hasNext())
{
Element includeEl = (Element)it.next();
- String location = includeEl.getAttribute("schemaLocation");
- if (location == null || location.length() == 0)
+ String location = getOptionalAttribute(includeEl, "schemaLocation");
+ if (location == null)
throw new IllegalArgumentException("schemaLocation is null for xsd:include");
URL locationURL = getLocationURL(wsdlLoc, location);
@@ -321,8 +326,8 @@
includeEl.setAttribute("schemaLocation", newloc.toExternalForm());
}
- String targetNS = schemaEl.getAttribute("targetNamespace");
- if (targetNS.length() > 0)
+ String targetNS = getOptionalAttribute(schemaEl, "targetNamespace");
+ if (targetNS != null)
{
log.trace("processSchemaInclude: [targetNS=" + targetNS + ",parentURL=" + wsdlLoc + "]");
@@ -361,13 +366,13 @@
while (it.hasNext())
{
Element includeEl = (Element)it.next();
- String schemaLocation = includeEl.getAttribute("schemaLocation");
- String namespace = includeEl.getAttribute("namespace");
+ String schemaLocation = getOptionalAttribute(includeEl, "schemaLocation");
+ String namespace = getOptionalAttribute(includeEl, "namespace");
log.trace("handleSchemaImport: [namespace=" + namespace + ",schemaLocation=" + schemaLocation + "]");
// Skip, let the entity resolver resolve these
- if (namespace.length() > 0 && schemaLocation.length() > 0)
+ if (namespace != null && schemaLocation != null)
{
URL currLoc = getLocationURL(wsdlLoc, schemaLocation);
schemaLocationsMap.put(namespace, currLoc);
@@ -731,15 +736,22 @@
destBinding.setInterfaceName(srcPortType.getQName());
String bindingStyle = Style.getDefaultStyle().toString();
- List extList = srcBinding.getExtensibilityElements();
- for (int i = 0; i < extList.size(); i++)
+ List<ExtensibilityElement> extList = srcBinding.getExtensibilityElements();
+ for (ExtensibilityElement extElement : extList)
{
- Object extElement = extList.get(i);
+ QName elementType = extElement.getElementType();
if (extElement instanceof SOAPBinding)
{
+ destBinding.setType(Constants.NS_SOAP11);
SOAPBinding soapBinding = (SOAPBinding)extElement;
bindingStyle = soapBinding.getStyle();
}
+ else if (SOAP12_BINDING.equals(elementType))
+ {
+ destBinding.setType(Constants.NS_SOAP12);
+ Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
+ bindingStyle = getOptionalAttribute(domElement, "style");
+ }
}
destWsdl.addBinding(destBinding);
processBindingOperations(destBinding, srcBinding, bindingStyle);
@@ -802,16 +814,22 @@
// Process soap:operation at soapAction, soap:operation at style
String operationStyle = null;
- Iterator itExt = srcBindingOperation.getExtensibilityElements().iterator();
- while (itExt.hasNext())
+ List<ExtensibilityElement> extList = srcBindingOperation.getExtensibilityElements();
+ for (ExtensibilityElement extElement : extList)
{
- ExtensibilityElement extEl = (ExtensibilityElement)itExt.next();
- if (extEl instanceof SOAPOperation)
+ QName elementType = extElement.getElementType();
+ if (extElement instanceof SOAPOperation)
{
- SOAPOperation soapOp = (SOAPOperation)extEl;
+ SOAPOperation soapOp = (SOAPOperation)extElement;
destBindingOperation.setSOAPAction(soapOp.getSoapActionURI());
operationStyle = soapOp.getStyle();
}
+ else if (SOAP12_OPERATION.equals(elementType))
+ {
+ Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
+ operationStyle = getOptionalAttribute(domElement, "style");
+ }
+
}
destIntfOperation.setStyle(operationStyle != null ? operationStyle : bindingStyle);
@@ -832,18 +850,18 @@
{
log.trace("processBindingInput");
- Iterator itExt = srcBindingInput.getExtensibilityElements().iterator();
- while (itExt.hasNext())
+ QName soap11Body = new QName(Constants.NS_SOAP11, "body");
+ List<ExtensibilityElement> extList = srcBindingInput.getExtensibilityElements();
+ for (ExtensibilityElement extElement : extList)
{
- ExtensibilityElement extEl = (ExtensibilityElement)itExt.next();
- if (extEl instanceof SOAPBody)
+ QName elementType = extElement.getElementType();
+ if (soap11Body.equals(elementType) || SOAP12_BODY.equals(elementType))
{
- SOAPBody body = (SOAPBody)extEl;
- processEncodingStyle(body, destBindingOperation);
+ processEncodingStyle(extElement, destBindingOperation);
}
- else if (extEl instanceof SOAPHeader)
+ else if (extElement instanceof SOAPHeader)
{
- SOAPHeader header = (SOAPHeader)extEl;
+ SOAPHeader header = (SOAPHeader)extElement;
QName messageQName = header.getMessage();
String partName = header.getPart();
@@ -860,9 +878,9 @@
destIntfInput.addProperty(wsdlProperty);
}
}
- else if (extEl instanceof MIMEMultipartRelated)
+ else if (extElement instanceof MIMEMultipartRelated)
{
- MIMEMultipartRelated related = (MIMEMultipartRelated)extEl;
+ MIMEMultipartRelated related = (MIMEMultipartRelated)extElement;
Iterator i = related.getMIMEParts().iterator();
while (i.hasNext())
{
@@ -910,18 +928,17 @@
{
log.trace("processBindingOutput");
- Iterator itExt = srcBindingOutput.getExtensibilityElements().iterator();
- while (itExt.hasNext())
+ List<ExtensibilityElement> extList = srcBindingOutput.getExtensibilityElements();
+ for (ExtensibilityElement extElement : extList)
{
- ExtensibilityElement extEl = (ExtensibilityElement)itExt.next();
- if (extEl instanceof SOAPBody)
+ QName elementType = extElement.getElementType();
+ if (extElement instanceof SOAPBody || SOAP12_BODY.equals(elementType))
{
- SOAPBody body = (SOAPBody)extEl;
- processEncodingStyle(body, destBindingOperation);
+ processEncodingStyle(extElement, destBindingOperation);
}
- else if (extEl instanceof SOAPHeader)
+ else if (extElement instanceof SOAPHeader)
{
- SOAPHeader header = (SOAPHeader)extEl;
+ SOAPHeader header = (SOAPHeader)extElement;
QName messageQName = header.getMessage();
String partName = header.getPart();
@@ -938,9 +955,9 @@
destIntfOutput.addProperty(wsdlProperty);
}
}
- else if (extEl instanceof MIMEMultipartRelated)
+ else if (extElement instanceof MIMEMultipartRelated)
{
- MIMEMultipartRelated related = (MIMEMultipartRelated)extEl;
+ MIMEMultipartRelated related = (MIMEMultipartRelated)extElement;
Iterator i = related.getMIMEParts().iterator();
while (i.hasNext())
{
@@ -984,27 +1001,41 @@
}
}
- private void processEncodingStyle(SOAPBody body, WSDLBindingOperation destBindingOperation)
+ private void processEncodingStyle(ExtensibilityElement extElement, WSDLBindingOperation destBindingOperation)
{
log.trace("processEncodingStyle");
- List encStyleList = body.getEncodingStyles();
- if (encStyleList != null)
+ String encStyle = null;
+ QName elementType = extElement.getElementType();
+ if (extElement instanceof SOAPBody)
{
- if (encStyleList.size() > 1)
- log.warn("Multiple encoding styles not supported: " + encStyleList);
-
- if (encStyleList.size() > 0)
+ SOAPBody body = (SOAPBody)extElement;
+ List encStyleList = body.getEncodingStyles();
+ if (encStyleList != null)
{
- String encStyle = (String)encStyleList.get(0);
- String setStyle = destBindingOperation.getEncodingStyle();
+ if (encStyleList.size() > 1)
+ log.warn("Multiple encoding styles not supported: " + encStyleList);
- if (encStyle.equals(setStyle) == false)
- log.warn("Encoding style '" + encStyle + "' not supported for: " + destBindingOperation.getRef());
-
- destBindingOperation.setEncodingStyle(encStyle);
+ if (encStyleList.size() > 0)
+ {
+ encStyle = (String)encStyleList.get(0);
+ }
}
}
+ else if (SOAP12_BODY.equals(elementType))
+ {
+ Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
+ encStyle = getOptionalAttribute(domElement, "encodingStyle");
+ }
+
+ if (encStyle != null)
+ {
+ String setStyle = destBindingOperation.getEncodingStyle();
+ if (encStyle.equals(setStyle) == false)
+ log.warn("Encoding style '" + encStyle + "' not supported for: " + destBindingOperation.getRef());
+
+ destBindingOperation.setEncodingStyle(encStyle);
+ }
}
private void processServices(Definition srcWsdl)
@@ -1063,7 +1094,7 @@
destEndpoint.setName(new NCName(srcPort.getName()));
destEndpoint.setBinding(srcBinding.getQName());
destEndpoint.setQName(new QName(srcWsdl.getTargetNamespace(), srcPort.getName()));
- destEndpoint.setAddress(getEndPointAddress(srcPort));
+ destEndpoint.setAddress(getSOAPAddress(srcPort));
destService.addEndpoint(destEndpoint);
processBinding(srcWsdl, srcBinding);
@@ -1071,19 +1102,39 @@
/** Get the endpoint address from the ports extensible element
*/
- private String getEndPointAddress(Port srcPort)
+ private String getSOAPAddress(Port srcPort)
{
- String retstr = null;
+ String soapAddress = null;
+
Iterator it = srcPort.getExtensibilityElements().iterator();
while (it.hasNext())
{
ExtensibilityElement extElement = (ExtensibilityElement)it.next();
+ QName elementType = extElement.getElementType();
+
if (extElement instanceof SOAPAddress)
{
SOAPAddress addr = (SOAPAddress)extElement;
- retstr = addr.getLocationURI();
+ soapAddress = addr.getLocationURI();
+ break;
}
+ else if (SOAP12_ADDRESS.equals(elementType))
+ {
+ Element domElement = ((UnknownExtensibilityElement)extElement).getElement();
+ soapAddress = getOptionalAttribute(domElement, "location");
+ break;
+ }
}
- return retstr;
+
+ if (soapAddress == null)
+ throw new WSException("Cannot obtain SOAP address");
+
+ return soapAddress;
}
+
+ private String getOptionalAttribute(Element domElement, String attrName)
+ {
+ String attrValue = domElement.getAttribute(attrName);
+ return (attrValue.length() > 0 ? attrValue : null);
+ }
}
\ No newline at end of file
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Writer.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Writer.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDL11Writer.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -50,7 +50,7 @@
// Used to prevent duplicates
private HashSet<String> writtenFaultMessages = new HashSet<String>();
-
+
/** Use WSDLDefinitions.writeWSDL instead. */
public WSDL11Writer(WSDLDefinitions wsdl)
{
@@ -64,8 +64,6 @@
public void write(Writer writer, String charset) throws IOException
{
-
-
// Write out the wsdl-1.1 represention (only path to obtain is from WSDL11Reader)
if (wsdl.getWsdlOneOneDefinition() != null)
{
@@ -361,7 +359,7 @@
String style = "rpc";
if (wsdlStyle.equals(Constants.DOCUMENT_LITERAL))
style = "document";
- buffer.append("<soap:binding transport='http://schemas.xmlsoap.org/soap/http' style='" + style + "'/>");
+ buffer.append("<" + soapPrefix + ":binding transport='http://schemas.xmlsoap.org/soap/http' style='" + style + "'/>");
appendBindingOperations(buffer, binding);
buffer.append("</binding>");
}
@@ -424,7 +422,7 @@
buffer.append("<operation name='" + operation.getRef().getLocalPart() + "'>");
String soapAction = (operation.getSOAPAction() != null ? operation.getSOAPAction() : "");
- buffer.append("<soap:operation soapAction=\"" + soapAction + "\"/>");
+ buffer.append("<" + soapPrefix + ":operation soapAction=\"" + soapAction + "\"/>");
buffer.append("<input>");
StringBuilder bodyParts = new StringBuilder();
@@ -436,7 +434,7 @@
if (isHeaderInput(input))
{
String messageName = interfaceName + "_" + input.getWsdlBindingOperation().getRef().getLocalPart();
- buffer.append("<soap:header use='literal' message='tns:" + messageName + "' part='" + input.getMessageLabel() + "'/>");
+ buffer.append("<" + soapPrefix + ":header use='literal' message='tns:" + messageName + "' part='" + input.getMessageLabel() + "'/>");
hasHeader = true;
}
else
@@ -447,7 +445,7 @@
}
}
- buffer.append("<soap:body use='literal'");
+ buffer.append("<" + soapPrefix + ":body use='literal'");
if (hasHeader)
buffer.append(" parts='").append(bodyParts.toString()).append("'");
if (wsdlStyle != Constants.DOCUMENT_LITERAL)
@@ -469,7 +467,7 @@
{
String messageName = interfaceName + "_" + output.getWsdlBindingOperation().getRef().getLocalPart() + "Response";
- buffer.append("<soap:header use='literal' message='tns:" + messageName + "' part='" + output.getMessageLabel() + "'/>");
+ buffer.append("<" + soapPrefix + ":header use='literal' message='tns:" + messageName + "' part='" + output.getMessageLabel() + "'/>");
hasHeader = true;
}
else
@@ -480,7 +478,7 @@
}
}
- buffer.append("<soap:body use='literal'");
+ buffer.append("<" + soapPrefix + ":body use='literal'");
if (hasHeader)
buffer.append(" parts='").append(bodyParts.toString()).append("'");
if (wsdlStyle != Constants.DOCUMENT_LITERAL)
@@ -507,7 +505,7 @@
//String cleanref = utils.chop(utils.getFormattedString(elt), "Error");
buffer.append("<fault " + n + ">");
- buffer.append("<soap:fault " + n + " use='literal' />");
+ buffer.append("<" + soapPrefix + ":fault " + n + " use='literal' />");
buffer.append("</fault>");
}
@@ -553,17 +551,8 @@
prefix = wsdl.getTargetPrefix();
String ebname = prefix + ":" + endpointBinding.getLocalPart();
buffer.append("<port name='" + name + "' binding='" + ebname + "'>");
- buffer.append("<soap:address location='" + endpoint.getAddress() + "'/>");
+ buffer.append("<" + soapPrefix + ":address location='" + endpoint.getAddress() + "'/>");
buffer.append("</port>");
}
- private String getXMLTypeFromWSDLProperty(WSDLInterfaceOperationOutput wiout)
- {
- String value = "";
- WSDLProperty outprop = wiout.getProperty(Constants.WSDL_PROPERTY_RPC_XMLTYPE);
- if (outprop != null)
- value = outprop.getValue();
- return value;
- }
-
}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLWriter.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLWriter.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/wsdl/WSDLWriter.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -49,8 +49,10 @@
protected static final Logger log = Logger.getLogger(WSDLWriter.class);
protected WSDLDefinitions wsdl;
-
protected WSDLUtils utils = WSDLUtils.getInstance();
+
+ // The soap prefix
+ protected String soapPrefix = "soap";
/**
* Include or import WSDL Types
@@ -101,7 +103,11 @@
String namespaceURI = (String)it.next();
String prefix = wsdl.getPrefix(namespaceURI);
if (prefix.length() > 0)
+ {
buffer.append(" xmlns:" + prefix + "='" + namespaceURI + "'");
+ if (Constants.PREFIX_SOAP11.equals(prefix) || Constants.PREFIX_SOAP12.equals(prefix))
+ soapPrefix = prefix;
+ }
}
buffer.append(">");
}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/soap/SOAPContentElement.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -21,8 +21,13 @@
*/
package org.jboss.ws.soap;
+import java.io.IOException;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+import java.util.Iterator;
+
+import javax.activation.DataHandler;
import javax.xml.namespace.QName;
-import javax.xml.rpc.JAXRPCException;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
@@ -41,7 +46,6 @@
import org.jboss.ws.jaxrpc.encoding.DeserializerFactoryBase;
import org.jboss.ws.jaxrpc.encoding.NullValueSerializer;
import org.jboss.ws.jaxrpc.encoding.SerializerFactoryBase;
-import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
import org.jboss.ws.metadata.ParameterMetaData;
import org.jboss.ws.utils.JavaUtils;
import org.jboss.ws.utils.MimeUtils;
@@ -53,13 +57,6 @@
import org.w3c.dom.NodeList;
import org.w3c.dom.TypeInfo;
-
-import javax.activation.DataHandler;
-import java.lang.reflect.Array;
-import java.lang.reflect.Method;
-import java.util.Iterator;
-import java.io.IOException;
-
/**
* A SOAPElement that gives access to its content as XML fragment or Java object.
*
@@ -182,7 +179,7 @@
}
catch (BindingException e)
{
- throw new JAXRPCException(e);
+ throw new WSException(e);
}
}
@@ -312,7 +309,7 @@
}
catch (BindingException e)
{
- throw new JAXRPCException(e);
+ throw new WSException(e);
}
log.debug("objectValue: " + (objectValue != null ? objectValue.getClass().getName() : null));
@@ -397,7 +394,7 @@
}
if (serializerFactory == null)
- throw new JAXRPCException("Cannot obtain serializer factory for: [xmlType=" + xmlType + ",javaType=" + javaType + "]");
+ throw new WSException("Cannot obtain serializer factory for: [xmlType=" + xmlType + ",javaType=" + javaType + "]");
return serializerFactory;
}
@@ -430,7 +427,7 @@
}
if (deserializerFactory == null)
- throw new JAXRPCException("Cannot obtain deserializer factory for: [xmlType=" + xmlType + ",javaType=" + javaType + "]");
+ throw new WSException("Cannot obtain deserializer factory for: [xmlType=" + xmlType + ",javaType=" + javaType + "]");
return deserializerFactory;
}
@@ -882,7 +879,7 @@
catch (Exception e)
{
invalidateDOMContent();
- throw new JAXRPCException(e);
+ throw new WSException(e);
}
finally
{
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL11.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL11.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/JavaToWSDL11.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -1,33 +1,33 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.ws.tools;
import java.io.IOException;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import javax.xml.namespace.QName;
import javax.xml.rpc.encoding.TypeMapping;
+import javax.xml.ws.soap.SOAPBinding;
import org.jboss.logging.Logger;
import org.jboss.ws.Constants;
@@ -60,10 +60,10 @@
private final String wsdlNamespace = Constants.NS_WSDL11;
/** Features as represented by Constants*/
- private HashMap<String,Boolean> features = new HashMap<String,Boolean>();
+ private HashMap<String, Boolean> features = new HashMap<String, Boolean>();
// A Map of package/namespace mapping that needs to be passed onto types generator
- private Map<String,String> packageNamespaceMap = null;
+ private Map<String, String> packageNamespaceMap = null;
private TypeMapping typeMapping = null;
@@ -89,7 +89,7 @@
*/
public void addFeature(String name, boolean value)
{
- features.put(name,new Boolean(value));
+ features.put(name, new Boolean(value));
}
/**
@@ -97,9 +97,9 @@
* @see org.jboss.ws.tools.WSToolsConstants
* @param map
*/
- public void addFeatures(Map<String,Boolean> map)
+ public void addFeatures(Map<String, Boolean> map)
{
- features.putAll(map);
+ features.putAll(map);
}
/**
@@ -111,9 +111,10 @@
*/
public boolean getFeature(String name)
{
- Boolean val = features.get(name);
- if(val != null) return val.booleanValue();
- throw new WSException("Feature unrecognized");
+ Boolean val = features.get(name);
+ if (val != null)
+ return val.booleanValue();
+ throw new WSException("Feature unrecognized");
}
/**
@@ -121,7 +122,7 @@
*
* @param map
*/
- public void setPackageNamespaceMap(Map<String,String> map)
+ public void setPackageNamespaceMap(Map<String, String> map)
{
packageNamespaceMap = map;
}
@@ -135,7 +136,7 @@
*/
public TypeMapping getTypeMapping()
{
- if(typeMapping == null)
+ if (typeMapping == null)
throw new WSException("TypeMapping has not been generated");
return typeMapping;
}
@@ -156,11 +157,11 @@
*/
public WSDLDefinitions generate(Class endpoint)
{
- WSDLDefinitions wsdl = new WSDLDefinitions();
+ WSDLDefinitions wsdl = new WSDLDefinitions();
wsdl.setWsdlTypes(new XSModelTypes());
wsdl.setWsdlNamespace(this.wsdlNamespace);
- if(umd != null)
+ if (umd != null)
{
JavaToWSDLHelper helper = new JavaToWSDLHelper(wsdl, wsdlNamespace);
try
@@ -173,7 +174,7 @@
}
catch (IOException e)
{
- log.error("Error during Java->WSDL generation:",e);
+ log.error("Error during Java->WSDL generation:", e);
}
}
@@ -204,54 +205,54 @@
}
//PRIVATE METHODS
- private void handleJavaToWSDLGeneration(JavaToWSDLHelper helper, String endpointName)
- throws IOException
+ private void handleJavaToWSDLGeneration(JavaToWSDLHelper helper, String endpointName) throws IOException
{
- if(umd == null)
+ if (umd == null)
throw new WSException("Unified Meta Data Model is null");
- List<ServiceMetaData> servicelist = umd.getServices();
- for(ServiceMetaData smd: servicelist)
+ for (ServiceMetaData serviceMetaData : umd.getServices())
{
- List<EndpointMetaData> endpoints = smd.getEndpoints();
- for(EndpointMetaData endpt : endpoints)
+ for (EndpointMetaData epMetaData : serviceMetaData.getEndpoints())
{
// FIXME - The API needs to be reworked instead of using hacks like this
- if (! endpointName.equals(endpt.getServiceEndpointInterfaceName()))
+ if (!endpointName.equals(epMetaData.getServiceEndpointInterfaceName()))
continue;
// FIXME - We should store the port type
- QName endptName= endpt.getQName();
- String intfName = endptName.getLocalPart();
+ QName portName = epMetaData.getQName();
+ String intfName = portName.getLocalPart();
- helper.appendDefinitions(endptName.getNamespaceURI());
+ String targetNamespace = portName.getNamespaceURI();
+ String bindingId = epMetaData.getBindingId();
+ helper.appendDefinitions(targetNamespace, bindingId);
if (intfName.endsWith("Port"))
intfName = intfName.substring(0, intfName.length() - 4);
- List<OperationMetaData> ops = endpt.getOperations();
- for(OperationMetaData op : ops)
+ for (OperationMetaData opMetaData : epMetaData.getOperations())
{
//Generate Types for the individual parameters
- List<ParameterMetaData> pmds = op.getParameters();
- for(ParameterMetaData pmd : pmds)
- helper.generateTypesForXSD(pmd);
+ for (ParameterMetaData paramMetaData : opMetaData.getParameters())
+ {
+ helper.generateTypesForXSD(paramMetaData);
+ }
- List<FaultMetaData> fmds = op.getFaults();
- for(FaultMetaData fmd: fmds)
+ for (FaultMetaData faultMetaData : opMetaData.getFaults())
{
- helper.generateTypesForXSD(fmd);
+ helper.generateTypesForXSD(faultMetaData);
}
- ParameterMetaData pmd = op.getReturnParameter();
- if (pmd != null)
- helper.generateTypesForXSD(pmd);
+ ParameterMetaData returnMetaData = opMetaData.getReturnParameter();
+ if (returnMetaData != null)
+ {
+ helper.generateTypesForXSD(returnMetaData);
+ }
- helper.generateInterfaces(op, intfName );
- helper.generateBindings(op, intfName + "Binding");
+ helper.generateInterfaces(opMetaData, intfName);
+ helper.generateBindings(opMetaData, intfName + "Binding");
}
- helper.generateServices(endpt, intfName);
+ helper.generateServices(epMetaData, intfName);
javaWsdlMapping = helper.getJavaWsdlMapping();
break;
}
Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -36,6 +36,7 @@
import javax.xml.rpc.encoding.TypeMapping;
import javax.xml.rpc.holders.ByteArrayHolder;
import javax.xml.rpc.holders.Holder;
+import javax.xml.ws.soap.SOAPBinding;
import org.apache.xerces.xs.XSTypeDefinition;
import org.jboss.ws.Constants;
@@ -122,13 +123,18 @@
this.wsdlNamespace = wsdlNS;
}
- public void appendDefinitions(String targetNamespace)
+ public void appendDefinitions(String targetNamespace, String bindingId)
{
wsdl.setTargetNamespace(targetNamespace);
wsdl.registerNamespaceURI(targetNamespace, Constants.PREFIX_TNS);
wsdl.registerNamespaceURI(Constants.NS_SCHEMA_XSD, Constants.PREFIX_XSD);
if (wsdlNamespace.equals(Constants.NS_WSDL11))
- wsdl.registerNamespaceURI(Constants.NS_SOAP11, Constants.PREFIX_SOAP);
+ {
+ if (SOAPBinding.SOAP11HTTP_BINDING.equals(bindingId))
+ wsdl.registerNamespaceURI(Constants.NS_SOAP11, Constants.PREFIX_SOAP11);
+ else if (SOAPBinding.SOAP12HTTP_BINDING.equals(bindingId))
+ wsdl.registerNamespaceURI(Constants.NS_SOAP12, Constants.PREFIX_SOAP12);
+ }
}
Modified: branches/tdiesler/trunk/src/test/ant/build-jars.xml
===================================================================
--- branches/tdiesler/trunk/src/test/ant/build-jars.xml 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/test/ant/build-jars.xml 2006-08-12 17:50:27 UTC (rev 728)
@@ -360,15 +360,19 @@
</metainf>
</ear>
+ <!-- jbossws-jaxws-binding -->
+ <war warfile="${build.test.dir}/libs/jbossws-jaxws-binding.war" webxml="${build.test.dir}/resources/jaxws/binding/WEB-INF/web.xml">
+ <classes dir="${build.test.dir}/classes">
+ <include name="org/jboss/test/ws/jaxws/binding/SOAPEndpointBean.class"/>
+ </classes>
+ </war>
+
<!-- jbossws-jaxws-context -->
<war warfile="${build.test.dir}/libs/jbossws-jaxws-context.war" webxml="${build.test.dir}/resources/jaxws/context/WEB-INF/web.xml">
<classes dir="${build.test.dir}/classes">
<include name="org/jboss/test/ws/jaxws/context/EndpointBean.class"/>
<include name="org/jboss/test/ws/jaxws/context/EndpointInterface.class"/>
</classes>
- <webinf dir="${build.test.dir}/resources/jaxws/context/WEB-INF">
- <include name="wsdl/**"/>
- </webinf>
</war>
<!-- jbossws-jaxws-endpoint -->
Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/encoded/parametermode/ParameterModeTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/encoded/parametermode/ParameterModeTestCase.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/encoded/parametermode/ParameterModeTestCase.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -159,9 +159,9 @@
public void testEchoInOut() throws Exception
{
- StringHolder varString = new StringHolder("Frerrari");
+ StringHolder varString = new StringHolder("Ferrari");
port.echoInOut(varString);
- assertEquals("Frerrari", varString.value);
+ assertEquals("Ferrari", varString.value);
}
public void testEchoMix() throws Exception
Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/samples/wsaddressing/AddressingHandler.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/samples/wsaddressing/AddressingHandler.java 2006-08-12 11:07:20 UTC (rev 727)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/samples/wsaddressing/AddressingHandler.java 2006-08-12 17:50:27 UTC (rev 728)
@@ -64,7 +64,7 @@
public boolean handleFault(MessageContext messagecontext)
{
- return false;
+ return true;
}
public void close(MessageContext messagecontext)
More information about the jboss-svn-commits
mailing list