Author: deepal
Date: Thu Jul 2 02:37:34 2015
New Revision: 1688758
URL: http://svn.apache.org/r1688758
Log:
applying pacth for AXIS2-5672
Added:
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/wsdl/
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/wsdl/ExtensionTypesTest.java
axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/Version.wsdl
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/wsdl/
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/wsdl/WSDLUtilTest.java
Modified:
axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
axis/axis2/java/core/trunk/modules/codegen/test-resources/schemas/custom_schemas/generated.xsd
axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/axis2/description/Java2WSDLTest.java
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/description/DescriptionTestUtils2.java
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisService.java
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/wsdl/WSDLUtil.java
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperReloadImpl.java
axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/actionTests.wsdl
axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/printWSDLreference.wsdl
axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement11_WSDL.wsdl
axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement_WSDL.wsdl
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/addressing/wsdl/WSDL11ActionHelperTest.java
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/WSDL11ToAxisServiceBuilderTest.java
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/WSDLWrapperTest.java
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/wsdl/WSDLReaderConfiguratorImpl.java
axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/DescriptionTestUtils.java
axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/metadata/registry/MetadataFactoryRegistryTests.java
axis/axis2/java/core/trunk/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/util/WSDLPropertyReader.java
axis/axis2/java/core/trunk/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/CodegenBean.java
axis/axis2/java/core/trunk/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/WSDLFileSelectionPage.java
Modified:
axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
(original)
+++
axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/CodeGenerationEngine.java
Thu Jul 2 02:37:34 2015
@@ -28,6 +28,7 @@ import org.apache.axis2.description.WSDL
import org.apache.axis2.util.CommandLineOption;
import org.apache.axis2.util.CommandLineOptionConstants;
import org.apache.axis2.util.CommandLineOptionParser;
+import org.apache.axis2.wsdl.WSDLUtil;
import org.apache.axis2.wsdl.codegen.emitter.Emitter;
import org.apache.axis2.wsdl.codegen.extension.CodeGenExtension;
import org.apache.axis2.wsdl.databinding.TypeMapper;
@@ -305,18 +306,9 @@ public class CodeGenerationEngine {
*/
public Definition readInTheWSDLFile(final String uri) throws WSDLException
{
- WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+ WSDLReader reader =
WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
reader.setFeature("javax.wsdl.importDocuments", true);
- ExtensionRegistry extReg =
WSDLFactory.newInstance().newPopulatedExtensionRegistry();
- extReg.registerExtensionAttributeType(Input.class,
- new QName(AddressingConstants.Final.WSAW_NAMESPACE,
AddressingConstants.WSA_ACTION),
- AttributeExtensible.STRING_TYPE);
- extReg.registerExtensionAttributeType(Output.class,
- new QName(AddressingConstants.Final.WSAW_NAMESPACE,
AddressingConstants.WSA_ACTION),
- AttributeExtensible.STRING_TYPE);
- reader.setExtensionRegistry(extReg);
-
return reader.readWSDL(uri);
}
Modified:
axis/axis2/java/core/trunk/modules/codegen/test-resources/schemas/custom_schemas/generated.xsd
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/test-resources/schemas/custom_schemas/generated.xsd?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/codegen/test-resources/schemas/custom_schemas/generated.xsd
(original)
+++
axis/axis2/java/core/trunk/modules/codegen/test-resources/schemas/custom_schemas/generated.xsd
Thu Jul 2 02:37:34 2015
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3schools.com" attributeFormDefault="unqualified"
elementFormDefault="qualified" targetNamespace="http://www.w3schools.com">
+<?xml version="1.0" encoding="UTF-8"?><xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3schools.com"
attributeFormDefault="unqualified" elementFormDefault="qualified"
targetNamespace="http://www.w3schools.com">
<xs:element name="note">
<xs:complexType>
<xs:sequence>
Added:
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/wsdl/ExtensionTypesTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/wsdl/ExtensionTypesTest.java?rev=1688758&view=auto
==============================================================================
---
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/wsdl/ExtensionTypesTest.java
(added)
+++
axis/axis2/java/core/trunk/modules/integration/test/org/apache/axis2/wsdl/ExtensionTypesTest.java
Thu Jul 2 02:37:34 2015
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.wsdl;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.Echo;
+import org.apache.axis2.engine.util.TestConstants;
+import org.apache.axis2.integration.UtilServer;
+import org.apache.axis2.integration.UtilServerBasedTestCase;
+
+/**
+ * Tests whether extension attributes in {@link
javax.wsdl.extensions.ExtensionRegistry} are of correct type
+ * for WSDL Definition instances created by Axis2.
+ *
+ * @see {@link
org.apache.axis2.wsdl.WSDLUtil#registerDefaultExtensionAttributeTypes(javax.wsdl.extensions.ExtensionRegistry)}
+ */
+public class ExtensionTypesTest extends UtilServerBasedTestCase implements
TestConstants {
+ protected AxisService service;
+
+ public static Test suite() {
+ return getTestSetup(new TestSuite(ExtensionTypesTest.class));
+ }
+
+ protected void setUp() throws Exception {
+ service = AxisService.createService(Echo.class.getName(),
UtilServer.getConfigurationContext().getAxisConfiguration());
+ service.setName(serviceName.getLocalPart());
+ UtilServer.deployService(service);
+ }
+
+ protected void tearDown() throws Exception {
+ UtilServer.unDeployService(serviceName);
+ UtilServer.unDeployClientService();
+ }
+
+ /**
+ * Creates a service client for EchoXMLService, obtains the WSDL
Definition and verifies whether the Addressing <code>Action</code> extension
+ * attributes on operation's input and output elements are of correct
type and value (expected to be String rather than QName).
+ * @throws MalformedURLException
+ * @throws AxisFault
+ *
+ * @throws Exception
+ */
+ public void testExtensionTypes() throws MalformedURLException,
AxisFault {
+ URL wsdlURL = new
URL(String.format("http://localhost:%s/axis2/services/EchoXMLService?wsdl",
UtilServer.TESTING_PORT));
+ ServiceClient serviceClient = new ServiceClient(null, wsdlURL,
new QName("http://engine.axis2.apache.org", "EchoXMLService"),
"EchoHttpSoap11Endpoint");
+
+ Definition definition = (Definition)
serviceClient.getAxisService().getParameter("wsdl4jDefinition").getValue();
+
+ PortType pt = definition.getPortType(new
QName("http://engine.axis2.apache.org", "EchoXMLServicePortType"));
+
+ Operation op = (Operation) pt.getOperations().get(0);
+
+ QName addressingActionAttName = new
QName("http://www.w3.org/2006/05/addressing/wsdl", "Action");
+ Object addressingActionAttValue =
op.getInput().getExtensionAttributes().get(addressingActionAttName);
+ assertNotNull(String.format("The value of extension attribute
%s on %s operation's input is null", addressingActionAttName, op.getName()),
addressingActionAttValue);
+ assertTrue(String.format("The value of extension attribute %s
on %s operation's input is not a String: %s", addressingActionAttName,
op.getName(), addressingActionAttValue.getClass().getName()),
+ addressingActionAttValue instanceof String);
+
+ assertEquals("urn:echoOM", (String) addressingActionAttValue);
+
+ addressingActionAttValue =
op.getOutput().getExtensionAttributes().get(addressingActionAttName);
+ assertNotNull(String.format("The value of extension attribute
%s on %s operation's output is null", addressingActionAttName, op.getName()),
addressingActionAttValue);
+ assertTrue(String.format("The value of extension attribute %s
on %s operation's input is not a String: %s", addressingActionAttName,
op.getName(), addressingActionAttValue.getClass().getName()),
+ addressingActionAttValue instanceof String);
+ assertEquals("urn:echoOMResponse", (String)
addressingActionAttValue);
+ }
+}
Modified:
axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/axis2/description/Java2WSDLTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/axis2/description/Java2WSDLTest.java?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/axis2/description/Java2WSDLTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/axis2/description/Java2WSDLTest.java
Thu Jul 2 02:37:34 2015
@@ -17,27 +17,29 @@
* under the License.
*/
-package org.apache.axis2.description;
-
-import junit.framework.TestCase;
-import org.apache.ws.java2wsdl.Java2WSDLBuilder;
-import org.xml.sax.InputSource;
-
-import javax.wsdl.Definition;
-import javax.wsdl.xml.WSDLReader;
-import javax.wsdl.factory.WSDLFactory;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.util.HashMap;
+package org.apache.axis2.description;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.wsdl.WSDLUtil;
+import org.apache.ws.java2wsdl.Java2WSDLBuilder;
+import org.xml.sax.InputSource;
+
+import javax.wsdl.Definition;
+import javax.wsdl.xml.WSDLReader;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.util.HashMap;
public class Java2WSDLTest extends TestCase {
public void test1() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
- Java2WSDLBuilder builder = new Java2WSDLBuilder(out,
CalculatorService.class.getName(), CalculatorService.class.getClassLoader(),
new HashMap());
- builder.generateWSDL();
- InputSource inputSource = new InputSource(new
ByteArrayInputStream(out.toByteArray()));
- WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
- Definition definition = wsdlReader.readWSDL(null, inputSource);
- assertNotNull(definition);
- }
+ Java2WSDLBuilder builder = new Java2WSDLBuilder(out,
CalculatorService.class.getName(), CalculatorService.class.getClassLoader(),
new HashMap());
+ builder.generateWSDL();
+ InputSource inputSource = new InputSource(new
ByteArrayInputStream(out.toByteArray()));
+ WSDLReader wsdlReader =
WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
+ Definition definition = wsdlReader.readWSDL(null, inputSource);
+ assertNotNull(definition);
+ }
}
Modified:
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/description/DescriptionTestUtils2.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/description/DescriptionTestUtils2.java?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/description/DescriptionTestUtils2.java
(original)
+++
axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/description/DescriptionTestUtils2.java
Thu Jul 2 02:37:34 2015
@@ -23,6 +23,7 @@ package org.apache.axis2.jaxws.descripti
import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
import org.apache.axis2.jaxws.spi.ServiceDelegate;
import org.apache.axis2.jaxws.unitTest.TestLogger;
+import org.apache.axis2.wsdl.WSDLUtil;
import javax.wsdl.Definition;
import javax.wsdl.factory.WSDLFactory;
@@ -72,8 +73,7 @@ public class DescriptionTestUtils2 {
static Definition createWSDLDefinition(URL wsdlURL) {
Definition wsdlDefinition = null;
try {
- WSDLFactory factory = WSDLFactory.newInstance();
- WSDLReader reader = factory.newWSDLReader();
+ WSDLReader reader =
WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
wsdlDefinition = reader.readWSDL(wsdlURL.toString());
}
catch (Exception e) {
Modified:
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisService.java?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisService.java
(original)
+++
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisService.java
Thu Jul 2 02:37:34 2015
@@ -64,6 +64,7 @@ import org.apache.axis2.util.LoggingCont
import org.apache.axis2.util.XMLPrettyPrinter;
import org.apache.axis2.util.XMLUtils;
import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.axis2.wsdl.WSDLUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.neethi.Policy;
@@ -2387,7 +2388,7 @@ public class AxisService extends AxisDes
Document doc = XMLUtils.newDocument(in);
String namespaceURI = doc.getDocumentElement().getNamespaceURI();
if (Constants.NS_URI_WSDL11.equals(namespaceURI)) {
- WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+ WSDLReader reader =
WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
reader.setFeature("javax.wsdl.importDocuments", true);
Definition wsdlDefinition =
reader.readWSDL(getBaseURI(wsdlURL.toString()), doc);
if (wsdlDefinition != null) {
Modified:
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
(original)
+++
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
Thu Jul 2 02:37:34 2015
@@ -91,7 +91,6 @@ import javax.wsdl.extensions.soap12.SOAP
import javax.wsdl.extensions.soap12.SOAP12Body;
import javax.wsdl.extensions.soap12.SOAP12Header;
import javax.wsdl.extensions.soap12.SOAP12Operation;
-import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLLocator;
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
@@ -2313,7 +2312,7 @@ public class WSDL11ToAxisServiceBuilder
*/
private Definition readInTheWSDLFile(InputStream in) throws WSDLException {
- WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+ WSDLReader reader =
WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
// switch off the verbose mode for all usecases
reader.setFeature(JAVAX_WSDL_VERBOSE_MODE_KEY, false);
Modified:
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/wsdl/WSDLUtil.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/wsdl/WSDLUtil.java?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/wsdl/WSDLUtil.java
(original)
+++
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/wsdl/WSDLUtil.java
Thu Jul 2 02:37:34 2015
@@ -19,8 +19,17 @@
package org.apache.axis2.wsdl;
+import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.description.WSDL2Constants;
+import javax.wsdl.Fault;
+import javax.wsdl.Input;
+import javax.wsdl.Output;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.AttributeExtensible;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
/**
@@ -108,4 +117,68 @@ public class WSDLUtil {
return buffer.toString();
}
+ /**
+ * Registers default extension attributes types to given
<code>extensionRegistry</code> instance.
+ * <p>
+ * The method configures the following attributes of {@link Input}, {@link
Output} and {@link Fault} WSDL elements
+ * to use {@link AttributeExtensible.STRING_TYPE}:
+ * <ul>
+ * <li>{http://www.w3.org/2005/08/addressing}Action</li>
+ * <li>{http://www.w3.org/2006/05/addressing/wsdl}Action</li>
+ * <li>{http://www.w3.org/2007/05/addressing/metadata}Action</li>
+ * <li>{http://schemas.xmlsoap.org/ws/2004/08/addressing}Action</li>
+ * </ul>
+ * </p>
+ * @param extensionRegistry The extension registry to add default
extension attribute types to. Must not be null.
+ */
+ public static void
registerDefaultExtensionAttributeTypes(ExtensionRegistry extensionRegistry) {
+ if (extensionRegistry == null) {
+ throw new IllegalArgumentException("Extension registry must not
be null");
+ }
+
+ QName finalWSANS = new
QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_ACTION);
+ extensionRegistry.registerExtensionAttributeType(Input.class,
finalWSANS, AttributeExtensible.STRING_TYPE);
+ extensionRegistry.registerExtensionAttributeType(Output.class,
finalWSANS, AttributeExtensible.STRING_TYPE);
+ extensionRegistry.registerExtensionAttributeType(Fault.class,
finalWSANS, AttributeExtensible.STRING_TYPE);
+
+ QName finalWSAWNS = new
QName(AddressingConstants.Final.WSAW_NAMESPACE, AddressingConstants.WSA_ACTION);
+ extensionRegistry.registerExtensionAttributeType(Input.class,
finalWSAWNS, AttributeExtensible.STRING_TYPE);
+ extensionRegistry.registerExtensionAttributeType(Output.class,
finalWSAWNS, AttributeExtensible.STRING_TYPE);
+ extensionRegistry.registerExtensionAttributeType(Fault.class,
finalWSAWNS, AttributeExtensible.STRING_TYPE);
+
+ QName finalWSAMNS = new
QName(AddressingConstants.Final.WSAM_NAMESPACE, AddressingConstants.WSA_ACTION);
+ extensionRegistry.registerExtensionAttributeType(Input.class,
finalWSAMNS, AttributeExtensible.STRING_TYPE);
+ extensionRegistry.registerExtensionAttributeType(Output.class,
finalWSAMNS, AttributeExtensible.STRING_TYPE);
+ extensionRegistry.registerExtensionAttributeType(Fault.class,
finalWSAMNS, AttributeExtensible.STRING_TYPE);
+
+ QName submissionWSAWNS = new
QName(AddressingConstants.Submission.WSA_NAMESPACE,
AddressingConstants.WSA_ACTION);
+ extensionRegistry.registerExtensionAttributeType(Input.class,
submissionWSAWNS, AttributeExtensible.STRING_TYPE);
+ extensionRegistry.registerExtensionAttributeType(Output.class,
submissionWSAWNS, AttributeExtensible.STRING_TYPE);
+ extensionRegistry.registerExtensionAttributeType(Fault.class,
submissionWSAWNS, AttributeExtensible.STRING_TYPE);
+ }
+
+ /**
+ * Creates a new WSDLReader and configures it with a {@link
WSDLFactory#newPopulatedExtensionRegistry()} if it does not specify an
extension registry.
+ * The method will register default extension attribute types in
WSDLReader's {@link WSDLReader#getExtensionRegistry() extensionRegistry},
+ * see {@link #registerDefaultExtensionAttributeTypes(ExtensionRegistry)}.
+ *
+ * @return The newly created WSDLReader instance.
+ * @throws WSDLException
+ */
+ public static WSDLReader newWSDLReaderWithPopulatedExtensionRegistry()
+ throws WSDLException {
+ WSDLFactory wsdlFactory = WSDLFactory.newInstance();
+ WSDLReader reader = wsdlFactory.newWSDLReader();
+
+ ExtensionRegistry extensionRegistry = reader.getExtensionRegistry();
+ if (extensionRegistry == null) {
+ extensionRegistry = wsdlFactory.newPopulatedExtensionRegistry();
+ }
+
+ WSDLUtil.registerDefaultExtensionAttributeTypes(extensionRegistry);
+
+ reader.setExtensionRegistry(extensionRegistry);
+
+ return reader;
+ }
}
Modified:
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperReloadImpl.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperReloadImpl.java?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperReloadImpl.java
(original)
+++
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/wsdl/util/WSDLWrapperReloadImpl.java
Thu Jul 2 02:37:34 2015
@@ -18,12 +18,13 @@
*/
package org.apache.axis2.wsdl.util;
-
-import org.apache.axis2.java.security.AccessController;
-import org.apache.axis2.util.JavaUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.w3c.dom.Element;
+
+import org.apache.axis2.java.security.AccessController;
+import org.apache.axis2.util.JavaUtils;
+import org.apache.axis2.wsdl.WSDLUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.w3c.dom.Element;
import javax.wsdl.Binding;
import javax.wsdl.BindingFault;
@@ -42,13 +43,12 @@ import javax.wsdl.Port;
import javax.wsdl.PortType;
import javax.wsdl.Service;
import javax.wsdl.Types;
-import javax.wsdl.WSDLException;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.ExtensionRegistry;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.namespace.QName;
-import java.io.File;
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.SoftReference;
@@ -1514,14 +1514,13 @@ public class WSDLWrapperReloadImpl imple
*/
private WSDLReader getWSDLReader() throws WSDLException {
WSDLReader reader;
- try {
- reader = (WSDLReader) AccessController.doPrivileged(new
PrivilegedExceptionAction() {
- public Object run() throws WSDLException {
- WSDLFactory factory = WSDLFactory.newInstance();
- return factory.newWSDLReader();
- }
- });
- } catch (PrivilegedActionException e) {
+ try {
+ reader = (WSDLReader) AccessController.doPrivileged(new
PrivilegedExceptionAction() {
+ public Object run() throws WSDLException {
+ return
WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
+ }
+ });
+ } catch (PrivilegedActionException e) {
throw (WSDLException) e.getException();
}
// prevent system out from occurring
Added:
axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/Version.wsdl
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/Version.wsdl?rev=1688758&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/Version.wsdl
(added)
+++ axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/Version.wsdl
Thu Jul 2 02:37:34 2015
@@ -0,0 +1,300 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:ns1="http://org.apache.axis2/xsd"
+ xmlns:ns="http://axisversion.sample"
+ xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns:wsp="http://www.w3.org/ns/ws-policy"
+
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ targetNamespace="http://axisversion.sample">
+ <wsdl:documentation>Version</wsdl:documentation>
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified"
elementFormDefault="qualified" targetNamespace="http://axisversion.sample">
+ <xs:element name="VersionException">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="VersionException"
nillable="true" type="ns:Exception"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name="Exception">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="Message" nillable="true"
type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="getVersion">
+ <xs:complexType>
+ <xs:sequence/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="getVersionResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="getVersionRequest">
+ <wsdl:part name="parameters" element="ns:getVersion"/>
+ </wsdl:message>
+ <wsdl:message name="getVersionResponse">
+ <wsdl:part name="parameters" element="ns:getVersionResponse"/>
+ </wsdl:message>
+ <wsdl:message name="VersionException">
+ <wsdl:part name="parameters" element="ns:VersionException"/>
+ </wsdl:message>
+ <wsdl:portType name="VersionPortType">
+ <wsdl:operation name="getVersionWSAW"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" >
+ <wsdl:input message="ns:getVersionRequest"
wsaw:Action="http://axisversion.sample/VersionPortType/getVersionWSAWRequest"/>
+ <wsdl:output message="ns:getVersionResponse"
wsaw:Action="http://axisversion.sample/VersionPortType/getVersionWSAWResponse"/>
+ <wsdl:fault message="ns:VersionException" name="VersionException"
wsaw:Action="http://axisversion.sample/VersionPortType/Fault/getVersionWSAWException"/>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSA"
xmlns:wsa="http://www.w3.org/2005/08/addressing">
+ <wsdl:input message="ns:getVersionRequest"
wsa:Action="http://axisversion.sample/VersionPortType/getVersionWSARequest"/>
+ <wsdl:output message="ns:getVersionResponse"
wsa:Action="http://axisversion.sample/VersionPortType/getVersionWSAResponse"/>
+ <wsdl:fault message="ns:VersionException" name="VersionException"
wsa:Action="http://axisversion.sample/VersionPortType/Fault/getVersionWSAException"/>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSAM"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
+ <wsdl:input message="ns:getVersionRequest"
wsam:Action="http://axisversion.sample/VersionPortType/getVersionWSAMRequest"/>
+ <wsdl:output message="ns:getVersionResponse"
wsam:Action="http://axisversion.sample/VersionPortType/getVersionWSAMResponse"/>
+ <wsdl:fault message="ns:VersionException" name="VersionException"
wsam:Action="http://axisversion.sample/VersionPortType/Fault/getVersionWSAMException"/>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSAWSubmission"
xmlns:wsaw="http://schemas.xmlsoap.org/ws/2004/08/addressing">
+ <wsdl:input message="ns:getVersionRequest"
wsaw:Action="http://axisversion.sample/VersionPortType/getVersionWSAWSubmissionRequest"/>
+ <wsdl:output message="ns:getVersionResponse"
wsaw:Action="http://axisversion.sample/VersionPortType/getVersionWSAWSubmissionResponse"/>
+ <wsdl:fault message="ns:VersionException" name="VersionException"
wsaw:Action="http://axisversion.sample/VersionPortType/Fault/getVersionWSAWSubmissionException"/>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSAWURI"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" >
+ <wsdl:input message="ns:getVersionRequest"
wsaw:Action="ns:Version/VersionPortType/getVersionWSAWURIRequest"/>
+ <wsdl:output message="ns:getVersionResponse"
wsaw:Action="ns:Version/VersionPortType/getVersionWSAWURIResponse"/>
+ <wsdl:fault message="ns:VersionException" name="VersionException"
wsaw:Action="ns:Version/VersionPortType/Fault/getVersionWSAWURIException"/>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSAURI"
xmlns:wsa="http://www.w3.org/2005/08/addressing">
+ <wsdl:input message="ns:getVersionRequest"
wsa:Action="ns:Version/VersionPortType/getVersionWSAURIRequest"/>
+ <wsdl:output message="ns:getVersionResponse"
wsa:Action="ns:Version/VersionPortType/getVersionWSAURIResponse"/>
+ <wsdl:fault message="ns:VersionException" name="VersionException"
wsa:Action="ns:Version/VersionPortType/Fault/getVersionWSAURIException"/>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSAMURI"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
+ <wsdl:input message="ns:getVersionRequest"
wsam:Action="ns:Version/VersionPortType/getVersionWSAMURIRequest"/>
+ <wsdl:output message="ns:getVersionResponse"
wsam:Action="ns:Version/VersionPortType/getVersionWSAMURIResponse"/>
+ <wsdl:fault message="ns:VersionException" name="VersionException"
wsam:Action="ns:Version/VersionPortType/Fault/getVersionWSAMURIException"/>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSAWSubmissionURI"
xmlns:wsaw="http://schemas.xmlsoap.org/ws/2004/08/addressing">
+ <wsdl:input message="ns:getVersionRequest"
wsaw:Action="ns:Version/VersionPortType/getVersionWSAWSubmissionURIRequest"/>
+ <wsdl:output message="ns:getVersionResponse"
wsaw:Action="ns:Version/VersionPortType/getVersionWSAWSubmissionURIResponse"/>
+ <wsdl:fault message="ns:VersionException" name="VersionException"
wsaw:Action="ns:Version/VersionPortType/Fault/getVersionWSAWSubmissionURIException"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="VersionSoap11Binding" type="ns:VersionPortType">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
+ <wsdl:operation name="getVersionWSAW">
+ <soap:operation style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="VersionException">
+ <soap:fault use="literal" name="VersionException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSA">
+ <soap:operation style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="VersionException">
+ <soap:fault use="literal" name="VersionException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSAM">
+ <soap:operation style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="VersionException">
+ <soap:fault use="literal" name="VersionException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSAWSubmission">
+ <soap:operation style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="VersionException">
+ <soap:fault use="literal" name="VersionException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSAWURI">
+ <soap:operation style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="VersionException">
+ <soap:fault use="literal" name="VersionException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSAURI">
+ <soap:operation style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="VersionException">
+ <soap:fault use="literal" name="VersionException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSAMURI">
+ <soap:operation style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="VersionException">
+ <soap:fault use="literal" name="VersionException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSAWSubmissionURI">
+ <soap:operation style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="VersionException">
+ <soap:fault use="literal" name="VersionException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="VersionSoap12Binding" type="ns:VersionPortType">
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
+ <wsdl:operation name="getVersionWSAW">
+ <soap12:operation style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="VersionException">
+ <soap12:fault use="literal" name="VersionException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSA">
+ <soap12:operation style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="VersionException">
+ <soap12:fault use="literal" name="VersionException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSAM">
+ <soap12:operation style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="VersionException">
+ <soap12:fault use="literal" name="VersionException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSAWSubmission">
+ <soap12:operation style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="VersionException">
+ <soap12:fault use="literal" name="VersionException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSAWURI">
+ <soap12:operation style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="VersionException">
+ <soap12:fault use="literal" name="VersionException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSAURI">
+ <soap12:operation style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="VersionException">
+ <soap12:fault use="literal" name="VersionException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSAMURI">
+ <soap12:operation style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="VersionException">
+ <soap12:fault use="literal" name="VersionException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ <wsdl:operation name="getVersionWSAWSubmissionURI">
+ <soap12:operation style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="VersionException">
+ <soap12:fault use="literal" name="VersionException"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="Version">
+ <wsdl:port name="VersionHttpSoap11Endpoint"
binding="ns:VersionSoap11Binding">
+ <soap:address
location="http://localhost:8080/axis2/services/Version.VersionHttpSoap11Endpoint/"/>
+ </wsdl:port>
+ <wsdl:port name="VersionHttpSoap12Endpoint"
binding="ns:VersionSoap12Binding">
+ <soap12:address
location="http://localhost:8080/axis2/services/Version.VersionHttpSoap12Endpoint/"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Modified:
axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/actionTests.wsdl
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/actionTests.wsdl?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/actionTests.wsdl
(original)
+++
axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/actionTests.wsdl
Thu Jul 2 02:37:34 2015
@@ -77,6 +77,34 @@
<wsdl:fault name="echoFault"
message="tns:echoechoFault1"
wsaw:Action="http://example.org/action/echoFault"></wsdl:fault>
</wsdl:operation>
</wsdl:portType>
+ <wsdl:portType name="withWSAWActionURI">
+ <wsdl:operation name="echo">
+ <wsdl:input message="tns:echoRequest1"
wsaw:Action="tns:actiontest/action/echoIn"></wsdl:input>
+ <wsdl:output message="tns:echoResponse1"
wsaw:Action="tns:actiontest/action/echoOut"></wsdl:output>
+ <wsdl:fault name="echoFault" message="tns:echoechoFault1"
wsaw:Action="tns:actiontest/action/echoFault"></wsdl:fault>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name="withWSAActionURI"
xmlns:wsa="http://www.w3.org/2005/08/addressing">
+ <wsdl:operation name="echo">
+ <wsdl:input message="tns:echoRequest1"
wsa:Action="tns:actiontest/action/echoIn"></wsdl:input>
+ <wsdl:output message="tns:echoResponse1"
wsa:Action="tns:actiontest/action/echoOut"></wsdl:output>
+ <wsdl:fault name="echoFault" message="tns:echoechoFault1"
wsa:Action="tns:actiontest/action/echoFault"></wsdl:fault>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name="withWSAMActionURI"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
+ <wsdl:operation name="echo">
+ <wsdl:input message="tns:echoRequest1"
wsam:Action="tns:actiontest/action/echoIn"></wsdl:input>
+ <wsdl:output message="tns:echoResponse1"
wsam:Action="tns:actiontest/action/echoOut"></wsdl:output>
+ <wsdl:fault name="echoFault" message="tns:echoechoFault1"
wsam:Action="tns:actiontest/action/echoFault"></wsdl:fault>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:portType name="withWSASubmissionActionURI"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
+ <wsdl:operation name="echo">
+ <wsdl:input message="tns:echoRequest1"
wsa:Action="tns:actiontest/action/echoIn"></wsdl:input>
+ <wsdl:output message="tns:echoResponse1"
wsa:Action="tns:actiontest/action/echoOut"></wsdl:output>
+ <wsdl:fault name="echoFault" message="tns:echoechoFault1"
wsa:Action="tns:actiontest/action/echoFault"></wsdl:fault>
+ </wsdl:operation>
+ </wsdl:portType>
<wsdl:portType name="withoutWSAWActionNoName">
<wsdl:operation name="echo">
<wsdl:input message="tns:echoRequest2"></wsdl:input>
Modified:
axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/printWSDLreference.wsdl
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/printWSDLreference.wsdl?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/printWSDLreference.wsdl
(original)
+++
axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/printWSDLreference.wsdl
Thu Jul 2 02:37:34 2015
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
+<?xml version="1.0" encoding="UTF-8"?><!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
@@ -16,8 +15,7 @@
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
- -->
-<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:tns="http://ws.apache.org/axis2"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
targetNamespace="http://ws.apache.org/axis2">
+ --><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:tns="http://ws.apache.org/axis2"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
targetNamespace="http://ws.apache.org/axis2">
<wsdl:types/>
<wsdl:portType name="testPortType">
<wsdl:operation name="test">
Modified:
axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement11_WSDL.wsdl
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement11_WSDL.wsdl?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement11_WSDL.wsdl
(original)
+++
axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement11_WSDL.wsdl
Thu Jul 2 02:37:34 2015
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
+<?xml version="1.0" encoding="UTF-8"?><!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
@@ -16,8 +15,7 @@
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
- -->
-<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:tns="http://ws.apache.org/axis2"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
targetNamespace="http://ws.apache.org/axis2">
+ --><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:tns="http://ws.apache.org/axis2"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
targetNamespace="http://ws.apache.org/axis2">
<wsdl:types/>
<wsdl:portType name="testPortType">
<wsdl:operation name="test">
Modified:
axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement_WSDL.wsdl
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement_WSDL.wsdl?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement_WSDL.wsdl
(original)
+++
axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/testGenerateInterfaceOperationElement_WSDL.wsdl
Thu Jul 2 02:37:34 2015
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
+<?xml version="1.0" encoding="UTF-8"?><!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
@@ -16,8 +15,7 @@
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
- -->
-<wsdl2:description xmlns:wsdl2="http://www.w3.org/ns/wsdl"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:tns="http://ws.apache.org/axis2"
xmlns:wsoap="http://www.w3.org/ns/wsdl/soap"
xmlns:wrpc="http://www.w3.org/ns/wsdl/rpc"
xmlns:wsdlx="http://www.w3.org/ns/wsdl-extensions"
xmlns:whttp="http://www.w3.org/ns/wsdl/http"
targetNamespace="http://ws.apache.org/axis2">
+ --><wsdl2:description xmlns:wsdl2="http://www.w3.org/ns/wsdl"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:tns="http://ws.apache.org/axis2"
xmlns:wsoap="http://www.w3.org/ns/wsdl/soap"
xmlns:wrpc="http://www.w3.org/ns/wsdl/rpc"
xmlns:wsdlx="http://www.w3.org/ns/wsdl-extensions"
xmlns:whttp="http://www.w3.org/ns/wsdl/http"
targetNamespace="http://ws.apache.org/axis2">
<wsdl2:types/>
<wsdl2:interface name="ServiceInterface">
<wsdl2:operation name="test"
pattern="http://www.w3.org/ns/wsdl/in-out">
Modified:
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/addressing/wsdl/WSDL11ActionHelperTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/addressing/wsdl/WSDL11ActionHelperTest.java?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/addressing/wsdl/WSDL11ActionHelperTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/addressing/wsdl/WSDL11ActionHelperTest.java
Thu Jul 2 02:37:34 2015
@@ -21,6 +21,7 @@ package org.apache.axis2.addressing.wsdl
import junit.framework.TestCase;
import org.apache.axis2.AbstractTestCase;
+import org.apache.axis2.wsdl.WSDLUtil;
import javax.wsdl.Definition;
import javax.wsdl.Fault;
@@ -28,7 +29,6 @@ import javax.wsdl.Input;
import javax.wsdl.Operation;
import javax.wsdl.Output;
import javax.wsdl.PortType;
-import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
import java.io.File;
@@ -43,7 +43,7 @@ public class WSDL11ActionHelperTest exte
protected void setUp() throws Exception {
super.setUp();
- WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+ WSDLReader reader =
WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
reader.setFeature("javax.wsdl.importDocuments", false);
reader.setFeature("javax.wsdl.verbose", false);
@@ -156,6 +156,158 @@ public class WSDL11ActionHelperTest exte
List operations = pt.getOperations();
Operation op = (Operation) operations.get(0);
Fault fault = op.getFault("echoFault");
+ String actualAction =
+ WSDL11ActionHelper.getActionFromFaultElement(definition, pt,
op, fault);
+ assertEquals(expectedAction, actualAction);
+ }
+
+ // Test reading wsaw:Action values
+ // portType=withWSAWActionURI
+ // operation=echo
+ public void testGetWSAWInputActionURI() {
+ String expectedAction = "tns:actiontest/action/echoIn";
+ PortType pt = definition
+ .getPortType(new
QName("http://ws.apache.org/axis2/actiontest/", "withWSAWActionURI"));
+ List operations = pt.getOperations();
+ Operation op = (Operation) operations.get(0);
+ Input in = op.getInput();
+ String actualAction =
WSDL11ActionHelper.getActionFromInputElement(definition, pt, op, in);
+ assertEquals(expectedAction, actualAction);
+ }
+
+ public void testGetWSAWOutputActionURI() {
+ String expectedAction = "tns:actiontest/action/echoOut";
+ PortType pt = definition
+ .getPortType(new
QName("http://ws.apache.org/axis2/actiontest/", "withWSAWActionURI"));
+ List operations = pt.getOperations();
+ Operation op = (Operation) operations.get(0);
+ Output out = op.getOutput();
+ String actualAction =
+ WSDL11ActionHelper.getActionFromOutputElement(definition, pt,
op, out);
+ assertEquals(expectedAction, actualAction);
+ }
+
+ public void testGetWSAWFaultActionURI() {
+ String expectedAction = "tns:actiontest/action/echoFault";
+ PortType pt = definition
+ .getPortType(new
QName("http://ws.apache.org/axis2/actiontest/", "withWSAWActionURI"));
+ List operations = pt.getOperations();
+ Operation op = (Operation) operations.get(0);
+ Fault fault = op.getFault("echoFault");
+ String actualAction =
+ WSDL11ActionHelper.getActionFromFaultElement(definition, pt,
op, fault);
+ assertEquals(expectedAction, actualAction);
+ }
+
+ // Test reading wsaw:Action values
+ // portType=withWSAActionURI
+ // operation=echo
+ public void testGetWSAInputAction() {
+ String expectedAction = "tns:actiontest/action/echoIn";
+ PortType pt = definition
+ .getPortType(new
QName("http://ws.apache.org/axis2/actiontest/", "withWSAActionURI"));
+ List operations = pt.getOperations();
+ Operation op = (Operation) operations.get(0);
+ Input in = op.getInput();
+ String actualAction =
WSDL11ActionHelper.getActionFromInputElement(definition, pt, op, in);
+ assertEquals(expectedAction, actualAction);
+ }
+
+ public void testGetWSAOutputAction() {
+ String expectedAction = "tns:actiontest/action/echoOut";
+ PortType pt = definition
+ .getPortType(new
QName("http://ws.apache.org/axis2/actiontest/", "withWSAActionURI"));
+ List operations = pt.getOperations();
+ Operation op = (Operation) operations.get(0);
+ Output out = op.getOutput();
+ String actualAction =
+ WSDL11ActionHelper.getActionFromOutputElement(definition, pt,
op, out);
+ assertEquals(expectedAction, actualAction);
+ }
+
+ public void testGetWSAFaultAction() {
+ String expectedAction = "tns:actiontest/action/echoFault";
+ PortType pt = definition
+ .getPortType(new
QName("http://ws.apache.org/axis2/actiontest/", "withWSAActionURI"));
+ List operations = pt.getOperations();
+ Operation op = (Operation) operations.get(0);
+ Fault fault = op.getFault("echoFault");
+ String actualAction =
+ WSDL11ActionHelper.getActionFromFaultElement(definition, pt,
op, fault);
+ assertEquals(expectedAction, actualAction);
+ }
+
+ // Test reading wsaw:Action values
+ // portType=withWSAMActionURI
+ // operation=echo
+ public void testGetWSAMInputAction() {
+ String expectedAction = "tns:actiontest/action/echoIn";
+ PortType pt = definition
+ .getPortType(new
QName("http://ws.apache.org/axis2/actiontest/", "withWSAMActionURI"));
+ List operations = pt.getOperations();
+ Operation op = (Operation) operations.get(0);
+ Input in = op.getInput();
+ String actualAction =
WSDL11ActionHelper.getActionFromInputElement(definition, pt, op, in);
+ assertEquals(expectedAction, actualAction);
+ }
+
+ public void testGetWSAMOutputAction() {
+ String expectedAction = "tns:actiontest/action/echoOut";
+ PortType pt = definition
+ .getPortType(new
QName("http://ws.apache.org/axis2/actiontest/", "withWSAMActionURI"));
+ List operations = pt.getOperations();
+ Operation op = (Operation) operations.get(0);
+ Output out = op.getOutput();
+ String actualAction =
+ WSDL11ActionHelper.getActionFromOutputElement(definition, pt,
op, out);
+ assertEquals(expectedAction, actualAction);
+ }
+
+ public void testGetWSAMFaultAction() {
+ String expectedAction = "tns:actiontest/action/echoFault";
+ PortType pt = definition
+ .getPortType(new
QName("http://ws.apache.org/axis2/actiontest/", "withWSAMActionURI"));
+ List operations = pt.getOperations();
+ Operation op = (Operation) operations.get(0);
+ Fault fault = op.getFault("echoFault");
+ String actualAction =
+ WSDL11ActionHelper.getActionFromFaultElement(definition, pt,
op, fault);
+ assertEquals(expectedAction, actualAction);
+ }
+
+ // Test reading wsaw:Action values
+ // portType=withWSASubmissionActionURI
+ // operation=echo
+ public void testGetWSAWSubmissionInputAction() {
+ String expectedAction = "tns:actiontest/action/echoIn";
+ PortType pt = definition
+ .getPortType(new
QName("http://ws.apache.org/axis2/actiontest/", "withWSASubmissionActionURI"));
+ List operations = pt.getOperations();
+ Operation op = (Operation) operations.get(0);
+ Input in = op.getInput();
+ String actualAction =
WSDL11ActionHelper.getActionFromInputElement(definition, pt, op, in);
+ assertEquals(expectedAction, actualAction);
+ }
+
+ public void testGetWSAWSubmissionOutputAction() {
+ String expectedAction = "tns:actiontest/action/echoOut";
+ PortType pt = definition
+ .getPortType(new
QName("http://ws.apache.org/axis2/actiontest/", "withWSASubmissionActionURI"));
+ List operations = pt.getOperations();
+ Operation op = (Operation) operations.get(0);
+ Output out = op.getOutput();
+ String actualAction =
+ WSDL11ActionHelper.getActionFromOutputElement(definition, pt,
op, out);
+ assertEquals(expectedAction, actualAction);
+ }
+
+ public void testGetWSAWSubmissionFaultAction() {
+ String expectedAction = "tns:actiontest/action/echoFault";
+ PortType pt = definition
+ .getPortType(new
QName("http://ws.apache.org/axis2/actiontest/", "withWSASubmissionActionURI"));
+ List operations = pt.getOperations();
+ Operation op = (Operation) operations.get(0);
+ Fault fault = op.getFault("echoFault");
String actualAction =
WSDL11ActionHelper.getActionFromFaultElement(definition, pt,
op, fault);
assertEquals(expectedAction, actualAction);
Modified:
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/WSDL11ToAxisServiceBuilderTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/WSDL11ToAxisServiceBuilderTest.java?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/WSDL11ToAxisServiceBuilderTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/WSDL11ToAxisServiceBuilderTest.java
Thu Jul 2 02:37:34 2015
@@ -18,12 +18,17 @@
*/
package org.apache.axis2.description;
+import java.io.File;
import java.io.FileInputStream;
+import java.io.IOException;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.List;
import javax.xml.namespace.QName;
+import org.apache.axis2.engine.AxisConfiguration;
+
import junit.framework.TestCase;
public class WSDL11ToAxisServiceBuilderTest extends TestCase {
@@ -54,4 +59,58 @@ public class WSDL11ToAxisServiceBuilderT
in.close();
}
}
+
+ private AxisService populateAxisService(AxisConfiguration axisConf, File
wsdlFile) throws IOException {
+ InputStream in = null;
+ try {
+ in = new FileInputStream(wsdlFile);
+ WSDL11ToAxisServiceBuilder wsdl11Builder = new
WSDL11ToAxisServiceBuilder(in);
+ if (axisConf != null) {
+ wsdl11Builder.useAxisConfiguration(axisConf);
+ }
+ AxisService service = wsdl11Builder.populateService();
+ assertNotNull("Could not load AxisService from wsdl: " +
wsdlFile.getAbsolutePath(), service);
+
+ return service;
+ } finally {
+ if (in != null) {
+ in.close();
+ }
+ }
+ }
+
+ private void checkOperationActions(AxisService service, AxisOperation
operation, String expectedInputAction, String expectedOutputAction, String
expectedFaultAction) {
+ assertEquals(String.format("Expected that operation '%s' of service
'%s' defines an input action of '%s' but it defines '%s' instead.",
operation.getName(), service.getName(), expectedInputAction,
operation.getInputAction()), expectedInputAction, operation.getInputAction());
+ assertEquals(String.format("Expected that operation '%s' of service
'%s' defines an output action of '%s' but it defines '%s' instead.",
operation.getName(), service.getName(), expectedOutputAction,
operation.getOutputAction()), expectedOutputAction,
operation.getOutputAction());
+ assertEquals(String.format("Expected that operation '%s' of service
'%s' defines an input action of '%s' but it defines '%s' instead.",
operation.getName(), service.getName(), expectedFaultAction,
operation.getFaultAction()), expectedFaultAction, operation.getFaultAction());
+
+ ArrayList<String> wsaMappingList = operation.getWSAMappingList();
+ assertEquals(String.format("Expected that operation '%s' of service
'%s' has a 'wsaMappingList' of size '%d' but size is '%d' instead.",
operation.getName(), service.getName(), 1, wsaMappingList.size()), 1,
wsaMappingList.size());
+ assertTrue(String.format("Expected that the 'wsaMappingList' of
operation '%s' of service '%s' contains an entry of '%s' but it does not.",
operation.getName(), service.getName(), expectedInputAction),
wsaMappingList.contains(expectedInputAction));
+
+ assertSame(String.format("Expected that 'operationsAliasesMap' of
service '%s' contains a '%s' operation for action '%s'.", service.getName(),
operation.getName(), expectedInputAction),
service.getOperationByAction(expectedInputAction), operation);
+ }
+
+ public void testGetVersionActions() throws IOException {
+ AxisConfiguration axisConf = new AxisConfiguration();
+ AxisService service = populateAxisService(axisConf, new
File("test-resources/wsdl/Version.wsdl"));
+
+ String[] operationNames = new String[] {
+ "getVersionWSAW", "getVersionWSA", "getVersionWSAM",
"getVersionWSAWSubmission",
+ "getVersionWSAWURI", "getVersionWSAURI",
"getVersionWSAMURI", "getVersionWSAWSubmissionURI"
+ };
+
+ for (String operationName : operationNames) {
+ QName operationQName = new QName("http://axisversion.sample",
operationName);
+ AxisOperation operation = service.getOperation(operationQName);
+ assertNotNull(String.format("Could not find AxisOperation '%s'
in service: %s", operationQName.toString(), service.getName()), operation);
+
+ String prefix = operationName.endsWith("URI") ? "ns:Version" :
"http://axisversion.sample";
+ String expectedInputAction =
String.format("%s/VersionPortType/%sRequest", prefix,
operationQName.getLocalPart());
+ String expectedOutputAction =
String.format("%s/VersionPortType/%sResponse", prefix,
operationQName.getLocalPart());
+ String expectedFaultAction =
String.format("%s/VersionPortType/Fault/%sException", prefix,
operationQName.getLocalPart());
+
+ checkOperationActions(service, operation,
expectedInputAction,expectedOutputAction,expectedFaultAction);
+ }
+ }
}
Modified:
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/WSDLWrapperTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/WSDLWrapperTest.java?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/WSDLWrapperTest.java
(original)
+++
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/WSDLWrapperTest.java
Thu Jul 2 02:37:34 2015
@@ -20,23 +20,23 @@
package org.apache.axis2.description;
import junit.framework.TestCase;
-import org.apache.axis2.AbstractTestCase;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.wsdl.util.WSDLDefinitionWrapper;
-import org.w3c.dom.Document;
-import org.xml.sax.ErrorHandler;
+import org.apache.axis2.AbstractTestCase;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.wsdl.WSDLUtil;
+import org.apache.axis2.wsdl.util.WSDLDefinitionWrapper;
+import org.w3c.dom.Document;
+import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
-import javax.wsdl.Definition;
-import javax.wsdl.Types;
-import javax.wsdl.WSDLException;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLLocator;
-import javax.wsdl.xml.WSDLReader;
-import javax.xml.namespace.QName;
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.wsdl.WSDLException;
+import javax.wsdl.xml.WSDLLocator;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -145,13 +145,13 @@ public class WSDLWrapperTest extends Tes
}
}
-
- private Definition readInTheWSDLFile(InputStream in) throws WSDLException {
-
- WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
-
- // switch off the verbose mode for all usecases
- reader.setFeature(JAVAX_WSDL_VERBOSE_MODE_KEY, false);
+
+ private Definition readInTheWSDLFile(InputStream in) throws WSDLException {
+
+ WSDLReader reader =
WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
+
+ // switch off the verbose mode for all usecases
+ reader.setFeature(JAVAX_WSDL_VERBOSE_MODE_KEY, false);
// if the custem resolver is present then use it
if (customWSLD4JResolver != null) {
Added:
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/wsdl/WSDLUtilTest.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/wsdl/WSDLUtilTest.java?rev=1688758&view=auto
==============================================================================
---
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/wsdl/WSDLUtilTest.java
(added)
+++
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/wsdl/WSDLUtilTest.java
Thu Jul 2 02:37:34 2015
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.wsdl;
+
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.AttributeExtensible;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.xml.WSDLReader;
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.axis2.addressing.AddressingConstants;
+
+/**
+ * Unit test for {@link WSDLUtil}.
+ */
+public class WSDLUtilTest extends TestCase {
+
+ /**
+ * Tests whether creating new WSDLReader using {@link
WSDLUtil#newWSDLReaderWithPopulatedExtensionRegistry()}
+ * correctly registers extension attributes' types.
+ * @throws WSDLException
+ */
+ public void testNewWSDLReaderWithPopulatedExtensionRegistry() throws
WSDLException {
+ WSDLReader reader =
WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
+
+ ExtensionRegistry extRegistry = reader.getExtensionRegistry();
+ assertNotNull(extRegistry);
+
+ checkExtensionAttributeTypes(extRegistry, true);
+ }
+
+ /**
+ * The method will assert that the default extension attribute types in
the given <code>extensionRegistry</code>
+ * are registered or not depending on the specified
<code>isExpectRegistered</code> argument.
+ * See {@link
WSDLUtil#registerDefaultExtensionAttributeTypes(ExtensionRegistry)}.
+ *
+ * @param extRegistry The extension registry to check.
+ * @param isExpectRegistered Whether to expect that default extension
types are registered. If set to false,
+ * the method will expect that the default extension attribute types are
not registered and the
+ * extension registry returns {@link AttributeExtensible.NO_DECLARED_TYPE}
when queried for these.
+ */
+ private void checkExtensionAttributeTypes(ExtensionRegistry extRegistry,
boolean isExpectRegistered) {
+ assertNotNull(extRegistry);
+
+ int expectedType = isExpectRegistered ? AttributeExtensible.STRING_TYPE
: AttributeExtensible.NO_DECLARED_TYPE;
+
+ QName finalWSANS = new
QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_ACTION);
+ assertEquals(expectedType,
extRegistry.queryExtensionAttributeType(javax.wsdl.Input.class, finalWSANS));
+ assertEquals(expectedType,
extRegistry.queryExtensionAttributeType(javax.wsdl.Output.class, finalWSANS));
+ assertEquals(expectedType,
extRegistry.queryExtensionAttributeType(javax.wsdl.Fault.class, finalWSANS));
+
+ QName finalWSAWNS = new
QName(AddressingConstants.Final.WSAW_NAMESPACE, AddressingConstants.WSA_ACTION);
+ assertEquals(expectedType,
extRegistry.queryExtensionAttributeType(javax.wsdl.Input.class, finalWSAWNS));
+ assertEquals(expectedType,
extRegistry.queryExtensionAttributeType(javax.wsdl.Output.class, finalWSAWNS));
+ assertEquals(expectedType,
extRegistry.queryExtensionAttributeType(javax.wsdl.Fault.class, finalWSAWNS));
+
+ QName finalWSAMNS = new
QName(AddressingConstants.Final.WSAM_NAMESPACE, AddressingConstants.WSA_ACTION);
+ assertEquals(expectedType,
extRegistry.queryExtensionAttributeType(javax.wsdl.Input.class, finalWSAMNS));
+ assertEquals(expectedType,
extRegistry.queryExtensionAttributeType(javax.wsdl.Output.class, finalWSAMNS));
+ assertEquals(expectedType,
extRegistry.queryExtensionAttributeType(javax.wsdl.Fault.class, finalWSAMNS));
+
+ QName submissionWSAWNS = new
QName(AddressingConstants.Submission.WSA_NAMESPACE,
AddressingConstants.WSA_ACTION);
+ assertEquals(expectedType,
extRegistry.queryExtensionAttributeType(javax.wsdl.Input.class,
submissionWSAWNS));
+ assertEquals(expectedType,
extRegistry.queryExtensionAttributeType(javax.wsdl.Output.class,
submissionWSAWNS));
+ assertEquals(expectedType,
extRegistry.queryExtensionAttributeType(javax.wsdl.Fault.class,
submissionWSAWNS));
+ }
+}
Modified:
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java
(original)
+++
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java
Thu Jul 2 02:37:34 2015
@@ -36,6 +36,7 @@ import org.apache.axis2.jaxws.util.Catal
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.util.SchemaUtil;
import org.apache.axis2.wsdl.WSDLConstants;
+import org.apache.axis2.wsdl.WSDLUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ws.commons.schema.XmlSchema;
@@ -47,7 +48,6 @@ import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.wsdl.Definition;
import javax.wsdl.WSDLException;
-import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.ws.WebServiceException;
@@ -238,8 +238,7 @@ public class JAXWSRIWSDLGenerator implem
for (File wsdlFile : wsdlFiles) {
if (wsdlFile != null) {
try {
- WSDLFactory wsdlFactory = WSDLFactory.newInstance();
- WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
+ WSDLReader wsdlReader =
WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
InputStream is = wsdlFile.toURL().openStream();
Definition definition =
wsdlReader.readWSDL(localOutputDirectory,
new InputSource(is));
Modified:
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java
(original)
+++
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/util/WSDL4JWrapper.java
Thu Jul 2 02:37:34 2015
@@ -32,6 +32,7 @@ import org.apache.axis2.jaxws.wsdl.WSDLR
import org.apache.axis2.metadata.factory.ResourceFinderFactory;
import org.apache.axis2.metadata.registry.MetadataFactoryRegistry;
import org.apache.axis2.metadata.resource.ResourceFinder;
+import org.apache.axis2.wsdl.WSDLUtil;
import org.apache.axis2.wsdl.util.WSDLDefinitionWrapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -44,7 +45,6 @@ import javax.wsdl.Service;
import javax.wsdl.WSDLException;
import javax.wsdl.extensions.ExtensibilityElement;
import javax.wsdl.extensions.soap.SOAPOperation;
-import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
import java.io.File;
@@ -464,8 +464,7 @@ public class WSDL4JWrapper implements WS
reader = (WSDLReader)AccessController.doPrivileged(
new PrivilegedExceptionAction() {
public Object run() throws WSDLException {
- WSDLFactory factory = WSDLFactory.newInstance();
- return factory.newWSDLReader();
+ return
WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
}
});
} catch (PrivilegedActionException e) {
Modified:
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/wsdl/WSDLReaderConfiguratorImpl.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/wsdl/WSDLReaderConfiguratorImpl.java?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/wsdl/WSDLReaderConfiguratorImpl.java
(original)
+++
axis/axis2/java/core/trunk/modules/metadata/src/org/apache/axis2/jaxws/wsdl/WSDLReaderConfiguratorImpl.java
Thu Jul 2 02:37:34 2015
@@ -17,14 +17,18 @@
* under the License.
*/
-package org.apache.axis2.jaxws.wsdl;
-
-import javax.wsdl.WSDLException;
-import javax.wsdl.xml.WSDLReader;
-
-/**
- * An instance of this class will be registered with the
MetadataFactoryRegistry
- * and will be retrieved when a WSDLReader instance is created. This
implementation
+package org.apache.axis2.jaxws.wsdl;
+
+import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.ExtensionRegistry;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+
+import org.apache.axis2.wsdl.WSDLUtil;
+
+/**
+ * An instance of this class will be registered with the
MetadataFactoryRegistry
+ * and will be retrieved when a WSDLReader instance is created. This
implementation
* will be able to configure the instance as needed.
*
*/
@@ -35,9 +39,18 @@ public class WSDLReaderConfiguratorImpl
*/
public void configureReaderInstance(WSDLReader reader) throws
WSDLException
{
- // prevent the WSDLReader instance from using the System.out
- // stream for messages and logging
- reader.setFeature(com.ibm.wsdl.Constants.FEATURE_VERBOSE,
false);
- }
-
-}
+ // prevent the WSDLReader instance from using the System.out
+ // stream for messages and logging
+ reader.setFeature(com.ibm.wsdl.Constants.FEATURE_VERBOSE,
false);
+
+ WSDLFactory factory = WSDLFactory.newInstance();
+ ExtensionRegistry extRegistry = reader.getExtensionRegistry();
+ if (extRegistry == null) {
+ extRegistry = factory.newPopulatedExtensionRegistry();
+ }
+
+ WSDLUtil.registerDefaultExtensionAttributeTypes(extRegistry);
+ reader.setExtensionRegistry(extRegistry);
+ }
+
+}
Modified:
axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/DescriptionTestUtils.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/DescriptionTestUtils.java?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/DescriptionTestUtils.java
(original)
+++
axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/jaxws/description/DescriptionTestUtils.java
Thu Jul 2 02:37:34 2015
@@ -21,9 +21,9 @@
package org.apache.axis2.jaxws.description;
import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
+import org.apache.axis2.wsdl.WSDLUtil;
import javax.wsdl.Definition;
-import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -68,8 +68,7 @@ public class DescriptionTestUtils {
static public Definition createWSDLDefinition(URL wsdlURL) {
Definition wsdlDefinition = null;
try {
- WSDLFactory factory = WSDLFactory.newInstance();
- WSDLReader reader = factory.newWSDLReader();
+ WSDLReader reader =
WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
wsdlDefinition = reader.readWSDL(wsdlURL.toString());
wsdlDefinition.setDocumentBaseURI(wsdlURL.toString());
}
Modified:
axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/metadata/registry/MetadataFactoryRegistryTests.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/metadata/registry/MetadataFactoryRegistryTests.java?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/metadata/registry/MetadataFactoryRegistryTests.java
(original)
+++
axis/axis2/java/core/trunk/modules/metadata/test/org/apache/axis2/metadata/registry/MetadataFactoryRegistryTests.java
Thu Jul 2 02:37:34 2015
@@ -18,14 +18,14 @@
*/
package org.apache.axis2.metadata.registry;
-
-import junit.framework.TestCase;
-import org.apache.axis2.jaxws.wsdl.WSDLReaderConfigurator;
-
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import java.io.File;
-
+
+import junit.framework.TestCase;
+import org.apache.axis2.jaxws.wsdl.WSDLReaderConfigurator;
+import org.apache.axis2.wsdl.WSDLUtil;
+
+import javax.wsdl.xml.WSDLReader;
+import java.io.File;
+
public class MetadataFactoryRegistryTests extends TestCase {
@@ -50,14 +50,13 @@ public class MetadataFactoryRegistryTest
}
public void testRegisterWSDLReaderConfigurator() {
- Exception e = null;
- WSDLReader reader = null;
- try {
- WSDLFactory factory = WSDLFactory.newInstance();
- reader = factory.newWSDLReader();
- }
- catch(Exception e2) {
- e.printStackTrace();
+ Exception e = null;
+ WSDLReader reader = null;
+ try {
+ reader = WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
+ }
+ catch(Exception e2) {
+ e.printStackTrace();
e = e2;
}
assertNull(e);
Modified:
axis/axis2/java/core/trunk/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/util/WSDLPropertyReader.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/util/WSDLPropertyReader.java?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/util/WSDLPropertyReader.java
(original)
+++
axis/axis2/java/core/trunk/modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/util/WSDLPropertyReader.java
Thu Jul 2 02:37:34 2015
@@ -20,12 +20,12 @@
package org.apache.axis2.tool.codegen.eclipse.util;
import org.apache.axis2.util.URLProcessor;
+import org.apache.axis2.wsdl.WSDLUtil;
import javax.wsdl.Definition;
import javax.wsdl.Port;
import javax.wsdl.Service;
import javax.wsdl.WSDLException;
-import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
import java.util.ArrayList;
@@ -49,7 +49,7 @@ public class WSDLPropertyReader {
private Definition wsdlDefinition = null;
public void readWSDL(String filepath) throws WSDLException {
- WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+ WSDLReader reader =
WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
wsdlDefinition = reader.readWSDL(filepath);
}
Modified:
axis/axis2/java/core/trunk/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/CodegenBean.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/CodegenBean.java?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/CodegenBean.java
(original)
+++
axis/axis2/java/core/trunk/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/CodegenBean.java
Thu Jul 2 02:37:34 2015
@@ -29,6 +29,7 @@ import org.apache.axis2.description.WSDL
import org.apache.axis2.util.CommandLineOption;
import org.apache.axis2.util.CommandLineOptionConstants;
import org.apache.axis2.util.URLProcessor;
+import org.apache.axis2.wsdl.WSDLUtil;
import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
import org.apache.axis2.wsdl.codegen.CodeGenerationEngine;
@@ -36,7 +37,6 @@ import javax.wsdl.Definition;
import javax.wsdl.Port;
import javax.wsdl.Service;
import javax.wsdl.WSDLException;
-import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import javax.xml.namespace.QName;
import java.io.File;
@@ -412,7 +412,7 @@ public class CodegenBean {
public void readWSDL() throws WSDLException {
- WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+ WSDLReader reader =
WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
wsdlDefinition = reader.readWSDL(WSDLFileName) ;
if (wsdlDefinition != null) {
wsdlDefinition.setDocumentBaseURI(WSDLFileName);
Modified:
axis/axis2/java/core/trunk/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/WSDLFileSelectionPage.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/WSDLFileSelectionPage.java?rev=1688758&r1=1688757&r2=1688758&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/WSDLFileSelectionPage.java
(original)
+++
axis/axis2/java/core/trunk/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/WSDLFileSelectionPage.java
Thu Jul 2 02:37:34 2015
@@ -23,12 +23,12 @@ import org.apache.axis2.tools.component.
import org.apache.axis2.tools.component.WizardPanel;
import org.apache.axis2.tools.idea.WSDLFileFilter;
import org.apache.axis2.tools.wizardframe.CodegenFrame;
+import org.apache.axis2.wsdl.WSDLUtil;
import org.apache.ideaplugin.bean.ArchiveBean;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.wsdl.WSDLException;
-import javax.wsdl.factory.WSDLFactory;
import javax.wsdl.xml.WSDLReader;
import java.awt.*;
import java.awt.event.ActionEvent;
@@ -205,7 +205,7 @@ public class WSDLFileSelectionPage exten
private void checkWSDLFile(){
if (txtWSDL.getText().equals("") ) {
try{
- WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
+ WSDLReader reader =
WSDLUtil.newWSDLReaderWithPopulatedExtensionRegistry();
reader.readWSDL(txtWSDL.getText().trim()) ;
}catch(WSDLException e1) {
txtWSDL.setText("");