diff --git a/api/.DS_Store b/api/.DS_Store new file mode 100644 index 00000000000..7169c2a4796 Binary files /dev/null and b/api/.DS_Store differ diff --git a/assemblies/pentaho-solutions/src/main/resources/pentaho-solutions/system/axis/axis2_config.xml b/assemblies/pentaho-solutions/src/main/resources/pentaho-solutions/system/axis/axis2_config.xml deleted file mode 100644 index c550e8807cc..00000000000 --- a/assemblies/pentaho-solutions/src/main/resources/pentaho-solutions/system/axis/axis2_config.xml +++ /dev/null @@ -1,283 +0,0 @@ - - - - - - - - - true - false - false - - - false - - - - true - - - - - - false - - - admin - axis2 - - - - - - - - - - - - - - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6060 - - - - - - - - - - - - - - - - - - - - - HTTP/1.1 - chunked - - - HTTP/1.1 - chunked - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assemblies/pentaho-solutions/src/main/resources/pentaho-solutions/system/default-plugin/plugin.xml b/assemblies/pentaho-solutions/src/main/resources/pentaho-solutions/system/default-plugin/plugin.xml index 97428e89aff..08c6cca2f80 100644 --- a/assemblies/pentaho-solutions/src/main/resources/pentaho-solutions/system/default-plugin/plugin.xml +++ b/assemblies/pentaho-solutions/src/main/resources/pentaho-solutions/system/default-plugin/plugin.xml @@ -1,17 +1,6 @@ - - - - diff --git a/assemblies/pentaho-solutions/src/main/resources/pentaho-solutions/system/pentahoObjects.spring.xml b/assemblies/pentaho-solutions/src/main/resources/pentaho-solutions/system/pentahoObjects.spring.xml index 72de277cb42..fae30801f0e 100644 --- a/assemblies/pentaho-solutions/src/main/resources/pentaho-solutions/system/pentahoObjects.spring.xml +++ b/assemblies/pentaho-solutions/src/main/resources/pentaho-solutions/system/pentahoObjects.spring.xml @@ -86,16 +86,12 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - - - diff --git a/assemblies/pentaho-war/pom.xml b/assemblies/pentaho-war/pom.xml index 14efd82b0bb..ab4282163af 100644 --- a/assemblies/pentaho-war/pom.xml +++ b/assemblies/pentaho-war/pom.xml @@ -865,12 +865,6 @@ org.mozilla rhino - - - commons-httpclient - commons-httpclient - 3.0.1 - commons-lang commons-lang diff --git a/extensions/pom.xml b/extensions/pom.xml index 76b970ab6dd..58313040aa7 100644 --- a/extensions/pom.xml +++ b/extensions/pom.xml @@ -582,66 +582,6 @@ - - org.apache.axis2 - axis2-adb - ${axis2.version} - compile - - - * - * - - - - - org.apache.axis2 - axis2-codegen - ${axis2.version} - compile - - - * - * - - - - - org.apache.axis2 - axis2-java2wsdl - ${axis2.version} - compile - - - * - * - - - - - org.pentaho.axis2 - axis2-kernel - ${axis2.version} - compile - - - * - * - - - - - org.apache.axis2 - axis2-transport-http - ${axis2.version} - compile - - - * - * - - - org.apache.ws.commons.axiom axiom-api diff --git a/extensions/src/it/java/org/pentaho/test/platform/plugin/pluginmgr/AxisWebServiceManagerIT.java b/extensions/src/it/java/org/pentaho/test/platform/plugin/pluginmgr/AxisWebServiceManagerIT.java index 3a00648ca93..e69de29bb2d 100644 --- a/extensions/src/it/java/org/pentaho/test/platform/plugin/pluginmgr/AxisWebServiceManagerIT.java +++ b/extensions/src/it/java/org/pentaho/test/platform/plugin/pluginmgr/AxisWebServiceManagerIT.java @@ -1,180 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.test.platform.plugin.pluginmgr; - -import com.mockrunner.mock.web.MockServletContext; -import org.junit.Before; -import org.junit.Test; -import org.pentaho.platform.api.engine.IContentGenerator; -import org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory.Scope; -import org.pentaho.platform.api.engine.IPentahoSession; -import org.pentaho.platform.api.engine.IPlatformPlugin; -import org.pentaho.platform.api.engine.IPluginManager; -import org.pentaho.platform.api.engine.IPluginProvider; -import org.pentaho.platform.api.engine.IServiceManager; -import org.pentaho.platform.api.engine.ISolutionEngine; -import org.pentaho.platform.api.engine.PlatformPluginRegistrationException; -import org.pentaho.platform.api.engine.PluginServiceDefinition; -import org.pentaho.platform.api.engine.ServiceInitializationException; -import org.pentaho.platform.api.ui.IThemeManager; -import org.pentaho.platform.engine.core.solution.ContentGeneratorInfo; -import org.pentaho.platform.engine.core.system.PentahoSessionHolder; -import org.pentaho.platform.engine.core.system.PentahoSystem; -import org.pentaho.platform.engine.core.system.StandaloneSession; -import org.pentaho.platform.engine.services.solution.SolutionEngine; -import org.pentaho.platform.plugin.services.pluginmgr.DefaultPluginManager; -import org.pentaho.platform.plugin.services.pluginmgr.PlatformPlugin; -import org.pentaho.platform.plugin.services.pluginmgr.servicemgr.AxisWebServiceManager; -import org.pentaho.platform.plugin.services.pluginmgr.servicemgr.DefaultServiceManager; -import org.pentaho.platform.plugin.services.pluginmgr.servicemgr.IServiceTypeManager; -import org.pentaho.platform.plugin.services.webservices.content.StyledHtmlAxisServiceLister; -import org.pentaho.platform.web.html.themes.DefaultThemeManager; -import org.pentaho.test.platform.engine.core.EchoServiceBean; -import org.pentaho.test.platform.engine.core.MicroPlatform; -import org.pentaho.test.platform.engine.services.ContentGeneratorUtil; -import org.pentaho.test.platform.utils.TestResourceLocation; - -import java.io.File; -import java.io.FileInputStream; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -@SuppressWarnings( "nls" ) -public class AxisWebServiceManagerIT { - - private MicroPlatform microPlatform; - - /* - * Wire up an in-memory platform to register and expose plug-in web services. - */ - @SuppressWarnings( "deprecation" ) - @Before - public void init0() throws ServiceInitializationException { - // set solution path to a place that hosts an axis config file - microPlatform = new MicroPlatform( TestResourceLocation.TEST_RESOURCES + "/AxisWebServiceManagerTest/", "http://test/" ); - assertNotNull( PentahoSystem.getObjectFactory() ); - microPlatform.define( ISolutionEngine.class, SolutionEngine.class ); - assertNotNull( PentahoSystem.getObjectFactory() ); - microPlatform.define( IPluginManager.class, DefaultPluginManager.class, Scope.GLOBAL ); - microPlatform.define( IServiceManager.class, DefaultServiceManager.class, Scope.GLOBAL ); - microPlatform.define( IPluginProvider.class, TstPluginProvider.class ); - microPlatform.define( IThemeManager.class, DefaultThemeManager.class ); - - IServiceTypeManager axisManager = new AxisWebServiceManager(); - DefaultServiceManager sm = (DefaultServiceManager) PentahoSystem.get( IServiceManager.class ); - sm.setServiceTypeManagers( Arrays.asList( axisManager ) ); - - microPlatform.init(); - - new StandaloneSession(); - - PentahoSystem.get( IPluginManager.class ).reload( PentahoSessionHolder.getSession() ); - } - - /* - * The following tests are checking that the HtmlServiceLister (content generator) outputs the correct meta - * information about the services defined in the test plugin. They are integration tests in the sense that all the - * work of registering the plugin that defines the services and content generators is done by actual platform modules - * as it would normally happen, and is not mocked for these tests. - */ - - @Test - public void testExecuteUrlListed() throws Exception { - - IContentGenerator serviceLister = new StyledHtmlAxisServiceLister(); - - String html = ContentGeneratorUtil.getContentAsString( serviceLister ); - System.out.println( html ); - - assertTrue( "Run URL is missing", html.contains( "/content/ws-run/echoService" ) ); - } - - @Test - public void testWsdlUrlListed() throws Exception { - IContentGenerator serviceLister = new StyledHtmlAxisServiceLister(); - - String html = ContentGeneratorUtil.getContentAsString( serviceLister ); - System.out.println( html ); - - assertTrue( "WSDL URL is missing", html.contains( "/content/ws-wsdl/echoService" ) ); - } - - @Test - public void testListingPageStyled() throws Exception { - MockServletContext context = new MockServletContext(); - context.addResourcePaths( "/", Arrays.asList( "test-module/" ) ); - context.addResourcePaths( "/test-module/", Arrays.asList( "themes.xml" ) ); - context.addResourcePaths( "/test-module/themes/onyx/", Arrays.asList( "styles.css" ) ); - File themesDotXML = new File( microPlatform.getFilePath() + "system/axis/themes.xml" ); - context.setResource( "/test-module/themes.xml", themesDotXML.toURI().toURL() ); - context.setResourceAsStream( "/test-module/themes.xml", new FileInputStream( themesDotXML ) ); - File styleDotSCC = new File( microPlatform.getFilePath() + "system/axis/themes/onyx/styles.css" ); - context.setResource( "/test-module/themes/onyx/styles.css", styleDotSCC.toURI().toURL() ); - context.setResourceAsStream( "/test-module/themes/onyx/styles.css", new FileInputStream( styleDotSCC ) ); - PentahoSystem.getApplicationContext().setContext( context ); - - IContentGenerator serviceLister = new StyledHtmlAxisServiceLister(); - - String html = ContentGeneratorUtil.getContentAsString( serviceLister ); - System.out.println( html ); - - assertTrue( "style is missing", html.contains( "styles.css" ) ); - } - - @Test - public void testMetaInf() throws Exception { - IContentGenerator serviceLister = new StyledHtmlAxisServiceLister(); - - String html = ContentGeneratorUtil.getContentAsString( serviceLister ); - System.out.println( html ); - - assertTrue( "title is not displayed", html.contains( "junit echo service" ) ); - } - - public static class TstPluginProvider implements IPluginProvider { - public List getPlugins( IPentahoSession session ) throws PlatformPluginRegistrationException { - PlatformPlugin p = new PlatformPlugin(); - p.setId( "testPlugin" ); - p.setSourceDescription( "" ); - - ContentGeneratorInfo cg1 = new ContentGeneratorInfo(); - cg1.setDescription( "Mock web service execution generator" ); - cg1.setId( "ws-run" ); - cg1.setType( "ws-run" ); // type is used as the key to verify that there is a cg that can handle a ws request - cg1.setTitle( "Mock web service execution generator" ); - cg1.setClassname( "org.pentaho.test.platform.plugin.pluginmgr.ContentGenerator1" ); - p.addContentGenerator( cg1 ); - - ContentGeneratorInfo cg2 = new ContentGeneratorInfo(); - cg2.setDescription( "Mock WSDL generator" ); - cg2.setId( "ws-wsdl" ); - cg2.setType( "ws-wsdl" ); // type is used as the key to verify that there is a cg that can handle a wsdl request - cg2.setTitle( "Mock WSDL generator" ); - cg2.setClassname( "org.pentaho.test.platform.plugin.pluginmgr.ContentGenerator1" ); - p.addContentGenerator( cg2 ); - - PluginServiceDefinition ws = new PluginServiceDefinition(); - ws.setId( "echoService" ); - ws.setServiceClass( EchoServiceBean.class.getName() ); - ws.setTypes( new String[] { "xml" } ); - ws.setTitle( "junit echo service" ); - p.addWebservice( ws ); - - return Arrays.asList( (IPlatformPlugin) p ); - } - } -} diff --git a/extensions/src/main/java/org/pentaho/platform/plugin/services/pluginmgr/servicemgr/AxisWebServiceManager.java b/extensions/src/main/java/org/pentaho/platform/plugin/services/pluginmgr/servicemgr/AxisWebServiceManager.java index e7dcaa5bbcf..e69de29bb2d 100644 --- a/extensions/src/main/java/org/pentaho/platform/plugin/services/pluginmgr/servicemgr/AxisWebServiceManager.java +++ b/extensions/src/main/java/org/pentaho/platform/plugin/services/pluginmgr/servicemgr/AxisWebServiceManager.java @@ -1,99 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.platform.plugin.services.pluginmgr.servicemgr; - -import org.apache.axis2.AxisFault; -import org.apache.axis2.Constants; -import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.context.ConfigurationContextFactory; -import org.apache.axis2.engine.AxisConfiguration; -import org.apache.axis2.engine.AxisConfigurator; -import org.pentaho.platform.api.engine.IServiceConfig; -import org.pentaho.platform.api.engine.ServiceInitializationException; -import org.pentaho.platform.engine.core.system.PentahoSessionHolder; -import org.pentaho.platform.plugin.services.webservices.AbstractAxisConfigurator; -import org.pentaho.platform.plugin.services.webservices.SystemSolutionAxisConfigurator; - -public class AxisWebServiceManager extends AbstractServiceTypeManager { - - public static ConfigurationContext currentAxisConfigContext; - - public static AxisConfiguration currentAxisConfiguration; - - /** - * This method will throw an {@link UnsupportedOperationException} if called. - * @param executeServiceId - */ - @Deprecated - public void setExecuteServiceId( String executeServiceId ) { - throw new UnsupportedOperationException(); - } - - /** - * This method will throw an {@link UnsupportedOperationException} if called. - * @param wsdlServiceId - */ - @Deprecated - public void setWsdlServiceId( String wsdlServiceId ) { - throw new UnsupportedOperationException(); - } - - private SystemSolutionAxisConfigurator configurator = new SystemSolutionAxisConfigurator(); - - protected AbstractAxisConfigurator getConfigurator() { - return configurator; - } - - /* - * (non-Javadoc) - * - * @see - * org.pentaho.platform.plugin.services.pluginmgr.IServiceManager#defineService(org.pentaho.platform.plugin.services - * .pluginmgr.WebServiceDefinition) - */ - @Override - public void registerService( final IServiceConfig wsConfig ) { - super.registerService( wsConfig ); - getConfigurator().addService( wsConfig ); - } - - /* - * (non-Javadoc) - * - * @see org.pentaho.platform.plugin.services.pluginmgr.IServiceManager#initServices() - */ - public void initServices() throws ServiceInitializationException { - getConfigurator().setSession( PentahoSessionHolder.getSession() ); - AxisConfigurator axisConfigurator = getConfigurator(); - - // create the axis configuration and make it accessible to content generators via static member - ConfigurationContext configContext = null; - try { - configContext = ConfigurationContextFactory.createConfigurationContext( axisConfigurator ); - } catch ( AxisFault e ) { - throw new ServiceInitializationException( e ); - } - configContext.setProperty( Constants.CONTAINER_MANAGED, Constants.VALUE_TRUE ); - - currentAxisConfigContext = configContext; - currentAxisConfiguration = configContext.getAxisConfiguration(); - - // now load the services - axisConfigurator.loadServices(); - } - - public String getSupportedServiceType() { - return "xml"; //$NON-NLS-1$ - } -} diff --git a/extensions/src/main/java/org/pentaho/platform/plugin/services/pluginmgr/servicemgr/FileSystemAxisWebServiceManager.java b/extensions/src/main/java/org/pentaho/platform/plugin/services/pluginmgr/servicemgr/FileSystemAxisWebServiceManager.java index 147cef8b095..e69de29bb2d 100644 --- a/extensions/src/main/java/org/pentaho/platform/plugin/services/pluginmgr/servicemgr/FileSystemAxisWebServiceManager.java +++ b/extensions/src/main/java/org/pentaho/platform/plugin/services/pluginmgr/servicemgr/FileSystemAxisWebServiceManager.java @@ -1,34 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.platform.plugin.services.pluginmgr.servicemgr; - -import org.pentaho.platform.plugin.services.webservices.AbstractAxisConfigurator; -import org.pentaho.platform.plugin.services.webservices.FileSystemAxisConfigurator; - -/** - * A web service manager that only uses the file system for configuration - * - * @author jamesdixon - * - */ -public class FileSystemAxisWebServiceManager extends AxisWebServiceManager { - - private FileSystemAxisConfigurator configurator = new FileSystemAxisConfigurator(); - - @Override - protected AbstractAxisConfigurator getConfigurator() { - return configurator; - } - -} diff --git a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/AbstractAxisConfigurator.java b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/AbstractAxisConfigurator.java index 1c6e75ed6a7..e69de29bb2d 100644 --- a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/AbstractAxisConfigurator.java +++ b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/AbstractAxisConfigurator.java @@ -1,227 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.platform.plugin.services.webservices; - -import org.apache.axis2.AxisFault; -import org.apache.axis2.deployment.AxisConfigBuilder; -import org.apache.axis2.description.AxisService; -import org.apache.axis2.description.Parameter; -import org.apache.axis2.engine.AxisConfiguration; -import org.apache.axis2.engine.AxisConfigurator; -import org.apache.commons.logging.Log; -import org.pentaho.platform.api.engine.IPentahoSession; -import org.pentaho.platform.api.engine.IServiceConfig; -import org.pentaho.platform.engine.core.system.PentahoBase; -import org.pentaho.platform.plugin.services.messages.Messages; -import org.pentaho.platform.util.logging.Logger; - -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public abstract class AbstractAxisConfigurator extends PentahoBase implements AxisConfigurator { - - private static final long serialVersionUID = 1931282897052453845L; - - protected AxisConfiguration axisConfig = null; - - protected IPentahoSession session; // Session to use during initialization - - protected boolean loaded = false; - - // map of the web service wrappers - private Map services = new HashMap(); - - public abstract Log getLogger(); - - public abstract void addService( IServiceConfig ws ); - - public AbstractAxisConfigurator() { - init(); - } - - public void reloadServices() throws AxisFault { - unloadServices(); - loadServices(); - } - - public void unloadServices() throws AxisFault { - Set keys = services.keySet(); - List removed = new ArrayList(); - // iterate through the list of web service wrappers - for ( String key : keys ) { - IServiceConfig wrapper = services.get( key ); - - // use the service name to remove them from the Axis system - String serviceName = wrapper.getServiceClass().getSimpleName(); - axisConfig.removeService( serviceName ); - // build a list of the ones removed - removed.add( serviceName ); - } - // now remove the wrappers from the services list - for ( String serviceName : removed ) { - services.remove( serviceName ); - } - loaded = false; - } - - public IServiceConfig getWebServiceDefinition( String name ) { - return services.get( name ); - } - - /** - * Creates the AxisConfiguration object using an XML document. Subclasses of this class must provide the XML via an - * input stream. The concrete implementation can store the XML file wherever it wants as we only need an InputStream - */ - public AxisConfiguration getAxisConfiguration() throws AxisFault { - if ( axisConfig != null ) { - // we have already initialized - return axisConfig; - } - try { - - // create a new AxisConfiguration - axisConfig = new AxisConfiguration(); - - // get the config XML input stream - InputStream in = getConfigXml(); - // build the configuration - AxisConfigBuilder builder = new AxisConfigBuilder( in, axisConfig, null ); - builder.populateConfig(); - } catch ( Exception e ) { - e.printStackTrace(); - throw AxisFault.makeFault( e ); - } - // set this object as the Axis configurator. Axis will call loadServices(). - axisConfig.setConfigurator( this ); - return axisConfig; - } - - /* - * These are the abstract methods - */ - public abstract InputStream getConfigXml(); - - public abstract boolean setEnabled( String name, boolean enabled ) throws AxisFault; - - public abstract void init(); - - /** - * Adds any implementation-specific web service endpoints for a Axis service - * - * @param axisService - * The Axis web service to add end points to - */ - protected abstract void addServiceEndPoints( AxisService axisService ); - - /** - * Adds any implementation-specific transports for a Axis service - * - * @param axisService - * The Axis web service to add end points to - */ - protected abstract void addTransports( AxisService axisService ); - - /** - * Returns a list of the web service wrappers for this implmentation - * - * @return - */ - protected abstract List getWebServiceDefinitions(); - - /** - * Load the web services from the list of web service wrappers - */ - public void loadServices() { - - // JD - only setup the Axis services once - if ( loaded ) { - // we have done this already - return; - } - - List wsDfns = getWebServiceDefinitions(); - - for ( IServiceConfig wsDef : wsDfns ) { - try { - loadService( wsDef ); - } catch ( Exception e ) { - // Axis cannot handle a typed exception from this method, we must just log the error and continue on - Logger.error( getClass().getName(), Messages.getInstance().getErrorString( - "AbstractAxisConfigurator.ERROR_0001_COULD_NOT_LOAD_SERVICE", wsDef.getId() ), e ); //$NON-NLS-1$ - } - } - loaded = true; - - } - - /** - * Loads a web service from a web service wrapper - * - * @param wrapper - * Web service wrapper - * @throws Exception - */ - protected void loadService( IServiceConfig wsDef ) throws Exception { - - // first create the service - String serviceId = wsDef.getId(); - AxisService axisService = AxisUtil.createService( wsDef, getAxisConfiguration() ); - - // add any additional transports - addTransports( axisService ); - - // add any end points - addServiceEndPoints( axisService ); - - // JD - don't create the WSDL yet, do it on demand. Just store the wsDef for now - Parameter wsDefParam = new Parameter(); - wsDefParam.setName( "wsDefParam" ); //$NON-NLS-1$ - wsDefParam.setValue( wsDef ); //$NON-NLS-1$ - axisService.addParameter( wsDefParam ); - - // add the wrapper to the service list - services.put( serviceId, wsDef ); - - // start the service - axisConfig.addService( axisService ); - axisConfig.startService( axisService.getName() ); - - // enable or disable the service as the wrapper dictates - axisService.setActive( wsDef.isEnabled() ); - - } - - /** - * An AxisConfigurator method that we don't need - */ - public void engageGlobalModules() throws AxisFault { - - } - - /** - * An AxisConfigurator method that we don't need - */ - public void cleanup() { - - } - - public void setSession( IPentahoSession session ) { - this.session = session; - } - -} diff --git a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/AxisServletHooks.java b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/AxisServletHooks.java index 5848fe5ee08..e69de29bb2d 100644 --- a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/AxisServletHooks.java +++ b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/AxisServletHooks.java @@ -1,216 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.platform.plugin.services.webservices; - -import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.context.MessageContext; -import org.apache.axis2.context.OperationContext; -import org.apache.axis2.context.ServiceContext; -import org.apache.axis2.description.AxisOperation; -import org.apache.axis2.description.AxisService; -import org.apache.axis2.engine.AxisConfiguration; -import org.apache.axis2.transport.http.AxisServlet; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** - * This class subclasses AxisServlet to expose protected methods and variables - * - * @author jamesdixon - * - */ - -public class AxisServletHooks extends AxisServlet { - - private static final long serialVersionUID = 3169157817280586159L; - - protected AxisService axisService; - - protected AxisOperation axisOperation; - - protected OperationContext operationContext; - - protected ServiceContext serviceContext; - - protected MessageContext messageContext; - - /** - * Returns the current Axis MessageContext object. - * - * @return message context - */ - public MessageContext getMessageContext() { - return messageContext; - } - - /** - * Sets the Axis configuration context object - * - * @param configContext - */ - public void setContext( ConfigurationContext configContext ) { - this.configContext = configContext; - } - - /** - * Sets the Axis configuration object - * - * @param axisConfiguration - */ - public void setConfiguration( AxisConfiguration axisConfiguration ) { - this.axisConfiguration = axisConfiguration; - } - - /** - * Sets the Axis service context for this request - * - * @param serviceContext - */ - public void setServiceContext( ServiceContext serviceContext ) { - this.serviceContext = serviceContext; - } - - /** - * Sets the servlet config object. This is mainly used for standalone and testing purposes - * - * @param servletConfig - * @throws ServletException - */ - public void setServletConfig( ServletConfig servletConfig ) throws ServletException { - if ( servletConfig != null ) { - init( servletConfig ); - } - } - - /** - * Creates an Axis message context object for this request. If the AxisOperation is null (this will be the case during - * a POST operation) the operation is determined by examining the contentType - */ - @Override - public MessageContext createMessageContext( HttpServletRequest request, HttpServletResponse response, - boolean invocationType ) throws IOException { - messageContext = super.createMessageContext( request, response, invocationType ); - - if ( axisOperation == null ) { - // we don't know the operation yet so pull it from the requests's contentType - String contentType = request.getContentType(); - // parse it looking for action="operation" - int idx = contentType.indexOf( "action=" ); //$NON-NLS-1$ - if ( idx != -1 ) { - char delim = contentType.charAt( idx + 7 ); - int idx2 = contentType.indexOf( delim, idx + 8 ); - if ( idx2 != -1 ) { - String actionStr = contentType.substring( idx + 8, idx2 ); - String operationName = actionStr.substring( 4 ); - axisOperation = axisService.getOperationByAction( operationName ); - } - } - operationContext = serviceContext.createOperationContext( axisOperation ); - } - // setup the objects the message context needs to execute - messageContext.setAxisService( axisService ); - messageContext.setOperationContext( operationContext ); - messageContext.setAxisOperation( axisOperation ); - - return messageContext; - } - - /** - * Handle and HTTP PUT request - * - * @param httpMethodString - * "PUT" - * @param request - * HTTP request - * @param response - * HTTP response - * @throws ServletException - * @throws IOException - */ - public void handlePut( String httpMethodString, HttpServletRequest request, HttpServletResponse response ) - throws ServletException, IOException { - - new RestRequestProcessor( httpMethodString, request, response ).processXMLRequest(); - } - - /** - * Handle and HTTP GET request - * - * @param httpMethodString - * "GET" - * @param request - * HTTP request - * @param response - * HTTP response - * @throws ServletException - * @throws IOException - */ - public void handleGet( String httpMethodString, HttpServletRequest request, HttpServletResponse response ) - throws ServletException, IOException { - - RestRequestProcessor processor = new RestRequestProcessor( httpMethodString, request, response ); - processor.processURLRequest(); - } - - /** - * Handle and HTTP POST request - * - * @param httpMethodString - * "POST" - * @param request - * HTTP request - * @param response - * HTTP response - * @throws ServletException - * @throws IOException - */ - public void handlePost( String httpMethodString, HttpServletRequest request, HttpServletResponse response ) - throws ServletException, IOException { - - super.doPost( request, response ); - - } - - /** - * Sets the Axis service object for this request - * - * @param axisService - */ - public void setAxisService( AxisService axisService ) { - this.axisService = axisService; - } - - /** - * Sets the Axis opertation for the current request - * - * @param axisOperation - */ - public void setAxisOperation( AxisOperation axisOperation ) { - this.axisOperation = axisOperation; - } - - /** - * Sets the Axis operation context for the current request - * - * @param operationContext - */ - public void setOperationContext( OperationContext operationContext ) { - this.operationContext = operationContext; - } - -} diff --git a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/AxisUtil.java b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/AxisUtil.java index 532e5b4a990..e69de29bb2d 100644 --- a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/AxisUtil.java +++ b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/AxisUtil.java @@ -1,180 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.platform.plugin.services.webservices; - -import com.ibm.wsdl.factory.WSDLFactoryImpl; -import org.apache.axis2.AxisFault; -import org.apache.axis2.description.AxisService; -import org.apache.axis2.description.Parameter; -import org.apache.axis2.description.WSDL2Constants; -import org.apache.axis2.engine.AxisConfiguration; -import org.apache.axis2.engine.MessageReceiver; -import org.apache.axis2.util.Loader; -import org.apache.axis2.wsdl.WSDLConstants; -import org.apache.ws.java2wsdl.Java2WSDLBuilder; -import org.pentaho.platform.api.engine.IServiceConfig; -import org.pentaho.platform.engine.core.system.PentahoSystem; -import org.xml.sax.InputSource; - -import javax.wsdl.Definition; -import javax.wsdl.xml.WSDLReader; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; - -public class AxisUtil { - - public static final String WS_EXECUTE_SERVICE_ID = "ws-run"; //$NON-NLS-1$ - - public static final String WSDL_SERVICE_ID = "ws-wsdl"; //$NON-NLS-1$ - - public static Definition getWsdlDefinition( AxisConfiguration axisConfig, IServiceConfig webservice ) - throws Exception { - - String wsdlStr = getWsdl( axisConfig, webservice ); - InputStream in = new ByteArrayInputStream( wsdlStr.getBytes() ); - InputSource source = new InputSource( in ); - - WSDLFactoryImpl factory = new WSDLFactoryImpl(); - WSDLReader reader = factory.newWSDLReader(); - Definition def = reader.readWSDL( "", source ); //$NON-NLS-1$ - return def; - } - - public static String getWsdl( AxisConfiguration axisConfig, IServiceConfig webservice ) throws Exception { - Class serviceClass = webservice.getServiceClass(); - String name = serviceClass.getSimpleName(); - ByteArrayOutputStream out = new ByteArrayOutputStream(); - - Java2WSDLBuilder java2WsdlBuilder = - new Java2WSDLBuilder( out, serviceClass.getName(), serviceClass.getClassLoader() ); - - // convert the extra classes into a list of class names - Collection> extraClasses = webservice.getExtraClasses(); - if ( extraClasses != null ) { - ArrayList extraClassNames = new ArrayList(); - for ( Class extraClass : extraClasses ) { - extraClassNames.add( extraClass.getName() ); - } - java2WsdlBuilder.setExtraClasses( extraClassNames ); - } - java2WsdlBuilder.setSchemaTargetNamespace( "http://webservice.pentaho.com" ); //$NON-NLS-1$ - - java2WsdlBuilder.setLocationUri( getWebServiceExecuteUrl() + name ); - java2WsdlBuilder.setTargetNamespacePrefix( "pho" ); //$NON-NLS-1$ - java2WsdlBuilder.setServiceName( name ); - java2WsdlBuilder.setAttrFormDefault( "unqualified" ); //$NON-NLS-1$ - java2WsdlBuilder.setElementFormDefault( "unqualified" ); //$NON-NLS-1$ - java2WsdlBuilder.setGenerateDocLitBare( false ); - java2WsdlBuilder.generateWSDL(); - - return new String( out.toByteArray() ); - } - - /** - * Create a web service from a web service wrapper. The concrete subclass providers the wrappers via - * getWebServiceWrappers() - * - * @param wrapper - * The wrapper - * @return - * @throws AxisFault - */ - public static AxisService createService( IServiceConfig ws, AxisConfiguration axisConfig ) throws AxisFault { - Class serviceClass = ws.getServiceClass(); - String serviceName = ws.getId(); - - if ( axisConfig.getService( serviceName ) != null ) { - axisConfig.removeService( serviceName ); - } - - AxisService axisService = createService( serviceClass.getName(), axisConfig, serviceClass.getClassLoader() ); - - axisService.setName( serviceName ); - axisService.setDocumentation( ws.getDescription() ); - - return axisService; - } - - @SuppressWarnings( "unchecked" ) - private static AxisService createService( String implClass, AxisConfiguration axisConfig, ClassLoader loader ) - throws AxisFault { - - try { - HashMap messageReciverMap = new HashMap(); - Class inOnlyMessageReceiver = Loader.loadClass( "org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" ); //$NON-NLS-1$ - MessageReceiver messageReceiver = (MessageReceiver) inOnlyMessageReceiver.newInstance(); - messageReciverMap.put( WSDL2Constants.MEP_URI_IN_ONLY, messageReceiver ); - Class inoutMessageReceiver = Loader.loadClass( "org.apache.axis2.rpc.receivers.RPCMessageReceiver" ); //$NON-NLS-1$ - MessageReceiver inOutmessageReceiver = (MessageReceiver) inoutMessageReceiver.newInstance(); - messageReciverMap.put( WSDL2Constants.MEP_URI_IN_OUT, inOutmessageReceiver ); - messageReciverMap.put( WSDL2Constants.MEP_URI_ROBUST_IN_ONLY, inOutmessageReceiver ); - - return AxisService.createService( implClass, axisConfig, messageReciverMap, null, null, loader ); - } catch ( Exception e ) { - throw AxisFault.makeFault( e ); - } - } - - /** - * Creates the WSDL for an Axis service - * - * @param axisService - * @param wrapper - * @throws Exception - */ - public static void createServiceWsdl( AxisService axisService, IServiceConfig wsDef, AxisConfiguration axisConfig ) - throws Exception { - // specific that we are generating the WSDL - Parameter useOriginalwsdl = new Parameter(); - useOriginalwsdl.setName( "useOriginalwsdl" ); //$NON-NLS-1$ - useOriginalwsdl.setValue( "true" ); //$NON-NLS-1$ - axisService.addParameter( useOriginalwsdl ); - - // get the WSDL generation and make it a parameter - Definition wsdlDefn = AxisUtil.getWsdlDefinition( axisConfig, wsDef ); - Parameter wsdl = new Parameter(); - wsdl.setName( WSDLConstants.WSDL_4_J_DEFINITION ); - wsdl.setValue( wsdlDefn ); - - // add the WSDL parameter to the service - axisService.addParameter( wsdl ); - } - - public static IServiceConfig getSourceDefinition( AxisService axisService, - SystemSolutionAxisConfigurator axisConfigurator ) { - return axisConfigurator.getWebServiceDefinition( axisService.getName() ); - } - - /** - * Currently webservice content generators are wired up by a plugin. The following methods generate urls for executing - * web service and wsdl generation. These methods are tightly bound to the content generator specifications in the - * default-plugin of the system solution. - */ - public static String getWebServiceExecuteUrl() { - String url = - PentahoSystem.getApplicationContext().getFullyQualifiedServerURL() + "content/" + WS_EXECUTE_SERVICE_ID + "/"; //$NON-NLS-1$ //$NON-NLS-2$ - return url; - } - - public static String getWebServiceWsdlUrl() { - String url = - PentahoSystem.getApplicationContext().getFullyQualifiedServerURL() + "content/" + WSDL_SERVICE_ID + "/"; //$NON-NLS-1$ //$NON-NLS-2$ - return url; - } - -} diff --git a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/FileSystemAxisConfigurator.java b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/FileSystemAxisConfigurator.java index 0f9859be704..e69de29bb2d 100644 --- a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/FileSystemAxisConfigurator.java +++ b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/FileSystemAxisConfigurator.java @@ -1,48 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.platform.plugin.services.webservices; - -import org.pentaho.platform.engine.core.system.PentahoSystem; -import org.pentaho.platform.plugin.services.messages.Messages; - -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; - -/** - * An Axis Configurator that uses PentahoSystem to get the axis configuration file - * - * @author jamesdixon - */ -public class FileSystemAxisConfigurator extends SystemSolutionAxisConfigurator { - - private static final long serialVersionUID = 3018138384199613741L; - - @Override - public InputStream getConfigXml() { - - try { - - File f = new File( PentahoSystem.getApplicationContext().getSolutionPath( getAxisConfigPath() ) ); - InputStream in = new FileInputStream( f ); - - return in; - } catch ( Exception e ) { - getLogger().error( - Messages.getInstance().getErrorString( - "SystemSolutionAxisConfigurator.ERROR_0001_BAD_CONFIG_FILE", getAxisConfigPath() ), e ); //$NON-NLS-1$ - } - return null; - } -} diff --git a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/SystemSolutionAxisConfigurator.java b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/SystemSolutionAxisConfigurator.java index cacc59a0ef8..e69de29bb2d 100644 --- a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/SystemSolutionAxisConfigurator.java +++ b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/SystemSolutionAxisConfigurator.java @@ -1,108 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.platform.plugin.services.webservices; - -import org.apache.axis2.AxisFault; -import org.apache.axis2.description.AxisService; -import org.apache.commons.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.pentaho.platform.api.engine.IPentahoRequestContext; -import org.pentaho.platform.api.engine.IServiceConfig; -import org.pentaho.platform.engine.core.system.PentahoRequestContextHolder; -import org.pentaho.platform.engine.services.actionsequence.ActionSequenceResource; -import org.pentaho.platform.plugin.services.messages.Messages; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - -/** - * This class provides axis with its configuration information from the file axis/axis2_config.xml in the pentaho - * system solutions folder. In particular, it: 1) Provides an input stream for the axis configuration XML which is - * located in the root of the plugin folder (getConfigXml) 2) Defines the web services that are available - * (getWebServiceDefinitions) 3) Provides persistence for enabled/disabled status of each web service - * - * @author jamesdixon - * - */ -public class SystemSolutionAxisConfigurator extends AbstractAxisConfigurator { - - private static final long serialVersionUID = -4219285702722007821L; - - private static final Log logger = LogFactory.getLog( SystemSolutionAxisConfigurator.class ); - - protected List wsDfns = new ArrayList(); - - public SystemSolutionAxisConfigurator() { - super(); - } - - @Override - public Log getLogger() { - return logger; - } - - @Override - public void init() { - } - - public static String getAxisConfigPath() { - return "system/axis/axis2_config.xml"; //$NON-NLS-1$ - } - - @Override - public InputStream getConfigXml() { - - try { - byte[] configBytes = IOUtils.toByteArray( ActionSequenceResource.getInputStream( getAxisConfigPath(), null ) ); - // FIXME: specify an encoding when getting bytes - ByteArrayInputStream in = new ByteArrayInputStream( configBytes ); - return in; - } catch ( Exception e ) { - logger.error( Messages.getInstance().getErrorString( - "SystemSolutionAxisConfigurator.ERROR_0001_BAD_CONFIG_FILE", getAxisConfigPath() ), e ); //$NON-NLS-1$ - } - return null; - } - - @Override - public boolean setEnabled( String name, boolean enabled ) throws AxisFault { - return true; - } - - public void addService( IServiceConfig ws ) { - wsDfns.add( ws ); - } - - @Override - protected List getWebServiceDefinitions() { - - return wsDfns; - } - - @Override - protected void addTransports( AxisService axisService ) { - // the defaults include http so we are good to go - } - - @Override - protected void addServiceEndPoints( AxisService axisService ) { - IPentahoRequestContext requestContext = PentahoRequestContextHolder.getRequestContext(); - String endPoint1 = requestContext.getContextPath() + "content/ws-run/" + axisService.getName(); //$NON-NLS-1$ - axisService.setEPRs( new String[] { endPoint1 } ); - } - -} diff --git a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/AbstractAxisServiceContentGenerator.java b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/AbstractAxisServiceContentGenerator.java index 0f7088d556f..e69de29bb2d 100644 --- a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/AbstractAxisServiceContentGenerator.java +++ b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/AbstractAxisServiceContentGenerator.java @@ -1,189 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.platform.plugin.services.webservices.content; - -import org.apache.axiom.om.OMElement; -import org.apache.axiom.soap.SOAP12Constants; -import org.apache.axiom.soap.SOAPFaultCode; -import org.apache.axis2.Constants; -import org.apache.axis2.addressing.AddressingHelper; -import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.context.MessageContext; -import org.apache.axis2.description.AxisBindingMessage; -import org.apache.axis2.description.AxisBindingOperation; -import org.apache.axis2.description.WSDL2Constants; -import org.apache.axis2.engine.AxisConfiguration; -import org.apache.axis2.engine.AxisEngine; -import org.apache.axis2.transport.http.HTTPConstants; -import org.apache.axis2.util.MessageContextBuilder; -import org.pentaho.platform.api.engine.IParameterProvider; -import org.pentaho.platform.engine.services.solution.SimpleContentGenerator; -import org.pentaho.platform.plugin.services.pluginmgr.servicemgr.AxisWebServiceManager; -import org.pentaho.platform.plugin.services.webservices.messages.Messages; - -import javax.servlet.http.HttpServletResponse; -import javax.xml.namespace.QName; -import java.io.IOException; -import java.io.OutputStream; - -/** - * The base class for serving GenericServlet, i.e. /content/ requests through to an Axis webservice. This class ensures - * that the webservices system is properly configured before handing over to a subclass for processing of the request. - * - * @author jamesdixon - */ -@SuppressWarnings( "serial" ) -public abstract class AbstractAxisServiceContentGenerator extends SimpleContentGenerator { - - @Override - public void createContent( OutputStream out ) throws Exception { - - try { - // NOTE: commented out classloader override since Axis webservices are created in the platform - // now and not in a plugin. - // Thread.currentThread().setContextClassLoader( getClass().getClassLoader() ); - // try to get the AxisConfig object - AxisConfiguration axisConfiguration = AxisWebServiceManager.currentAxisConfiguration; - if ( axisConfiguration == null ) { - // return an error - String message = - Messages.getInstance().getErrorString( "WebServiceContentGenerator.ERROR_0001_AXIS_CONFIG_IS_NULL" ); //$NON-NLS-1$ - getLogger().error( message ); - out.write( message.getBytes() ); - return; - } - - // hand over to a subclass to process this request - createContent( axisConfiguration, AxisWebServiceManager.currentAxisConfigContext, out ); - } catch ( Exception e ) { - //ignore - } - - } - - /** - * Creates content for this request. Subclasses of this class implement this method to handle the processing of a web - * services request. - * - * @param axisConfiguration - * AxisConfiguration - * @param context - * ConfigurationContext - * @param out - * The output stream to write to - * @throws Exception - */ - public abstract void createContent( AxisConfiguration axisConfiguration, ConfigurationContext context, - OutputStream out ) throws Exception; - - /** - * Handles processing of Axis exceptions. - * - * @param msgContext - * The message context that experienced an error - * @param out - * The output stream to write to - * @param e - * The error that occurred - */ - protected void processAxisFault( MessageContext msgContext, OutputStream out, Throwable e ) { - - IParameterProvider pathParams = parameterProviders.get( "path" ); //$NON-NLS-1$ - // is this HTTP? - boolean http = msgContext.getProperty( HTTPConstants.MC_HTTP_SERVLETRESPONSE ) != null; - if ( http ) { - HttpServletResponse res = (HttpServletResponse) pathParams.getParameter( "httpresponse" ); //$NON-NLS-1$ - // If the fault is not going along the back channel we should be 202ing - if ( AddressingHelper.isFaultRedirected( msgContext ) ) { - res.setStatus( HttpServletResponse.SC_ACCEPTED ); - } else { - // set the status of the HTTP response - String status = (String) msgContext.getProperty( Constants.HTTP_RESPONSE_STATE ); - try { - if ( status == null ) { - res.sendError( HttpServletResponse.SC_INTERNAL_SERVER_ERROR ); - } else { - int sc = Integer.parseInt( status ); - if ( sc >= 400 ) { - res.sendError( sc ); - } else { - res.setStatus( sc ); - } - } - } catch ( IOException e1 ) { - if ( status == null ) { - res.setStatus( HttpServletResponse.SC_INTERNAL_SERVER_ERROR ); - } else { - int sc = Integer.parseInt( status ); - res.setStatus( sc ); - } - } - - AxisBindingOperation axisBindingOperation = - (AxisBindingOperation) msgContext.getProperty( Constants.AXIS_BINDING_OPERATION ); - if ( axisBindingOperation != null ) { - AxisBindingMessage fault = - axisBindingOperation.getFault( (String) msgContext.getProperty( Constants.FAULT_NAME ) ); - if ( fault != null ) { - Integer code = (Integer) fault.getProperty( WSDL2Constants.ATTR_WHTTP_CODE ); - if ( code != null ) { - res.setStatus( code.intValue() ); - } - } - } - } - } - - try { - // now process the fault - handleFault( msgContext, out, http, e ); - } catch ( IOException axisFault ) { - String message = Messages.getInstance().getErrorString( "WebServiceContentGenerator.ERROR_0003_PROCESSING_FAULT" ); //$NON-NLS-1$ - getLogger().error( message, axisFault ); - } - } - - protected void handleFault( MessageContext msgContext, OutputStream out, - boolean http, Throwable e ) throws IOException { - - msgContext.setProperty( MessageContext.TRANSPORT_OUT, out ); - - MessageContext faultContext = MessageContextBuilder.createFaultMessageContext( msgContext, e ); - // SOAP 1.2 specification mentions that we should send HTTP code 400 in a fault if the - // fault code Sender - HttpServletResponse response = - http ? (HttpServletResponse) msgContext.getProperty( HTTPConstants.MC_HTTP_SERVLETRESPONSE ) : null; - if ( response != null ) { - - // TODO : Check for SOAP 1.2! - SOAPFaultCode code = faultContext.getEnvelope().getBody().getFault().getCode(); - - OMElement valueElement = null; - if ( code != null ) { - valueElement = - code.getFirstChildWithName( new QName( SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI, - SOAP12Constants.SOAP_FAULT_VALUE_LOCAL_NAME ) ); - } - - if ( valueElement != null ) { - if ( SOAP12Constants.FAULT_CODE_SENDER.equals( valueElement.getTextAsQName().getLocalPart() ) - && !msgContext.isDoingREST() ) { - response.sendError( HttpServletResponse.SC_BAD_REQUEST ); - } - } - } - AxisEngine.sendFault( faultContext ); - } - -} diff --git a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/AxisServiceExecutor.java b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/AxisServiceExecutor.java index 920bcd8be4c..e69de29bb2d 100644 --- a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/AxisServiceExecutor.java +++ b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/AxisServiceExecutor.java @@ -1,130 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.platform.plugin.services.webservices.content; - -import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.context.OperationContext; -import org.apache.axis2.context.ServiceContext; -import org.apache.axis2.context.ServiceGroupContext; -import org.apache.axis2.description.AxisOperation; -import org.apache.axis2.description.AxisService; -import org.apache.axis2.description.AxisServiceGroup; -import org.apache.axis2.engine.AxisConfiguration; -import org.apache.axis2.transport.OutTransportInfo; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.pentaho.platform.api.engine.IParameterProvider; -import org.pentaho.platform.api.repository.IContentItem; -import org.pentaho.platform.engine.core.system.PentahoSessionHolder; -import org.pentaho.platform.plugin.services.webservices.AxisServletHooks; -import org.pentaho.platform.plugin.services.webservices.AxisUtil; -import org.pentaho.platform.plugin.services.webservices.messages.Messages; - -import javax.servlet.ServletConfig; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.OutputStream; -import java.util.Enumeration; - -/** - * Executes an operation of a web service. This class requires that a HttpServletRequest, HttpServletResponse, and - * ServletConfig object are provided. Mock objects can be used instead of real HTTP objects. - * - * @author jamesdixon - * - */ -public class AxisServiceExecutor extends AxisWebServiceRequestDispatcher implements OutTransportInfo { - - private static final long serialVersionUID = -8815968682881342687L; - - @Override - public void createServiceContent( AxisService axisService, String operationName, AxisConfiguration axisConfiguration, - ConfigurationContext context, OutputStream out ) throws Exception { - - IParameterProvider pathParams = parameterProviders.get( "path" ); //$NON-NLS-1$ - - // get the HTTP objects from the 'path' parameter provider - HttpServletRequest request = (HttpServletRequest) pathParams.getParameter( "httprequest" ); //$NON-NLS-1$ - - @SuppressWarnings( "unchecked" ) - Enumeration names = request.getParameterNames(); - while ( names.hasMoreElements() ) { - String name = (String) names.nextElement(); - if ( name.equalsIgnoreCase( "wsdl" ) ) { //$NON-NLS-1$ - axisService.printWSDL( out, AxisUtil.getWebServiceExecuteUrl() ); - return; - } - } - - HttpServletResponse response = (HttpServletResponse) pathParams.getParameter( "httpresponse" ); //$NON-NLS-1$ - ServletConfig servletConfig = (ServletConfig) pathParams.getParameter( "servletconfig" ); //$NON-NLS-1$ - - // create a service group and group context for this service - AxisServiceGroup axisServiceGroup = new AxisServiceGroup( context.getAxisConfiguration() ); - axisServiceGroup.addService( axisService ); - ServiceGroupContext serviceGroupContext = new ServiceGroupContext( context, axisServiceGroup ); - // create a service context - ServiceContext serviceContext = serviceGroupContext.getServiceContext( axisService ); - // get an operation by name, if possible - AxisOperation axisOperation = axisService.getOperationByAction( operationName ); - OperationContext operationContext = serviceContext.createOperationContext( axisOperation ); - - // create an object to hook into Axis and give it everything we have - AxisServletHooks hooks = new AxisServletHooks(); - hooks.setContext( context ); - hooks.setServletConfig( servletConfig ); - hooks.setConfiguration( axisConfiguration ); - hooks.initContextRoot( request ); - hooks.setAxisService( axisService ); - hooks.setAxisOperation( axisOperation ); - hooks.setOperationContext( operationContext ); - hooks.setServiceContext( serviceContext ); - hooks.setAxisOperation( axisOperation ); - hooks.setOperationContext( operationContext ); - // now execute the operation - if ( request != null && response != null ) { - try { - PentahoSessionHolder.setSession( userSession ); - String method = request.getMethod(); - if ( "GET".equalsIgnoreCase( method ) ) { //$NON-NLS-1$ - hooks.handleGet( method, request, response ); - } else if ( "POST".equalsIgnoreCase( request.getMethod() ) ) { //$NON-NLS-1$ - hooks.handlePost( method, request, response ); - } else if ( "PUT".equalsIgnoreCase( request.getMethod() ) ) { //$NON-NLS-1$ - hooks.handlePut( method, request, response ); - } - } catch ( Exception e ) { - processAxisFault( hooks.getMessageContext(), out, e ); - error( Messages.getInstance().getErrorString( "RunService.ERROR_0001_ERROR_DURING_EXECUTION" ), e ); //$NON-NLS-1$ - } - } - - } - - @Override - public String getMimeType() { - return "text/xml"; //$NON-NLS-1$ - } - - @Override - public Log getLogger() { - return LogFactory.getLog( AxisServiceExecutor.class ); - } - - public void setContentType( String contentType ) { - IContentItem contentItem = outputHandler.getOutputContentItem( "response", "content", instanceId, getMimeType() ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - contentItem.setMimeType( contentType ); - } - -} diff --git a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/AxisServiceWsdlGenerator.java b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/AxisServiceWsdlGenerator.java index 1ea14087d30..e69de29bb2d 100644 --- a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/AxisServiceWsdlGenerator.java +++ b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/AxisServiceWsdlGenerator.java @@ -1,54 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.platform.plugin.services.webservices.content; - -import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.description.AxisService; -import org.apache.axis2.engine.AxisConfiguration; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.pentaho.platform.plugin.services.webservices.AxisUtil; - -import java.io.OutputStream; - -/** - * Writes the WSDL for a Axis web service to the output stream provided - * - * @author jamesdixon - * - */ -public class AxisServiceWsdlGenerator extends AxisWebServiceRequestDispatcher { - - private static final long serialVersionUID = -163750511475038584L; - - /** - * Writes the WSDL to the output stream provided. The WSDL is prepared ahead of time when the web service is created. - */ - @Override - public void createServiceContent( AxisService axisService, String operationName, AxisConfiguration axisConfiguration, - ConfigurationContext context, OutputStream out ) throws Exception { - axisService.printWSDL( out, AxisUtil.getWebServiceExecuteUrl() ); - } - - @Override - public Log getLogger() { - return LogFactory.getLog( AxisServiceWsdlGenerator.class ); - } - - @Override - public String getMimeType() { - return "text/xml"; //$NON-NLS-1$ - } - -} diff --git a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/AxisWebServiceRequestDispatcher.java b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/AxisWebServiceRequestDispatcher.java index f98a914ab2b..e69de29bb2d 100644 --- a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/AxisWebServiceRequestDispatcher.java +++ b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/AxisWebServiceRequestDispatcher.java @@ -1,117 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.platform.plugin.services.webservices.content; - -import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.description.AxisService; -import org.apache.axis2.engine.AxisConfiguration; -import org.pentaho.platform.api.engine.IParameterProvider; -import org.pentaho.platform.plugin.services.webservices.messages.Messages; - -import java.io.OutputStream; - -/** - * This class dispatches requests coming from GenericServlet and determines which AxisService should be invoked. It then - * passes this information, along with all the Axis content, to a subclass to do the execution. - * - * @author jamesdixon - */ -public abstract class AxisWebServiceRequestDispatcher extends AbstractAxisServiceContentGenerator { - - private static final long serialVersionUID = 8314157642653305277L; - - /** - * Parses the path parameter to find the web service name, makes sure it is valid, and the calls the current subclass - * to create the required content for the specified web service - */ - @Override - public void createContent( AxisConfiguration axisConfiguration, ConfigurationContext context, OutputStream out ) - throws Exception { - - // make sure we have a 'path' parameters provider - IParameterProvider pathParams = parameterProviders.get( "path" ); //$NON-NLS-1$ - if ( pathParams == null ) { - // return an error - String message = - Messages.getInstance().getErrorString( "WebServiceContentGenerator.ERROR_0004_PATH_PARAMS_IS_MISSING" ); //$NON-NLS-1$ - getLogger().error( message ); - out.write( message.getBytes() ); - return; - } - - // make sure we have a service name on the URL - String serviceName = pathParams.getStringParameter( "path", null ); //$NON-NLS-1$ - if ( serviceName == null ) { - // return an error - String message = - Messages.getInstance().getErrorString( "WebServiceContentGenerator.ERROR_0005_SERVICE_NAME_IS_MISSING" ); //$NON-NLS-1$ - getLogger().error( message ); - out.write( message.getBytes() ); - return; - } - - // remove the leading '/' - serviceName = serviceName.substring( 1 ); - - // pull the service name off the URL - String query = serviceName; - String operationName = null; - int idx = serviceName.indexOf( "/" ); //$NON-NLS-1$ - if ( idx != -1 ) { - serviceName = serviceName.substring( 0, idx ); - query = query.substring( idx + 1 ); - idx = query.indexOf( "?" ); //$NON-NLS-1$ - if ( idx != -1 ) { - operationName = query.substring( 0, idx ); - } else { - operationName = query; - } - } - - // try to get the service using the name - AxisService axisService = axisConfiguration.getService( serviceName ); - if ( axisService == null ) { - // return an error - String message = - Messages.getInstance().getErrorString( - "WebServiceContentGenerator.ERROR_0006_SERVICE_IS_INVALID", serviceName ); //$NON-NLS-1$ - getLogger().error( message ); - out.write( message.getBytes() ); - return; - } - - // hand over to the subclass - createServiceContent( axisService, operationName, axisConfiguration, context, out ); - - } - - /** - * Processes the current request for the provided Axis service - * - * @param axisService - * The Axis web service - * @param operationName - * The name of the operation to perform, if known - * @param axisConfiguration - * The current configuration - * @param context - * The current context - * @param out - * The output stream for content to be written to - * @throws Exception - */ - protected abstract void createServiceContent( AxisService axisService, String operationName, - AxisConfiguration axisConfiguration, ConfigurationContext context, OutputStream out ) throws Exception; - -} diff --git a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/HtmlAxisServiceLister.java b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/HtmlAxisServiceLister.java index 36d0cdbc823..e69de29bb2d 100644 --- a/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/HtmlAxisServiceLister.java +++ b/extensions/src/main/java/org/pentaho/platform/plugin/services/webservices/content/HtmlAxisServiceLister.java @@ -1,238 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.platform.plugin.services.webservices.content; - -import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.description.AxisOperation; -import org.apache.axis2.description.AxisService; -import org.apache.axis2.engine.AxisConfiguration; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.pentaho.platform.api.engine.IServiceConfig; -import org.pentaho.platform.plugin.services.webservices.AxisUtil; -import org.pentaho.platform.plugin.services.webservices.SystemSolutionAxisConfigurator; -import org.pentaho.platform.plugin.services.webservices.messages.Messages; -import org.pentaho.platform.util.messages.LocaleHelper; - -import java.io.OutputStream; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; - -/** - * A content generator for listing metadata on Axis web services. - * - * @author jamesdixon - * - */ -public class HtmlAxisServiceLister extends AbstractAxisServiceContentGenerator { - - private static final long serialVersionUID = -1772210710764038165L; - - @SuppressWarnings( "unchecked" ) - @Override - public void createContent( AxisConfiguration axisConfiguration, ConfigurationContext context, OutputStream out ) - throws Exception { - - HashMap serviceMap = axisConfiguration.getServices(); - - StringBuilder sb = new StringBuilder(); - - getPageTitle( serviceMap, sb ); - - Collection servicecol = serviceMap.values(); - // list each web service - for ( Iterator iterator = servicecol.iterator(); iterator.hasNext(); ) { - AxisService axisService = (AxisService) iterator.next(); - - getTitleSection( axisService, axisConfiguration, sb ); - - getWsdlSection( axisService, sb ); - - getRunSection( axisService, sb ); - - getOperationsSection( axisService, sb ); - - } - - getPageFooter( serviceMap, sb ); - - out.write( sb.toString().getBytes( LocaleHelper.getSystemEncoding() ) ); - } - - /** - * Writes the HTML page title area - * - * @param serviceMap - * Map of current web services - * @param sb - * StringBuilder to write content to - */ - @SuppressWarnings( "unchecked" ) - protected void getPageTitle( HashMap serviceMap, StringBuilder sb ) { - // write out the page title - sb.append( "
" ); //$NON-NLS-1$ - sb.append( "

" ).append( Messages.getInstance().getString( "ListServices.USER_WEB_SERVICES" ) ).append( - "

\n" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - if ( serviceMap.isEmpty() ) { - // there are no services defined - sb.append( Messages.getInstance().getString( "ListServices.USER_NO_SERVICES" ) ); //$NON-NLS-1$ - } - } - - /** - * Writes the title section for a service to the HTML page - * - * @param axisService - * the Axis service - * @param axisConfiguration - * the Axis configuration - * @param sb - * StringBuilder to write content to - */ - protected void getTitleSection( AxisService axisService, AxisConfiguration axisConfiguration, StringBuilder sb ) { - - // get the wrapper for the web service so we can get the localized title and description - IServiceConfig wsDef = - AxisUtil - .getSourceDefinition( axisService, (SystemSolutionAxisConfigurator) axisConfiguration.getConfigurator() ); - - sb.append( "\n\n\n\n" ); //$NON-NLS-1$ - - // write out the enable/disable controls - sb.append( "\n" ); //$NON-NLS-1$ - } - - /** - * Writes the execute URL section for a service to the HTML page - * - * @param axisService - * the Axis service - * @param sb - * StringBuilder to write content to - */ - protected void getRunSection( AxisService axisService, StringBuilder sb ) { - // write out the execution URL - String serviceUrl = AxisUtil.getWebServiceExecuteUrl(); - sb.append( "\n" ); //$NON-NLS-1$ - - } - - /** - * Writes the list of operations for a service to the HTML page - * - * @param axisService - * the Axis service - * @param sb - * StringBuilder to write content to - */ - @SuppressWarnings( "unchecked" ) - protected void getOperationsSection( AxisService axisService, StringBuilder sb ) { - String serviceUrl = AxisUtil.getWebServiceExecuteUrl(); - - // write out the operations - Iterator it = axisService.getOperations(); - - sb.append( "\n

" ).append( wsDef.getTitle() ).append( - "

" ); //$NON-NLS-1$ //$NON-NLS-2$ - - String serviceDescription = axisService.getDocumentation(); - if ( serviceDescription == null || "".equals( serviceDescription ) ) { //$NON-NLS-1$ - serviceDescription = Messages.getInstance().getString( "WebServicePlugin.USER_NO_DESCRIPTION" ); //$NON-NLS-1$ - } - - // write out the description - sb.append( Messages.getInstance().getString( "WebServicePlugin.USER_SERVICE_DESCRIPTION" ) ) //$NON-NLS-1$ - .append( "" ) //$NON-NLS-1$ - .append( serviceDescription ).append( "
" ).append( Messages.getInstance().getString( "WebServicePlugin.USER_SERVICE_STATUS" ) ) //$NON-NLS-1$ //$NON-NLS-2$ - - .append( "" ); //$NON-NLS-1$ - if ( axisService.isActive() ) { - sb.append( Messages.getInstance().getString( "WebServicePlugin.USER_ENABLED" ) ); //$NON-NLS-1$ - } else { - sb.append( Messages.getInstance().getString( "WebServicePlugin.USER_DISABLED" ) ); //$NON-NLS-1$ - } - } - - /** - * Writes the WSDL section for a service to the HTML page - * - * @param axisService - * the Axis service - * @param sb - * StringBuilder to write content to - */ - protected void getWsdlSection( AxisService axisService, StringBuilder sb ) { - // write out the WSDL URL - String wsdlUrl = AxisUtil.getWebServiceWsdlUrl(); - sb.append( "
" ).append( Messages.getInstance().getString( "WebServicePlugin.USER_SERVICE_WSDL" ) ) //$NON-NLS-1$ //$NON-NLS-2$ - .append( "" ).append( wsdlUrl + axisService.getName() ) //$NON-NLS-1$ - .append( "
" ).append( Messages.getInstance().getString( "WebServicePlugin.USER_SERVICE_URL" ) ) //$NON-NLS-1$ //$NON-NLS-2$ - .append( "" ).append( serviceUrl + axisService.getName() ) //$NON-NLS-1$ - .append( "
" ) //$NON-NLS-1$ - .append( Messages.getInstance().getString( "WebServicePlugin.USER_OPERATIONS" ) ) //$NON-NLS-1$ - .append( "" ); //$NON-NLS-1$ - // now do the operations - if ( !it.hasNext() ) { - sb.append( Messages.getInstance().getString( "WebServicePlugin.USER_NO_OPERATIONS" ) ); //$NON-NLS-1$ - } else { - - // write out the names of the operations - // TODO localize these? - while ( it.hasNext() ) { - AxisOperation axisOperation = (AxisOperation) it.next(); - String opName = axisOperation.getName().getLocalPart(); - - String opUrl = serviceUrl + axisService.getName() + "/" + opName; //$NON-NLS-1$ - - sb.append( "" ).append( opName ) //$NON-NLS-1$ - .append( "" ); //$NON-NLS-1$ - - if ( it.hasNext() ) { - sb.append( "
" ); //$NON-NLS-1$ - } - } - sb.append( "
\n" ); //$NON-NLS-1$ - } - } - - /** - * Writes the HTML page footer - * - * @param serviceMap - * Map of current web services - * @param sb - * StringBuilder to write content to - */ - @SuppressWarnings( "unchecked" ) - protected void getPageFooter( HashMap serviceMap, StringBuilder sb ) { - // write out the page footer - sb.append( "\n".getBytes() ); //$NON-NLS-1$ - - final IPentahoSession session = PentahoSessionHolder.getSession(); - IUserSettingService settingsService = PentahoSystem.get( IUserSettingService.class, session ); - String activeThemeName; - if ( session == null || settingsService == null ) { - activeThemeName = PentahoSystem.getSystemSetting( "default-activeThemeName", "onyx" ); - } else { - activeThemeName = StringUtils.defaultIfEmpty( (String) session.getAttribute( "pentaho-user-activeThemeName" ), settingsService - .getUserSetting( "pentaho-user-activeThemeName", PentahoSystem.getSystemSetting( "default-activeThemeName", "onyx" ) ) - .getSettingValue() ); - } - - IThemeManager themeManager = PentahoSystem.get( IThemeManager.class, null ); - Theme theme = themeManager.getSystemTheme( activeThemeName ); - - final ServletContext servletContext = (ServletContext) PentahoSystem.getApplicationContext().getContext(); - if ( servletContext != null ) { - for ( ThemeResource res : theme.getResources() ) { - if ( res.getLocation().endsWith( ".css" ) ) { - out.write( ( "" ).getBytes() ); - } - } - } - - out.write( "\n\n".getBytes() ); //$NON-NLS-1$ - - // get the list of services from the core ListServices - super.createContent( axisConfiguration, context, out ); - - out.write( "\n\n".getBytes() ); //$NON-NLS-1$ - - } - -} diff --git a/extensions/src/test/java/org/pentaho/platform/plugin/services/webservices/content/AxisServiceExecutorTest.java b/extensions/src/test/java/org/pentaho/platform/plugin/services/webservices/content/AxisServiceExecutorTest.java index ea4d4c202de..e69de29bb2d 100644 --- a/extensions/src/test/java/org/pentaho/platform/plugin/services/webservices/content/AxisServiceExecutorTest.java +++ b/extensions/src/test/java/org/pentaho/platform/plugin/services/webservices/content/AxisServiceExecutorTest.java @@ -1,350 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.platform.plugin.services.webservices.content; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.io.ByteArrayOutputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.description.TransportInDescription; -import org.apache.axis2.description.TransportOutDescription; -import org.apache.axis2.engine.AxisConfiguration; -import org.junit.Before; -import org.junit.Test; -import org.pentaho.platform.api.engine.IOutputHandler; -import org.pentaho.platform.api.engine.IParameterProvider; -import org.pentaho.platform.engine.core.output.SimpleOutputHandler; -import org.pentaho.platform.engine.core.solution.SimpleParameterProvider; -import org.pentaho.platform.engine.core.system.StandaloneSession; -import org.pentaho.platform.plugin.services.pluginmgr.servicemgr.AxisWebServiceManager; -import org.pentaho.platform.util.web.SimpleUrlFactory; -import org.pentaho.test.platform.plugin.services.webservices.MimeTypeListener; -import org.pentaho.test.platform.plugin.services.webservices.StubService; -import org.pentaho.test.platform.plugin.services.webservices.StubServiceSetup; -import org.pentaho.test.platform.plugin.services.webservices.StubTransportListener; -import org.pentaho.test.platform.plugin.services.webservices.StubTransportSender; - -import com.mockrunner.mock.web.MockHttpServletRequest; -import com.mockrunner.mock.web.MockHttpServletResponse; - -public class AxisServiceExecutorTest { - - private static final String BASE_URL = "http://testhost:testport/testcontent"; - private static final String DEAFULT_TRANSPOT_PROTOCOL = "http"; - private static final String REMOTE_ADDRESS = "127.0.0.1"; - - private ByteArrayOutputStream out; - private AxisServiceExecutor contentGenerator; - - @Before - public void setUp() throws Exception { - StandaloneSession session = new StandaloneSession( "test" ); - StubServiceSetup serviceSetup = new StubServiceSetup(); - serviceSetup.setSession( session ); - - AxisConfiguration axisCfg = serviceSetup.getAxisConfiguration(); - ConfigurationContext configContext = new ConfigurationContext( axisCfg ); - - serviceSetup.loadServices(); - - TransportInDescription tIn = new TransportInDescription( DEAFULT_TRANSPOT_PROTOCOL ); - StubTransportListener receiver = new StubTransportListener(); - tIn.setReceiver( receiver ); - axisCfg.addTransportIn( tIn ); - - TransportOutDescription tOut = new TransportOutDescription( DEAFULT_TRANSPOT_PROTOCOL ); - StubTransportSender sender = new StubTransportSender(); - tOut.setSender( sender ); - axisCfg.addTransportOut( tOut ); - - AxisWebServiceManager.currentAxisConfiguration = axisCfg; - AxisWebServiceManager.currentAxisConfigContext = configContext; - - out = new ByteArrayOutputStream(); - IOutputHandler outputHandler = new SimpleOutputHandler( out, false ); - outputHandler.setMimeTypeListener( new MimeTypeListener() ); - - contentGenerator = new AxisServiceExecutor(); - - contentGenerator.setOutputHandler( outputHandler ); - contentGenerator.setMessagesList( new ArrayList() ); - - contentGenerator.setSession( session ); - contentGenerator.setUrlFactory( new SimpleUrlFactory( BASE_URL + "?" ) ); - - assertNotNull( "contentGenerator is null", contentGenerator ); - assertNotNull( "Logger is null", contentGenerator.getLogger() ); - } - - @Test - public void testRunGet() throws Exception { - Map parameterProviders = new HashMap(); - SimpleParameterProvider pathParams = new SimpleParameterProvider(); - pathParams.setParameter( "path", "/StubService/getString" ); - pathParams.setParameter( "remoteaddr", "http:test" ); - parameterProviders.put( "path", pathParams ); - contentGenerator.setParameterProviders( parameterProviders ); - - MockHttpServletRequest request = new MockHttpServletRequest(); - MockHttpServletResponse response = new MockHttpServletResponse(); - - request.setMethod( "GET" ); - request.setRequestURI( "/pentaho/content/ws-run/StubService/getString" ); - request.setRequestURL( "http://localhost:8080/pentaho/content/ws-run/StubService/getString" ); - request.setRemoteAddr( REMOTE_ADDRESS ); - - pathParams.setParameter( "httprequest", request ); - pathParams.setParameter( "httpresponse", response ); - - try { - StubTransportSender.transportOutStr = null; - StubService.getStringCalled = false; - - contentGenerator.createContent(); - - assertTrue( StubService.getStringCalled ); - String content = StubTransportSender.transportOutStr; - assertEquals( "result are wrong", - "test" - + " result", content ); - } catch ( Exception e ) { - assertTrue( "Exception occurred", false ); - } - } - - @Test - public void testRunGetWithParameter() throws Exception { - Map parameterProviders = new HashMap(); - SimpleParameterProvider pathParams = new SimpleParameterProvider(); - pathParams.setParameter( "path", "/StubService/setString?str=testinput" ); - parameterProviders.put( "path", pathParams ); - contentGenerator.setParameterProviders( parameterProviders ); - - MockHttpServletRequest request = new MockHttpServletRequest(); - MockHttpServletResponse response = new MockHttpServletResponse(); - - request.setMethod( "GET" ); - request.setRequestURI( "/pentaho/content/ws-run/StubService/setString" ); - request.setRequestURL( "http://localhost:8080/pentaho/content/ws-run/StubService/getString" ); - request.setRemoteAddr( REMOTE_ADDRESS ); - request.setQueryString( "str=testinput" ); - - pathParams.setParameter( "httprequest", request ); - pathParams.setParameter( "httpresponse", response ); - - try { - StubService.setStringCalled = false; - StubTransportSender.transportOutStr = null; - - contentGenerator.createContent(); - - assertTrue( StubService.setStringCalled ); - assertEquals( "testinput", StubService.str ); - } catch ( Exception e ) { - assertTrue( "Exception occurred", false ); - } - } - - @Test - public void testRunGetThrowError() throws Exception { - Map parameterProviders = new HashMap(); - SimpleParameterProvider pathParams = new SimpleParameterProvider(); - pathParams.setParameter( "path", "/StubService/throwsError1" ); - parameterProviders.put( "path", pathParams ); - contentGenerator.setParameterProviders( parameterProviders ); - - MockHttpServletRequest request = new MockHttpServletRequest(); - MockHttpServletResponse response = new MockHttpServletResponse(); - - request.setMethod( "GET" ); - request.setRequestURI( "/pentaho/content/ws-run/StubService/throwsError1" ); - request.setRequestURL( "http://localhost:8080/pentaho/content/ws-run/StubService/throwsError1" ); - request.setRemoteAddr( REMOTE_ADDRESS ); - - pathParams.setParameter( "httprequest", request ); - pathParams.setParameter( "httpresponse", response ); - try { - StubService.throwsError1Called = false; - StubTransportSender.transportOutStr = null; - - contentGenerator.createContent(); - - assertTrue( StubService.throwsError1Called ); - String content = StubTransportSender.transportOutStr; - assertNull( "Content should be empty", content ); - } catch ( Exception e ) { - assertTrue( "Exception occurred", false ); - } - } - - @Test - public void testRunGetErrorResponse() throws Exception { - Map parameterProviders = new HashMap(); - SimpleParameterProvider pathParams = new SimpleParameterProvider(); - pathParams.setParameter( "path", "/StubService/throwsError2" ); - parameterProviders.put( "path", pathParams ); - contentGenerator.setParameterProviders( parameterProviders ); - - MockHttpServletRequest request = new MockHttpServletRequest(); - MockHttpServletResponse response = new MockHttpServletResponse(); - - request.setMethod( "GET" ); - request.setRequestURI( "/pentaho/content/ws-run/StubService/throwsError2" ); - request.setRequestURL( "http://localhost:8080/pentaho/content/ws-run/StubService/throwsError2" ); - request.setRemoteAddr( REMOTE_ADDRESS ); - - pathParams.setParameter( "httprequest", request ); - pathParams.setParameter( "httpresponse", response ); - - try { - StubService.throwsError2Called = false; - StubTransportSender.transportOutStr = null; - - contentGenerator.createContent(); - - assertTrue( StubService.throwsError2Called ); - String content = StubTransportSender.transportOutStr; - assertTrue( "results are wrong", content.contains( "soapenv:Fault" ) ); - assertTrue( "results are wrong", content.contains( "test error 2" ) ); - } catch ( Exception e ) { - assertTrue( "Exception occurred", false ); - } - } - - @Test - public void testRunGetAxisServletHooks() throws Exception { - Map parameterProviders = new HashMap(); - SimpleParameterProvider pathParams = new SimpleParameterProvider(); - pathParams.setParameter( "path", "/StubService/bogus" ); - parameterProviders.put( "path", pathParams ); - contentGenerator.setParameterProviders( parameterProviders ); - - MockHttpServletRequest request = new MockHttpServletRequest(); - MockHttpServletResponse response = new MockHttpServletResponse(); - - request.setMethod( "GET" ); - request.setRequestURI( "/pentaho/content/ws-run/StubService/bogus" ); - request.setRequestURL( "http://localhost:8080/pentaho/content/ws-run/StubService/bogus" ); - request.setRemoteAddr( REMOTE_ADDRESS ); - - pathParams.setParameter( "httprequest", request ); - pathParams.setParameter( "httpresponse", response ); - - try { - StubTransportSender.transportOutStr = null; - - contentGenerator.createContent(); - - String content = StubTransportSender.transportOutStr; - assertTrue( "results are wrong", content.contains( "soapenv:Fault" ) ); - assertTrue( "results are wrong", content.contains( "AxisServletHooks" ) ); - } catch ( Exception e ) { - assertTrue( "Exception occurred", false ); - } - } - - @Test - public void testRunPost() throws Exception { - Map parameterProviders = new HashMap(); - SimpleParameterProvider pathParams = new SimpleParameterProvider(); - pathParams.setParameter( "path", "/StubService" ); - pathParams.setParameter( "remoteaddr", "http:test" ); - parameterProviders.put( "path", pathParams ); - contentGenerator.setParameterProviders( parameterProviders ); - - MockHttpServletRequest request = new MockHttpServletRequest(); - MockHttpServletResponse response = new MockHttpServletResponse(); - - request.setMethod( "POST" ); - request.setRequestURI( "/pentaho/content/ws-run/StubService" ); - request.setRequestURL( "http://localhost:8080/pentaho/content/ws-run/StubService" ); - request.setRemoteAddr( REMOTE_ADDRESS ); - request.setContentType( "application/soap+xml; charset=UTF-8; action=\"urn:getString\"" ); - String xml = - ""; - request.setBodyContent( xml ); - - pathParams.setParameter( "httprequest", request ); - pathParams.setParameter( "httpresponse", response ); - - try { - StubTransportSender.transportOutStr = null; - StubService.getStringCalled = false; - - contentGenerator.createContent(); - - assertTrue( StubService.getStringCalled ); - String content = StubTransportSender.transportOutStr; - assertEquals( "result are wrong", - "test " - + "result", content ); - } catch ( Exception e ) { - assertTrue( "Exception occurred", false ); - } - } - - @Test - public void testRunPut() throws Exception { - Map parameterProviders = new HashMap(); - SimpleParameterProvider pathParams = new SimpleParameterProvider(); - pathParams.setParameter( "path", "/StubService" ); - pathParams.setParameter( "remoteaddr", "http:test" ); - parameterProviders.put( "path", pathParams ); - contentGenerator.setParameterProviders( parameterProviders ); - - MockHttpServletRequest request = new MockHttpServletRequest(); - MockHttpServletResponse response = new MockHttpServletResponse(); - - request.setMethod( "PUT" ); - request.setRequestURI( "/pentaho/content/ws-run/StubService" ); - request.setRequestURL( "http://localhost:8080/pentaho/content/ws-run/StubService" ); - request.setRemoteAddr( REMOTE_ADDRESS ); - request.setContentType( "application/soap+xml; charset=UTF-8; action=\"urn:getString\"" ); - String xml = - ""; - request.setBodyContent( xml ); - - pathParams.setParameter( "httprequest", request ); - pathParams.setParameter( "httpresponse", response ); - - try { - StubTransportSender.transportOutStr = null; - StubService.getStringCalled = false; - - contentGenerator.createContent(); - - assertTrue( StubService.getStringCalled ); - String content = StubTransportSender.transportOutStr; - assertEquals( "result are wrong", - "test" - + " result", content ); - } catch ( Exception e ) { - assertTrue( "Exception occurred", false ); - } - } - -} diff --git a/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/AxisServiceWsdlGeneratorTest.java b/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/AxisServiceWsdlGeneratorTest.java index da6acfba8de..e69de29bb2d 100644 --- a/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/AxisServiceWsdlGeneratorTest.java +++ b/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/AxisServiceWsdlGeneratorTest.java @@ -1,76 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.test.platform.plugin.services.webservices; - -import org.junit.Test; -import org.pentaho.platform.api.engine.IOutputHandler; -import org.pentaho.platform.api.engine.IParameterProvider; -import org.pentaho.platform.engine.core.output.SimpleOutputHandler; -import org.pentaho.platform.engine.core.solution.SimpleParameterProvider; -import org.pentaho.platform.engine.core.system.StandaloneSession; -import org.pentaho.platform.plugin.services.pluginmgr.servicemgr.AxisWebServiceManager; -import org.pentaho.platform.plugin.services.webservices.content.AxisServiceWsdlGenerator; -import org.pentaho.platform.plugin.services.webservices.messages.Messages; -import org.pentaho.platform.util.web.SimpleUrlFactory; - -import java.io.ByteArrayOutputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.junit.Assert.*; - -public class AxisServiceWsdlGeneratorTest { - - @Test - public void testBadInit2() throws Exception { - - assertNull( AxisWebServiceManager.currentAxisConfiguration ); - - } - - @Test - public void testBadInit3() throws Exception { - StandaloneSession session = new StandaloneSession( "test" ); //$NON-NLS-1$ - - AxisServiceWsdlGenerator contentGenerator = new AxisServiceWsdlGenerator(); - - assertNotNull( "contentGenerator is null", contentGenerator ); //$NON-NLS-1$ - assertNotNull( "Logger is null", contentGenerator.getLogger() ); //$NON-NLS-1$ - - ByteArrayOutputStream out = new ByteArrayOutputStream(); - IOutputHandler outputHandler = new SimpleOutputHandler( out, false ); - - String baseUrl = "http://testhost:testport/testcontent"; //$NON-NLS-1$ - Map parameterProviders = new HashMap(); - SimpleParameterProvider requestParams = new SimpleParameterProvider(); - parameterProviders.put( IParameterProvider.SCOPE_REQUEST, requestParams ); - SimpleUrlFactory urlFactory = new SimpleUrlFactory( baseUrl + "?" ); //$NON-NLS-1$ - List messages = new ArrayList(); - contentGenerator.setOutputHandler( outputHandler ); - MimeTypeListener mimeTypeListener = new MimeTypeListener(); - outputHandler.setMimeTypeListener( mimeTypeListener ); - contentGenerator.setMessagesList( messages ); - contentGenerator.setParameterProviders( parameterProviders ); - contentGenerator.setSession( session ); - contentGenerator.setUrlFactory( urlFactory ); - contentGenerator.createContent(); - String content = new String( out.toByteArray() ); - System.out.println( content ); - assertTrue( content.indexOf( Messages.getInstance().getErrorString( - "WebServiceContentGenerator.ERROR_0001_AXIS_CONFIG_IS_NULL" ) ) != -1 ); //$NON-NLS-1$ - } - -} diff --git a/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/StubServiceSetup.java b/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/StubServiceSetup.java index 654be5f39fa..e69de29bb2d 100644 --- a/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/StubServiceSetup.java +++ b/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/StubServiceSetup.java @@ -1,101 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.test.platform.plugin.services.webservices; - -import org.apache.axis2.description.AxisService; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.pentaho.platform.api.engine.IServiceConfig; -import org.pentaho.platform.plugin.services.pluginmgr.servicemgr.ServiceConfig; -import org.pentaho.platform.plugin.services.webservices.SystemSolutionAxisConfigurator; -import org.pentaho.test.platform.utils.TestResourceLocation; - -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - -public class StubServiceSetup extends SystemSolutionAxisConfigurator { - - private static final long serialVersionUID = 3383802441135983726L; - - protected static StubServiceSetup instance = null; - - private static final String BASE_URL = "http://testhost:8080/testcontext/"; //$NON-NLS-1$ - - private static final Log logger = LogFactory.getLog( StubServiceSetup.class ); - - public StubServiceSetup() { - super(); - } - - public void init() { - - } - - public Log getLogger() { - return logger; - } - - @Override - public InputStream getConfigXml() { - - try { - File f = new File( TestResourceLocation.TEST_RESOURCES + "/webservices-solution/system/axis2_config.xml" ); //$NON-NLS-1$ - return new FileInputStream( f ); - } catch ( Exception e ) { - // TODO log this - e.printStackTrace(); - } - return null; - } - - @Override - public boolean setEnabled( String name, boolean enabled ) { - ServiceConfig wrapper = (ServiceConfig) getWebServiceDefinition( name ); - wrapper.setEnabled( enabled ); - // FIXME: service is not available through the definition bean - // AxisService axisService = wrapper.getService( ); - // axisService.setActive( enabled ); - return true; - } - - @Override - protected List getWebServiceDefinitions() { - List wrappers = new ArrayList(); - wrappers.add( new StubServiceWrapper() ); - return wrappers; - } - - @Override - protected void addTransports( AxisService axisService ) { - - ArrayList transports = new ArrayList(); - transports.add( "http" ); //$NON-NLS-1$ - axisService.setExposedTransports( transports ); - } - - @Override - protected void addServiceEndPoints( AxisService axisService ) { - String endPoint1 = BASE_URL + "content/ws-run/" + axisService.getName(); //$NON-NLS-1$ - String endPoint2 = "http:test"; //$NON-NLS-1$ - - ArrayList transports = new ArrayList(); - transports.add( "http" ); //$NON-NLS-1$ - axisService.setExposedTransports( transports ); - axisService.setEPRs( new String[] { endPoint1, endPoint2 } ); - } - -} diff --git a/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/StubTransportListener.java b/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/StubTransportListener.java index b4c4e468db4..e69de29bb2d 100644 --- a/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/StubTransportListener.java +++ b/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/StubTransportListener.java @@ -1,57 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.test.platform.plugin.services.webservices; - -import org.apache.axis2.AxisFault; -import org.apache.axis2.addressing.EndpointReference; -import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.context.MessageContext; -import org.apache.axis2.context.SessionContext; -import org.apache.axis2.description.TransportInDescription; -import org.apache.axis2.transport.TransportListener; - -public class StubTransportListener implements TransportListener { - - public void destroy() { - System.out.println( "TestTransportListener.destroy" ); //$NON-NLS-1$ - } - - public EndpointReference getEPRForService( String serviceName, String ip ) throws AxisFault { - System.out.println( "TestTransportListener.getEPRForService" ); //$NON-NLS-1$ - return null; - } - - public EndpointReference[] getEPRsForService( String serviceName, String ip ) throws AxisFault { - System.out.println( "TestTransportListener.getEPRsForService" ); //$NON-NLS-1$ - return null; - } - - public SessionContext getSessionContext( MessageContext messageContext ) { - System.out.println( "TestTransportListener.getSessionContext" ); //$NON-NLS-1$ - return null; - } - - public void init( ConfigurationContext axisConf, TransportInDescription transprtIn ) throws AxisFault { - System.out.println( "TestTransportListener.init" ); //$NON-NLS-1$ - } - - public void start() throws AxisFault { - System.out.println( "TestTransportListener.start" ); //$NON-NLS-1$ - } - - public void stop() throws AxisFault { - System.out.println( "TestTransportListener.stop" ); //$NON-NLS-1$ - } - -} diff --git a/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/StubTransportSender.java b/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/StubTransportSender.java index 70ae3140e2d..e69de29bb2d 100644 --- a/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/StubTransportSender.java +++ b/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/StubTransportSender.java @@ -1,80 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.test.platform.plugin.services.webservices; - -import org.apache.axis2.AxisFault; -import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.context.MessageContext; -import org.apache.axis2.description.HandlerDescription; -import org.apache.axis2.description.Parameter; -import org.apache.axis2.description.TransportOutDescription; -import org.apache.axis2.transport.TransportSender; -import org.apache.axis2.transport.TransportUtils; - -import java.io.ByteArrayOutputStream; - -public class StubTransportSender implements TransportSender { - - public static String transportOutStr = null; - - public void cleanup( MessageContext msgContext ) throws AxisFault { - System.out.println( "TestTransportSender.cleanup 1 " ); //$NON-NLS-1$ - } - - public void init( ConfigurationContext confContext, TransportOutDescription transportOut ) throws AxisFault { - System.out.println( "TestTransportSender.init 1 " ); //$NON-NLS-1$ - } - - public void stop() { - System.out.println( "TestTransportSender.stop " ); //$NON-NLS-1$ - } - - public void cleanup() { - System.out.println( "TestTransportSender.cleanup 2 " ); //$NON-NLS-1$ - } - - public void flowComplete( MessageContext msgContext ) { - System.out.println( "TestTransportSender.flowComplete " ); //$NON-NLS-1$ - } - - public HandlerDescription getHandlerDesc() { - System.out.println( "TestTransportSender.getHandlerDesc " ); //$NON-NLS-1$ - return null; - } - - public String getName() { - System.out.println( "TestTransportSender.getName " ); //$NON-NLS-1$ - return "testname"; //$NON-NLS-1$ - } - - public Parameter getParameter( String name ) { - System.out.println( "TestTransportSender.getParameter " + name ); //$NON-NLS-1$ - return null; - } - - public void init( HandlerDescription handlerDesc ) { - System.out.println( "TestTransportSender.init 2 " ); //$NON-NLS-1$ - - } - - public InvocationResponse invoke( MessageContext msgContext ) throws AxisFault { - - ByteArrayOutputStream out = new ByteArrayOutputStream(); - TransportUtils.writeMessage( msgContext, out ); - StubTransportSender.transportOutStr = new String( out.toByteArray() ); - System.out.println( "TestTransportSender.invoke " ); //$NON-NLS-1$ - return null; - } - -} diff --git a/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/WsdlPageTest.java b/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/WsdlPageTest.java index 935ba0d38fb..e69de29bb2d 100644 --- a/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/WsdlPageTest.java +++ b/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/WsdlPageTest.java @@ -1,132 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.test.platform.plugin.services.webservices; - -import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.engine.AxisConfiguration; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.pentaho.platform.api.engine.IOutputHandler; -import org.pentaho.platform.api.engine.IParameterProvider; -import org.pentaho.platform.engine.core.output.SimpleOutputHandler; -import org.pentaho.platform.engine.core.solution.SimpleParameterProvider; -import org.pentaho.platform.engine.core.system.StandaloneSession; -import org.pentaho.platform.plugin.services.pluginmgr.servicemgr.AxisWebServiceManager; -import org.pentaho.platform.plugin.services.webservices.content.AxisServiceWsdlGenerator; -import org.pentaho.platform.plugin.services.webservices.messages.Messages; -import org.pentaho.platform.util.web.SimpleUrlFactory; - -import java.io.ByteArrayOutputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -public class WsdlPageTest { - - private static final String BASE_URL = "http://testhost:testport/testcontent"; - - private AxisConfiguration beforeTestCfg; - private ConfigurationContext beforeTestCtx; - - private ByteArrayOutputStream out; - private AxisServiceWsdlGenerator contentGenerator; - - @Before - public void setUp() { - beforeTestCfg = AxisWebServiceManager.currentAxisConfiguration; - beforeTestCtx = AxisWebServiceManager.currentAxisConfigContext; - - AxisConfiguration axisCfg = new AxisConfiguration(); - AxisWebServiceManager.currentAxisConfiguration = axisCfg; - AxisWebServiceManager.currentAxisConfigContext = new ConfigurationContext( axisCfg ); - - - out = new ByteArrayOutputStream(); - IOutputHandler outputHandler = new SimpleOutputHandler( out, false ); - outputHandler.setMimeTypeListener( new MimeTypeListener() ); - - StandaloneSession session = new StandaloneSession( "test" ); - StubServiceSetup serviceSetup = new StubServiceSetup(); - serviceSetup.setSession( session ); - - contentGenerator = new AxisServiceWsdlGenerator(); - contentGenerator.setOutputHandler( outputHandler ); - contentGenerator.setMessagesList( new ArrayList() ); - contentGenerator.setSession( session ); - contentGenerator.setUrlFactory( new SimpleUrlFactory( BASE_URL + "?" ) ); - } - - @After - public void tearDown() { - AxisWebServiceManager.currentAxisConfiguration = beforeTestCfg; - AxisWebServiceManager.currentAxisConfigContext = beforeTestCtx; - } - - - @Test - public void testMissingPathParamProvider() throws Exception { - assertNotNull( "Logger is null", contentGenerator.getLogger() ); //$NON-NLS-1$ - - Map parameterProviders = Collections.singletonMap( - IParameterProvider.SCOPE_REQUEST, new SimpleParameterProvider() - ); - - contentGenerator.setParameterProviders( parameterProviders ); - contentGenerator.createContent(); - String content = new String( out.toByteArray() ); - - assertTrue( content, content.contains( Messages.getInstance().getErrorString( - "WebServiceContentGenerator.ERROR_0004_PATH_PARAMS_IS_MISSING" ) ) ); //$NON-NLS-1$ - } - - @Test - public void testMissingServiceName() throws Exception { - assertNotNull( "Logger is null", contentGenerator.getLogger() ); //$NON-NLS-1$ - - Map parameterProviders = new HashMap(); - parameterProviders.put( IParameterProvider.SCOPE_REQUEST, new SimpleParameterProvider() ); - parameterProviders.put( "path", new SimpleParameterProvider() ); //$NON-NLS-1$ - - contentGenerator.setParameterProviders( parameterProviders ); - contentGenerator.createContent(); - String content = new String( out.toByteArray() ); - - assertTrue( content, content.contains( Messages.getInstance().getErrorString( - "WebServiceContentGenerator.ERROR_0005_SERVICE_NAME_IS_MISSING" ) ) ); //$NON-NLS-1$ - } - - @Test - public void testBadServiceName() throws Exception { - assertNotNull( "Logger is null", contentGenerator.getLogger() ); //$NON-NLS-1$ - - Map parameterProviders = new HashMap(); - parameterProviders.put( IParameterProvider.SCOPE_REQUEST, new SimpleParameterProvider() ); - SimpleParameterProvider pathParams = new SimpleParameterProvider(); - pathParams.setParameter( "path", "/bogus" ); //$NON-NLS-1$//$NON-NLS-2$ - parameterProviders.put( "path", pathParams ); //$NON-NLS-1$ - - contentGenerator.setParameterProviders( parameterProviders ); - contentGenerator.createContent(); - String content = new String( out.toByteArray() ); - - assertTrue( content, content.contains( Messages.getInstance().getErrorString( - "WebServiceContentGenerator.ERROR_0006_SERVICE_IS_INVALID", "bogus" ) ) ); //$NON-NLS-1$ //$NON-NLS-2$ - } - -} diff --git a/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/wsdl/SampleServiceRun.java b/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/wsdl/SampleServiceRun.java index 0e016a2d33d..e69de29bb2d 100644 --- a/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/wsdl/SampleServiceRun.java +++ b/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/wsdl/SampleServiceRun.java @@ -1,38 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -package org.pentaho.test.platform.plugin.services.webservices.wsdl; - -import junit.framework.TestCase; - -public class SampleServiceRun extends TestCase { - - public static void main( String[] args ) throws Exception { - - ServiceStub.ComplexType complex = new ServiceStub.ComplexType(); - complex.setName( "fred" ); //$NON-NLS-1$ - - ServiceStub.GetDetails getDetails = new ServiceStub.GetDetails(); - - getDetails.setObject( complex ); - - ServiceStub stub = new ServiceStub(); - - ServiceStub.GetDetailsResponse response = stub.getDetails( getDetails ); - - ServiceStub.ComplexType returnValue = response.get_return(); - assertNotNull( returnValue ); - - } - -} diff --git a/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/wsdl/ServiceStub.java b/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/wsdl/ServiceStub.java index bbabbdc506a..e69de29bb2d 100644 --- a/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/wsdl/ServiceStub.java +++ b/extensions/src/test/java/org/pentaho/test/platform/plugin/services/webservices/wsdl/ServiceStub.java @@ -1,3544 +0,0 @@ -/*! ****************************************************************************** - * - * Pentaho - * - * Copyright (C) 2024 by Hitachi Vantara, LLC : http://www.pentaho.com - * - * Use of this software is governed by the Business Source License included - * in the LICENSE.TXT file. - * - * Change Date: 2028-08-13 - ******************************************************************************/ - - -/** - * StubServiceStub.java - * - * This file was auto-generated from WSDL - * by the Apache Axis2 version: 1.4.1 Built on : Aug 13, 2008 (05:03:35 LKT) - */ - -package org.pentaho.test.platform.plugin.services.webservices.wsdl; - -/* - * StubServiceStub java implementation - */ - -@SuppressWarnings ( { "all" } ) -public class ServiceStub extends org.apache.axis2.client.Stub { - protected org.apache.axis2.description.AxisOperation[] _operations; - - // hashmaps to keep the fault mapping - private java.util.HashMap faultExceptionNameMap = new java.util.HashMap(); - private java.util.HashMap faultExceptionClassNameMap = new java.util.HashMap(); - private java.util.HashMap faultMessageMap = new java.util.HashMap(); - - private static int counter = 0; - - private static synchronized String getUniqueSuffix() { - // reset the counter if it is greater than 99999 - if ( counter > 99999 ) { - counter = 0; - } - counter = counter + 1; - return Long.toString( System.currentTimeMillis() ) + "_" + counter; - } - - private void populateAxisService() throws org.apache.axis2.AxisFault { - - // creating the Service with a unique name - _service = new org.apache.axis2.description.AxisService( "StubService" + getUniqueSuffix() ); - addAnonymousOperations(); - - // creating the operations - org.apache.axis2.description.AxisOperation __operation; - - _operations = new org.apache.axis2.description.AxisOperation[ 5 ]; - - __operation = new org.apache.axis2.description.OutInAxisOperation(); - - __operation.setName( new javax.xml.namespace.QName( "http://test.webservices.pentaho.org", "throwsError2" ) ); - _service.addOperation( __operation ); - - _operations[ 0 ] = __operation; - - __operation = new org.apache.axis2.description.OutInAxisOperation(); - - __operation.setName( new javax.xml.namespace.QName( "http://test.webservices.pentaho.org", "getString" ) ); - _service.addOperation( __operation ); - - _operations[ 1 ] = __operation; - - __operation = new org.apache.axis2.description.OutInAxisOperation(); - - __operation.setName( new javax.xml.namespace.QName( "http://test.webservices.pentaho.org", "getDetails" ) ); - _service.addOperation( __operation ); - - _operations[ 2 ] = __operation; - - __operation = new org.apache.axis2.description.OutOnlyAxisOperation(); - - __operation.setName( new javax.xml.namespace.QName( "http://test.webservices.pentaho.org", "setString" ) ); - _service.addOperation( __operation ); - - _operations[ 3 ] = __operation; - - __operation = new org.apache.axis2.description.OutOnlyAxisOperation(); - - __operation.setName( new javax.xml.namespace.QName( "http://test.webservices.pentaho.org", "throwsError1" ) ); - _service.addOperation( __operation ); - - _operations[ 4 ] = __operation; - - } - - // populates the faults - private void populateFaults() { - - } - - /** - * Constructor that takes in a configContext - */ - - public ServiceStub( org.apache.axis2.context.ConfigurationContext configurationContext, - java.lang.String targetEndpoint ) throws org.apache.axis2.AxisFault { - this( configurationContext, targetEndpoint, false ); - } - - /** - * Constructor that takes in a configContext and useseperate listner - */ - public ServiceStub( org.apache.axis2.context.ConfigurationContext configurationContext, - java.lang.String targetEndpoint, boolean useSeparateListener ) throws org.apache.axis2.AxisFault { - // To populate AxisService - populateAxisService(); - populateFaults(); - - _serviceClient = new org.apache.axis2.client.ServiceClient( configurationContext, _service ); - - configurationContext = _serviceClient.getServiceContext().getConfigurationContext(); - - _serviceClient.getOptions().setTo( new org.apache.axis2.addressing.EndpointReference( targetEndpoint ) ); - _serviceClient.getOptions().setUseSeparateListener( useSeparateListener ); - - // Set the soap version - _serviceClient.getOptions().setSoapVersionURI( org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI ); - - } - - /** - * Default Constructor - */ - public ServiceStub( org.apache.axis2.context.ConfigurationContext configurationContext ) - throws org.apache.axis2.AxisFault { - - this( configurationContext, "http://testhost:8080/testcontext/content/ws-run/StubService" ); - - } - - /** - * Default Constructor - */ - public ServiceStub() throws org.apache.axis2.AxisFault { - - this( "http://testhost:8080/testcontext/content/ws-run/StubService" ); - - } - - /** - * Constructor taking the target endpoint - */ - public ServiceStub( java.lang.String targetEndpoint ) throws org.apache.axis2.AxisFault { - this( null, targetEndpoint ); - } - - /** - * Auto generated method signature - * - * @see org.pentaho.test.platform.plugin.services.webservices.StubService#throwsError2 - */ - - public org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.ThrowsError2Response throwsError2( - - ) - - throws java.rmi.RemoteException { - org.apache.axis2.context.MessageContext _messageContext = null; - try { - org.apache.axis2.client.OperationClient _operationClient = - _serviceClient.createClient( _operations[ 0 ].getName() ); - _operationClient.getOptions().setAction( "urn:throwsError2" ); - _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault( true ); - - addPropertyToOperationClient( _operationClient, - org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, "&" ); - - // create a message context - _messageContext = new org.apache.axis2.context.MessageContext(); - - // create SOAP envelope with that payload - org.apache.axiom.soap.SOAPEnvelope env = null; - - // Style is taken to be "document". No input parameters - // according to the WS-Basic profile in this case we have to send an empty soap message - org.apache.axiom.soap.SOAPFactory factory = getFactory( _operationClient.getOptions().getSoapVersionURI() ); - env = factory.getDefaultEnvelope(); - - // adding SOAP soap_headers - _serviceClient.addHeadersToEnvelope( env ); - // set the message context with that soap envelope - _messageContext.setEnvelope( env ); - - // add the message contxt to the operation client - _operationClient.addMessageContext( _messageContext ); - - // execute the operation client - _operationClient.execute( true ); - - org.apache.axis2.context.MessageContext _returnMessageContext = - _operationClient.getMessageContext( org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE ); - org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope(); - - java.lang.Object object = - fromOM( _returnEnv.getBody().getFirstElement(), - org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.ThrowsError2Response.class, - getEnvelopeNamespaces( _returnEnv ) ); - - return (org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.ThrowsError2Response) object; - - } catch ( org.apache.axis2.AxisFault f ) { - - org.apache.axiom.om.OMElement faultElt = f.getDetail(); - if ( faultElt != null ) { - if ( faultExceptionNameMap.containsKey( faultElt.getQName() ) ) { - // make the fault by reflection - try { - java.lang.String exceptionClassName = - (java.lang.String) faultExceptionClassNameMap.get( faultElt.getQName() ); - java.lang.Class exceptionClass = java.lang.Class.forName( exceptionClassName ); - java.lang.Exception ex = (java.lang.Exception) exceptionClass.newInstance(); - // message class - java.lang.String messageClassName = (java.lang.String) faultMessageMap.get( faultElt.getQName() ); - java.lang.Class messageClass = java.lang.Class.forName( messageClassName ); - java.lang.Object messageObject = fromOM( faultElt, messageClass, null ); - java.lang.reflect.Method m = - exceptionClass.getMethod( "setFaultMessage", new java.lang.Class[] { messageClass } ); - m.invoke( ex, new java.lang.Object[] { messageObject } ); - - throw new java.rmi.RemoteException( ex.getMessage(), ex ); - } catch ( java.lang.ClassCastException e ) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } catch ( java.lang.ClassNotFoundException e ) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } catch ( java.lang.NoSuchMethodException e ) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } catch ( java.lang.reflect.InvocationTargetException e ) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } catch ( java.lang.IllegalAccessException e ) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } catch ( java.lang.InstantiationException e ) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } - } else { - throw f; - } - } else { - throw f; - } - } finally { - _messageContext.getTransportOut().getSender().cleanup( _messageContext ); - } - } - - /** - * Auto generated method signature - * - * @see org.pentaho.test.platform.plugin.services.webservices.StubService#getString - */ - - public org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetStringResponse getString( - - ) - - throws java.rmi.RemoteException { - org.apache.axis2.context.MessageContext _messageContext = null; - try { - org.apache.axis2.client.OperationClient _operationClient = - _serviceClient.createClient( _operations[ 1 ].getName() ); - _operationClient.getOptions().setAction( "urn:getString" ); - _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault( true ); - - addPropertyToOperationClient( _operationClient, - org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, "&" ); - - // create a message context - _messageContext = new org.apache.axis2.context.MessageContext(); - - // create SOAP envelope with that payload - org.apache.axiom.soap.SOAPEnvelope env = null; - - // Style is taken to be "document". No input parameters - // according to the WS-Basic profile in this case we have to send an empty soap message - org.apache.axiom.soap.SOAPFactory factory = getFactory( _operationClient.getOptions().getSoapVersionURI() ); - env = factory.getDefaultEnvelope(); - - // adding SOAP soap_headers - _serviceClient.addHeadersToEnvelope( env ); - // set the message context with that soap envelope - _messageContext.setEnvelope( env ); - - // add the message contxt to the operation client - _operationClient.addMessageContext( _messageContext ); - - // execute the operation client - _operationClient.execute( true ); - - org.apache.axis2.context.MessageContext _returnMessageContext = - _operationClient.getMessageContext( org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE ); - org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope(); - - java.lang.Object object = - fromOM( _returnEnv.getBody().getFirstElement(), - org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetStringResponse.class, - getEnvelopeNamespaces( _returnEnv ) ); - - return (org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetStringResponse) object; - - } catch ( org.apache.axis2.AxisFault f ) { - - org.apache.axiom.om.OMElement faultElt = f.getDetail(); - if ( faultElt != null ) { - if ( faultExceptionNameMap.containsKey( faultElt.getQName() ) ) { - // make the fault by reflection - try { - java.lang.String exceptionClassName = - (java.lang.String) faultExceptionClassNameMap.get( faultElt.getQName() ); - java.lang.Class exceptionClass = java.lang.Class.forName( exceptionClassName ); - java.lang.Exception ex = (java.lang.Exception) exceptionClass.newInstance(); - // message class - java.lang.String messageClassName = (java.lang.String) faultMessageMap.get( faultElt.getQName() ); - java.lang.Class messageClass = java.lang.Class.forName( messageClassName ); - java.lang.Object messageObject = fromOM( faultElt, messageClass, null ); - java.lang.reflect.Method m = - exceptionClass.getMethod( "setFaultMessage", new java.lang.Class[] { messageClass } ); - m.invoke( ex, new java.lang.Object[] { messageObject } ); - - throw new java.rmi.RemoteException( ex.getMessage(), ex ); - } catch ( java.lang.ClassCastException e ) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } catch ( java.lang.ClassNotFoundException e ) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } catch ( java.lang.NoSuchMethodException e ) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } catch ( java.lang.reflect.InvocationTargetException e ) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } catch ( java.lang.IllegalAccessException e ) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } catch ( java.lang.InstantiationException e ) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } - } else { - throw f; - } - } else { - throw f; - } - } finally { - _messageContext.getTransportOut().getSender().cleanup( _messageContext ); - } - } - - /** - * Auto generated method signature - * - * @param getDetails - * @see org.pentaho.test.platform.plugin.services.webservices.StubService#getDetails - */ - - public org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetDetailsResponse getDetails( - - org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetDetails getDetails ) - - throws java.rmi.RemoteException { - org.apache.axis2.context.MessageContext _messageContext = null; - try { - org.apache.axis2.client.OperationClient _operationClient = - _serviceClient.createClient( _operations[ 2 ].getName() ); - _operationClient.getOptions().setAction( "urn:getDetails" ); - _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault( true ); - - addPropertyToOperationClient( _operationClient, - org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, "&" ); - - // create a message context - _messageContext = new org.apache.axis2.context.MessageContext(); - - // create SOAP envelope with that payload - org.apache.axiom.soap.SOAPEnvelope env = null; - - env = - toEnvelope( getFactory( _operationClient.getOptions().getSoapVersionURI() ), getDetails, - optimizeContent( new javax.xml.namespace.QName( "http://test.webservices.pentaho.org", "getDetails" ) ) ); - - // adding SOAP soap_headers - _serviceClient.addHeadersToEnvelope( env ); - // set the message context with that soap envelope - _messageContext.setEnvelope( env ); - - // add the message contxt to the operation client - _operationClient.addMessageContext( _messageContext ); - - // execute the operation client - _operationClient.execute( true ); - - org.apache.axis2.context.MessageContext _returnMessageContext = - _operationClient.getMessageContext( org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE ); - org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope(); - - java.lang.Object object = - fromOM( _returnEnv.getBody().getFirstElement(), - org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetDetailsResponse.class, - getEnvelopeNamespaces( _returnEnv ) ); - - return (org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetDetailsResponse) object; - - } catch ( org.apache.axis2.AxisFault f ) { - - org.apache.axiom.om.OMElement faultElt = f.getDetail(); - if ( faultElt != null ) { - if ( faultExceptionNameMap.containsKey( faultElt.getQName() ) ) { - // make the fault by reflection - try { - java.lang.String exceptionClassName = - (java.lang.String) faultExceptionClassNameMap.get( faultElt.getQName() ); - java.lang.Class exceptionClass = java.lang.Class.forName( exceptionClassName ); - java.lang.Exception ex = (java.lang.Exception) exceptionClass.newInstance(); - // message class - java.lang.String messageClassName = (java.lang.String) faultMessageMap.get( faultElt.getQName() ); - java.lang.Class messageClass = java.lang.Class.forName( messageClassName ); - java.lang.Object messageObject = fromOM( faultElt, messageClass, null ); - java.lang.reflect.Method m = - exceptionClass.getMethod( "setFaultMessage", new java.lang.Class[] { messageClass } ); - m.invoke( ex, new java.lang.Object[] { messageObject } ); - - throw new java.rmi.RemoteException( ex.getMessage(), ex ); - } catch ( java.lang.ClassCastException e ) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } catch ( java.lang.ClassNotFoundException e ) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } catch ( java.lang.NoSuchMethodException e ) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } catch ( java.lang.reflect.InvocationTargetException e ) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } catch ( java.lang.IllegalAccessException e ) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } catch ( java.lang.InstantiationException e ) { - // we cannot intantiate the class - throw the original Axis fault - throw f; - } - } else { - throw f; - } - } else { - throw f; - } - } finally { - _messageContext.getTransportOut().getSender().cleanup( _messageContext ); - } - } - - /** - * Auto generated method signature - */ - public void setString( org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.SetString setString - - ) throws java.rmi.RemoteException { - org.apache.axis2.context.MessageContext _messageContext = null; - - org.apache.axis2.client.OperationClient _operationClient = - _serviceClient.createClient( _operations[ 3 ].getName() ); - _operationClient.getOptions().setAction( "urn:setString" ); - _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault( true ); - - addPropertyToOperationClient( _operationClient, - org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, "&" ); - - org.apache.axiom.soap.SOAPEnvelope env = null; - _messageContext = new org.apache.axis2.context.MessageContext(); - - // Style is Doc. - - env = - toEnvelope( getFactory( _operationClient.getOptions().getSoapVersionURI() ), setString, - optimizeContent( new javax.xml.namespace.QName( "http://test.webservices.pentaho.org", "setString" ) ) ); - - // adding SOAP soap_headers - _serviceClient.addHeadersToEnvelope( env ); - // create message context with that soap envelope - - _messageContext.setEnvelope( env ); - - // add the message contxt to the operation client - _operationClient.addMessageContext( _messageContext ); - - _operationClient.execute( true ); - - _messageContext.getTransportOut().getSender().cleanup( _messageContext ); - - return; - } - - /** - * Auto generated method signature - */ - public void throwsError1( - - ) throws java.rmi.RemoteException { - org.apache.axis2.context.MessageContext _messageContext = null; - - org.apache.axis2.client.OperationClient _operationClient = - _serviceClient.createClient( _operations[ 4 ].getName() ); - _operationClient.getOptions().setAction( "urn:throwsError1" ); - _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault( true ); - - addPropertyToOperationClient( _operationClient, - org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, "&" ); - - org.apache.axiom.soap.SOAPEnvelope env = null; - _messageContext = new org.apache.axis2.context.MessageContext(); - - // Style is taken to be "document". No input parameters - // according to the WS-Basic profile in this case we have to send an empty soap message - org.apache.axiom.soap.SOAPFactory factory = getFactory( _operationClient.getOptions().getSoapVersionURI() ); - env = factory.getDefaultEnvelope(); - - // adding SOAP soap_headers - _serviceClient.addHeadersToEnvelope( env ); - // create message context with that soap envelope - - _messageContext.setEnvelope( env ); - - // add the message contxt to the operation client - _operationClient.addMessageContext( _messageContext ); - - _operationClient.execute( true ); - - _messageContext.getTransportOut().getSender().cleanup( _messageContext ); - - return; - } - - /** - * A utility method that copies the namepaces from the SOAPEnvelope - */ - private java.util.Map getEnvelopeNamespaces( org.apache.axiom.soap.SOAPEnvelope env ) { - java.util.Map returnMap = new java.util.HashMap(); - java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces(); - while ( namespaceIterator.hasNext() ) { - org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next(); - returnMap.put( ns.getPrefix(), ns.getNamespaceURI() ); - } - return returnMap; - } - - private javax.xml.namespace.QName[] opNameArray = null; - - private boolean optimizeContent( javax.xml.namespace.QName opName ) { - - if ( opNameArray == null ) { - return false; - } - for ( int i = 0; i < opNameArray.length; i++ ) { - if ( opName.equals( opNameArray[ i ] ) ) { - return true; - } - } - return false; - } - - // http://testhost:8080/testcontext/content/ws-run/StubService - public static class ComplexType implements org.apache.axis2.databinding.ADBBean { - /* - * This type was generated from the piece of schema that had name = ComplexType Namespace URI = - * http://test.webservices.pentaho.org/xsd Namespace Prefix = ns1 - */ - - private static java.lang.String generatePrefix( java.lang.String namespace ) { - if ( namespace.equals( "http://test.webservices.pentaho.org/xsd" ) ) { - return "ns1"; - } - return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); - } - - /** - * field for Address - */ - - protected java.lang.String localAddress; - - /* - * This tracker boolean wil be used to detect whether the user called the set method for this attribute. It will be - * used to determine whether to include this field in the serialized XML - */ - protected boolean localAddressTracker = false; - - /** - * Auto generated getter method - * - * @return java.lang.String - */ - public java.lang.String getAddress() { - return localAddress; - } - - /** - * Auto generated setter method - * - * @param param Address - */ - public void setAddress( java.lang.String param ) { - - if ( param != null ) { - // update the setting tracker - localAddressTracker = true; - } else { - localAddressTracker = true; - - } - - this.localAddress = param; - - } - - /** - * field for Age - */ - - protected int localAge; - - /* - * This tracker boolean wil be used to detect whether the user called the set method for this attribute. It will be - * used to determine whether to include this field in the serialized XML - */ - protected boolean localAgeTracker = false; - - /** - * Auto generated getter method - * - * @return int - */ - public int getAge() { - return localAge; - } - - /** - * Auto generated setter method - * - * @param param Age - */ - public void setAge( int param ) { - - // setting primitive attribute tracker to true - - if ( param == java.lang.Integer.MIN_VALUE ) { - localAgeTracker = false; - - } else { - localAgeTracker = true; - } - - this.localAge = param; - - } - - /** - * field for Name - */ - - protected java.lang.String localName; - - /* - * This tracker boolean wil be used to detect whether the user called the set method for this attribute. It will be - * used to determine whether to include this field in the serialized XML - */ - protected boolean localNameTracker = false; - - /** - * Auto generated getter method - * - * @return java.lang.String - */ - public java.lang.String getName() { - return localName; - } - - /** - * Auto generated setter method - * - * @param param Name - */ - public void setName( java.lang.String param ) { - - if ( param != null ) { - // update the setting tracker - localNameTracker = true; - } else { - localNameTracker = true; - - } - - this.localName = param; - - } - - /** - * isReaderMTOMAware - * - * @return true if the reader supports MTOM - */ - public static boolean isReaderMTOMAware( javax.xml.stream.XMLStreamReader reader ) { - boolean isReaderMTOMAware = false; - - try { - isReaderMTOMAware = - java.lang.Boolean.TRUE - .equals( reader.getProperty( org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE ) ); - } catch ( java.lang.IllegalArgumentException e ) { - isReaderMTOMAware = false; - } - return isReaderMTOMAware; - } - - /** - * @param parentQName - * @param factory - * @return org.apache.axiom.om.OMElement - */ - public org.apache.axiom.om.OMElement getOMElement( final javax.xml.namespace.QName parentQName, - final org.apache.axiom.om.OMFactory factory ) - throws org.apache.axis2.databinding.ADBException { - - org.apache.axiom.om.OMDataSource dataSource = - new org.apache.axis2.databinding.ADBDataSource( this, parentQName ) { - - public void serialize( org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - ComplexType.this.serialize( parentQName, factory, xmlWriter ); - } - }; - return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( parentQName, factory, dataSource ); - - } - - public void serialize( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, - org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException { - serialize( parentQName, factory, xmlWriter, false ); - } - - public void serialize( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, - org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, - boolean serializeType ) - throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException { - - java.lang.String prefix = null; - java.lang.String namespace = null; - - prefix = parentQName.getPrefix(); - namespace = parentQName.getNamespaceURI(); - - if ( ( namespace != null ) && ( namespace.trim().length() > 0 ) ) { - java.lang.String writerPrefix = xmlWriter.getPrefix( namespace ); - if ( writerPrefix != null ) { - xmlWriter.writeStartElement( namespace, parentQName.getLocalPart() ); - } else { - if ( prefix == null ) { - prefix = generatePrefix( namespace ); - } - - xmlWriter.writeStartElement( prefix, parentQName.getLocalPart(), namespace ); - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - } - } else { - xmlWriter.writeStartElement( parentQName.getLocalPart() ); - } - - if ( serializeType ) { - - java.lang.String namespacePrefix = registerPrefix( xmlWriter, "http://test.webservices.pentaho.org/xsd" ); - if ( ( namespacePrefix != null ) && ( namespacePrefix.trim().length() > 0 ) ) { - writeAttribute( "xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", namespacePrefix + ":ComplexType", - xmlWriter ); - } else { - writeAttribute( "xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", "ComplexType", xmlWriter ); - } - - } - if ( localAddressTracker ) { - namespace = ""; - if ( !namespace.equals( "" ) ) { - prefix = xmlWriter.getPrefix( namespace ); - - if ( prefix == null ) { - prefix = generatePrefix( namespace ); - - xmlWriter.writeStartElement( prefix, "address", namespace ); - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - - } else { - xmlWriter.writeStartElement( namespace, "address" ); - } - - } else { - xmlWriter.writeStartElement( "address" ); - } - - if ( localAddress == null ) { - // write the nil attribute - - writeAttribute( "xsi", "http://www.w3.org/2001/XMLSchema-instance", "nil", "1", xmlWriter ); - - } else { - - xmlWriter.writeCharacters( localAddress ); - - } - - xmlWriter.writeEndElement(); - } - if ( localAgeTracker ) { - namespace = ""; - if ( !namespace.equals( "" ) ) { - prefix = xmlWriter.getPrefix( namespace ); - - if ( prefix == null ) { - prefix = generatePrefix( namespace ); - - xmlWriter.writeStartElement( prefix, "age", namespace ); - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - - } else { - xmlWriter.writeStartElement( namespace, "age" ); - } - - } else { - xmlWriter.writeStartElement( "age" ); - } - - if ( localAge == java.lang.Integer.MIN_VALUE ) { - - throw new org.apache.axis2.databinding.ADBException( "age cannot be null!!" ); - - } else { - xmlWriter.writeCharacters( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( localAge ) ); - } - - xmlWriter.writeEndElement(); - } - if ( localNameTracker ) { - namespace = ""; - if ( !namespace.equals( "" ) ) { - prefix = xmlWriter.getPrefix( namespace ); - - if ( prefix == null ) { - prefix = generatePrefix( namespace ); - - xmlWriter.writeStartElement( prefix, "name", namespace ); - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - - } else { - xmlWriter.writeStartElement( namespace, "name" ); - } - - } else { - xmlWriter.writeStartElement( "name" ); - } - - if ( localName == null ) { - // write the nil attribute - - writeAttribute( "xsi", "http://www.w3.org/2001/XMLSchema-instance", "nil", "1", xmlWriter ); - - } else { - - xmlWriter.writeCharacters( localName ); - - } - - xmlWriter.writeEndElement(); - } - xmlWriter.writeEndElement(); - - } - - /** - * Util method to write an attribute with the ns prefix - */ - private void writeAttribute( java.lang.String prefix, java.lang.String namespace, java.lang.String attName, - java.lang.String attValue, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - if ( xmlWriter.getPrefix( namespace ) == null ) { - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - - } - - xmlWriter.writeAttribute( namespace, attName, attValue ); - - } - - /** - * Util method to write an attribute without the ns prefix - */ - private void writeAttribute( java.lang.String namespace, java.lang.String attName, java.lang.String attValue, - javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - if ( namespace.equals( "" ) ) { - xmlWriter.writeAttribute( attName, attValue ); - } else { - registerPrefix( xmlWriter, namespace ); - xmlWriter.writeAttribute( namespace, attName, attValue ); - } - } - - /** - * Util method to write an attribute without the ns prefix - */ - private void writeQNameAttribute( java.lang.String namespace, java.lang.String attName, - javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - - java.lang.String attributeNamespace = qname.getNamespaceURI(); - java.lang.String attributePrefix = xmlWriter.getPrefix( attributeNamespace ); - if ( attributePrefix == null ) { - attributePrefix = registerPrefix( xmlWriter, attributeNamespace ); - } - java.lang.String attributeValue; - if ( attributePrefix.trim().length() > 0 ) { - attributeValue = attributePrefix + ":" + qname.getLocalPart(); - } else { - attributeValue = qname.getLocalPart(); - } - - if ( namespace.equals( "" ) ) { - xmlWriter.writeAttribute( attName, attributeValue ); - } else { - registerPrefix( xmlWriter, namespace ); - xmlWriter.writeAttribute( namespace, attName, attributeValue ); - } - } - - /** - * method to handle Qnames - */ - - private void writeQName( javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - java.lang.String namespaceURI = qname.getNamespaceURI(); - if ( namespaceURI != null ) { - java.lang.String prefix = xmlWriter.getPrefix( namespaceURI ); - if ( prefix == null ) { - prefix = generatePrefix( namespaceURI ); - xmlWriter.writeNamespace( prefix, namespaceURI ); - xmlWriter.setPrefix( prefix, namespaceURI ); - } - - if ( prefix.trim().length() > 0 ) { - xmlWriter.writeCharacters( prefix + ":" - + org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qname ) ); - } else { - // i.e this is the default namespace - xmlWriter.writeCharacters( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qname ) ); - } - - } else { - xmlWriter.writeCharacters( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qname ) ); - } - } - - private void writeQNames( javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - - if ( qnames != null ) { - // we have to store this data until last moment since it is not possible to write any - // namespace data after writing the charactor data - java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); - java.lang.String namespaceURI = null; - java.lang.String prefix = null; - - for ( int i = 0; i < qnames.length; i++ ) { - if ( i > 0 ) { - stringToWrite.append( " " ); - } - namespaceURI = qnames[ i ].getNamespaceURI(); - if ( namespaceURI != null ) { - prefix = xmlWriter.getPrefix( namespaceURI ); - if ( ( prefix == null ) || ( prefix.length() == 0 ) ) { - prefix = generatePrefix( namespaceURI ); - xmlWriter.writeNamespace( prefix, namespaceURI ); - xmlWriter.setPrefix( prefix, namespaceURI ); - } - - if ( prefix.trim().length() > 0 ) { - stringToWrite.append( prefix ).append( ":" ).append( - org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qnames[ i ] ) ); - } else { - stringToWrite.append( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qnames[ i ] ) ); - } - } else { - stringToWrite.append( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qnames[ i ] ) ); - } - } - xmlWriter.writeCharacters( stringToWrite.toString() ); - } - - } - - /** - * Register a namespace prefix - */ - private java.lang.String registerPrefix( javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace ) - throws javax.xml.stream.XMLStreamException { - java.lang.String prefix = xmlWriter.getPrefix( namespace ); - - if ( prefix == null ) { - prefix = generatePrefix( namespace ); - - while ( xmlWriter.getNamespaceContext().getNamespaceURI( prefix ) != null ) { - prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); - } - - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - } - - return prefix; - } - - /** - * databinding method to get an XML representation of this object - */ - public javax.xml.stream.XMLStreamReader getPullParser( javax.xml.namespace.QName qName ) - throws org.apache.axis2.databinding.ADBException { - - java.util.ArrayList elementList = new java.util.ArrayList(); - java.util.ArrayList attribList = new java.util.ArrayList(); - - if ( localAddressTracker ) { - elementList.add( new javax.xml.namespace.QName( "", "address" ) ); - - elementList.add( localAddress == null ? null : org.apache.axis2.databinding.utils.ConverterUtil - .convertToString( localAddress ) ); - } - if ( localAgeTracker ) { - elementList.add( new javax.xml.namespace.QName( "", "age" ) ); - - elementList.add( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( localAge ) ); - } - if ( localNameTracker ) { - elementList.add( new javax.xml.namespace.QName( "", "name" ) ); - - elementList.add( localName == null ? null : org.apache.axis2.databinding.utils.ConverterUtil - .convertToString( localName ) ); - } - - return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl( qName, elementList.toArray(), - attribList.toArray() ); - - } - - /** - * Factory class that keeps the parse method - */ - public static class Factory { - - /** - * static method to create the object Precondition: If this object is an element, the current or next start - * element starts this object and any intervening reader events are ignorable If this object is not an element, it - * is a complex type and the reader is at the event just after the outer start element Postcondition: If this - * object is an element, the reader is positioned at its end element If this object is a complex type, the reader - * is positioned at the end element of its outer element - */ - public static ComplexType parse( javax.xml.stream.XMLStreamReader reader ) throws java.lang.Exception { - ComplexType object = new ComplexType(); - - int event; - java.lang.String nillableValue = null; - java.lang.String prefix = ""; - java.lang.String namespaceuri = ""; - try { - - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.getAttributeValue( "http://www.w3.org/2001/XMLSchema-instance", "type" ) != null ) { - java.lang.String fullTypeName = - reader.getAttributeValue( "http://www.w3.org/2001/XMLSchema-instance", "type" ); - if ( fullTypeName != null ) { - java.lang.String nsPrefix = null; - if ( fullTypeName.indexOf( ":" ) > -1 ) { - nsPrefix = fullTypeName.substring( 0, fullTypeName.indexOf( ":" ) ); - } - nsPrefix = nsPrefix == null ? "" : nsPrefix; - - java.lang.String type = fullTypeName.substring( fullTypeName.indexOf( ":" ) + 1 ); - - if ( !"ComplexType".equals( type ) ) { - // find namespace for the prefix - java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI( nsPrefix ); - return (ComplexType) ExtensionMapper.getTypeObject( nsUri, type, reader ); - } - - } - - } - - // Note all attributes that were handled. Used to differ normal attributes - // from anyAttributes. - java.util.Vector handledAttributes = new java.util.Vector(); - - reader.next(); - - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.isStartElement() && new javax.xml.namespace.QName( "", "address" ).equals( reader.getName() ) ) { - - nillableValue = reader.getAttributeValue( "http://www.w3.org/2001/XMLSchema-instance", "nil" ); - if ( !"true".equals( nillableValue ) && !"1".equals( nillableValue ) ) { - - java.lang.String content = reader.getElementText(); - - object.setAddress( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( content ) ); - - } else { - - reader.getElementText(); // throw away text nodes if any. - } - - reader.next(); - - } // End of if for expected property start element - - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.isStartElement() && new javax.xml.namespace.QName( "", "age" ).equals( reader.getName() ) ) { - - java.lang.String content = reader.getElementText(); - - object.setAge( org.apache.axis2.databinding.utils.ConverterUtil.convertToInt( content ) ); - - reader.next(); - - } else { - - object.setAge( java.lang.Integer.MIN_VALUE ); - - } - - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.isStartElement() && new javax.xml.namespace.QName( "", "name" ).equals( reader.getName() ) ) { - - nillableValue = reader.getAttributeValue( "http://www.w3.org/2001/XMLSchema-instance", "nil" ); - if ( !"true".equals( nillableValue ) && !"1".equals( nillableValue ) ) { - - java.lang.String content = reader.getElementText(); - - object.setName( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( content ) ); - - } else { - - reader.getElementText(); // throw away text nodes if any. - } - - reader.next(); - - } - - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.isStartElement() ) - // A start element we are not expecting indicates a trailing invalid property - { - throw new org.apache.axis2.databinding.ADBException( "Unexpected subelement " + reader.getLocalName() ); - } - - } catch ( javax.xml.stream.XMLStreamException e ) { - throw new java.lang.Exception( e ); - } - - return object; - } - - } // end of factory class - - } - - public static class ExtensionMapper { - - public static java.lang.Object getTypeObject( java.lang.String namespaceURI, java.lang.String typeName, - javax.xml.stream.XMLStreamReader reader ) throws java.lang.Exception { - - if ( "http://test.webservices.pentaho.org/xsd".equals( namespaceURI ) && "ComplexType".equals( typeName ) ) { - - return ComplexType.Factory.parse( reader ); - - } - - throw new org.apache.axis2.databinding.ADBException( "Unsupported type " + namespaceURI + " " + typeName ); - } - - } - - public static class GetDetailsResponse implements org.apache.axis2.databinding.ADBBean { - - public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName( - "http://webservice.pentaho.com", "getDetailsResponse", "ns2" ); - - private static java.lang.String generatePrefix( java.lang.String namespace ) { - if ( namespace.equals( "http://webservice.pentaho.com" ) ) { - return "ns2"; - } - return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); - } - - /** - * field for _return - */ - - protected ComplexType local_return; - - /* - * This tracker boolean wil be used to detect whether the user called the set method for this attribute. It will be - * used to determine whether to include this field in the serialized XML - */ - protected boolean local_returnTracker = false; - - /** - * Auto generated getter method - * - * @return ComplexType - */ - public ComplexType get_return() { - return local_return; - } - - /** - * Auto generated setter method - * - * @param param _return - */ - public void set_return( ComplexType param ) { - - if ( param != null ) { - // update the setting tracker - local_returnTracker = true; - } else { - local_returnTracker = true; - - } - - this.local_return = param; - - } - - /** - * isReaderMTOMAware - * - * @return true if the reader supports MTOM - */ - public static boolean isReaderMTOMAware( javax.xml.stream.XMLStreamReader reader ) { - boolean isReaderMTOMAware = false; - - try { - isReaderMTOMAware = - java.lang.Boolean.TRUE - .equals( reader.getProperty( org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE ) ); - } catch ( java.lang.IllegalArgumentException e ) { - isReaderMTOMAware = false; - } - return isReaderMTOMAware; - } - - /** - * @param parentQName - * @param factory - * @return org.apache.axiom.om.OMElement - */ - public org.apache.axiom.om.OMElement getOMElement( final javax.xml.namespace.QName parentQName, - final org.apache.axiom.om.OMFactory factory ) - throws org.apache.axis2.databinding.ADBException { - - org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource( this, MY_QNAME ) { - - public void serialize( org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - GetDetailsResponse.this.serialize( MY_QNAME, factory, xmlWriter ); - } - }; - return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( MY_QNAME, factory, dataSource ); - - } - - public void serialize( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, - org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException { - serialize( parentQName, factory, xmlWriter, false ); - } - - public void serialize( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, - org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, - boolean serializeType ) - throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException { - - java.lang.String prefix = null; - java.lang.String namespace = null; - - prefix = parentQName.getPrefix(); - namespace = parentQName.getNamespaceURI(); - - if ( ( namespace != null ) && ( namespace.trim().length() > 0 ) ) { - java.lang.String writerPrefix = xmlWriter.getPrefix( namespace ); - if ( writerPrefix != null ) { - xmlWriter.writeStartElement( namespace, parentQName.getLocalPart() ); - } else { - if ( prefix == null ) { - prefix = generatePrefix( namespace ); - } - - xmlWriter.writeStartElement( prefix, parentQName.getLocalPart(), namespace ); - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - } - } else { - xmlWriter.writeStartElement( parentQName.getLocalPart() ); - } - - if ( serializeType ) { - - java.lang.String namespacePrefix = registerPrefix( xmlWriter, "http://webservice.pentaho.com" ); - if ( ( namespacePrefix != null ) && ( namespacePrefix.trim().length() > 0 ) ) { - writeAttribute( "xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", namespacePrefix - + ":getDetailsResponse", xmlWriter ); - } else { - writeAttribute( "xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", "getDetailsResponse", xmlWriter ); - } - - } - if ( local_returnTracker ) { - if ( local_return == null ) { - - java.lang.String namespace2 = ""; - - if ( !namespace2.equals( "" ) ) { - java.lang.String prefix2 = xmlWriter.getPrefix( namespace2 ); - - if ( prefix2 == null ) { - prefix2 = generatePrefix( namespace2 ); - - xmlWriter.writeStartElement( prefix2, "return", namespace2 ); - xmlWriter.writeNamespace( prefix2, namespace2 ); - xmlWriter.setPrefix( prefix2, namespace2 ); - - } else { - xmlWriter.writeStartElement( namespace2, "return" ); - } - - } else { - xmlWriter.writeStartElement( "return" ); - } - - // write the nil attribute - writeAttribute( "xsi", "http://www.w3.org/2001/XMLSchema-instance", "nil", "1", xmlWriter ); - xmlWriter.writeEndElement(); - } else { - local_return.serialize( new javax.xml.namespace.QName( "", "return" ), factory, xmlWriter ); - } - } - xmlWriter.writeEndElement(); - - } - - /** - * Util method to write an attribute with the ns prefix - */ - private void writeAttribute( java.lang.String prefix, java.lang.String namespace, java.lang.String attName, - java.lang.String attValue, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - if ( xmlWriter.getPrefix( namespace ) == null ) { - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - - } - - xmlWriter.writeAttribute( namespace, attName, attValue ); - - } - - /** - * Util method to write an attribute without the ns prefix - */ - private void writeAttribute( java.lang.String namespace, java.lang.String attName, java.lang.String attValue, - javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - if ( namespace.equals( "" ) ) { - xmlWriter.writeAttribute( attName, attValue ); - } else { - registerPrefix( xmlWriter, namespace ); - xmlWriter.writeAttribute( namespace, attName, attValue ); - } - } - - /** - * Util method to write an attribute without the ns prefix - */ - private void writeQNameAttribute( java.lang.String namespace, java.lang.String attName, - javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - - java.lang.String attributeNamespace = qname.getNamespaceURI(); - java.lang.String attributePrefix = xmlWriter.getPrefix( attributeNamespace ); - if ( attributePrefix == null ) { - attributePrefix = registerPrefix( xmlWriter, attributeNamespace ); - } - java.lang.String attributeValue; - if ( attributePrefix.trim().length() > 0 ) { - attributeValue = attributePrefix + ":" + qname.getLocalPart(); - } else { - attributeValue = qname.getLocalPart(); - } - - if ( namespace.equals( "" ) ) { - xmlWriter.writeAttribute( attName, attributeValue ); - } else { - registerPrefix( xmlWriter, namespace ); - xmlWriter.writeAttribute( namespace, attName, attributeValue ); - } - } - - /** - * method to handle Qnames - */ - - private void writeQName( javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - java.lang.String namespaceURI = qname.getNamespaceURI(); - if ( namespaceURI != null ) { - java.lang.String prefix = xmlWriter.getPrefix( namespaceURI ); - if ( prefix == null ) { - prefix = generatePrefix( namespaceURI ); - xmlWriter.writeNamespace( prefix, namespaceURI ); - xmlWriter.setPrefix( prefix, namespaceURI ); - } - - if ( prefix.trim().length() > 0 ) { - xmlWriter.writeCharacters( prefix + ":" - + org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qname ) ); - } else { - // i.e this is the default namespace - xmlWriter.writeCharacters( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qname ) ); - } - - } else { - xmlWriter.writeCharacters( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qname ) ); - } - } - - private void writeQNames( javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - - if ( qnames != null ) { - // we have to store this data until last moment since it is not possible to write any - // namespace data after writing the charactor data - java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); - java.lang.String namespaceURI = null; - java.lang.String prefix = null; - - for ( int i = 0; i < qnames.length; i++ ) { - if ( i > 0 ) { - stringToWrite.append( " " ); - } - namespaceURI = qnames[ i ].getNamespaceURI(); - if ( namespaceURI != null ) { - prefix = xmlWriter.getPrefix( namespaceURI ); - if ( ( prefix == null ) || ( prefix.length() == 0 ) ) { - prefix = generatePrefix( namespaceURI ); - xmlWriter.writeNamespace( prefix, namespaceURI ); - xmlWriter.setPrefix( prefix, namespaceURI ); - } - - if ( prefix.trim().length() > 0 ) { - stringToWrite.append( prefix ).append( ":" ).append( - org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qnames[ i ] ) ); - } else { - stringToWrite.append( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qnames[ i ] ) ); - } - } else { - stringToWrite.append( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qnames[ i ] ) ); - } - } - xmlWriter.writeCharacters( stringToWrite.toString() ); - } - - } - - /** - * Register a namespace prefix - */ - private java.lang.String registerPrefix( javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace ) - throws javax.xml.stream.XMLStreamException { - java.lang.String prefix = xmlWriter.getPrefix( namespace ); - - if ( prefix == null ) { - prefix = generatePrefix( namespace ); - - while ( xmlWriter.getNamespaceContext().getNamespaceURI( prefix ) != null ) { - prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); - } - - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - } - - return prefix; - } - - /** - * databinding method to get an XML representation of this object - */ - public javax.xml.stream.XMLStreamReader getPullParser( javax.xml.namespace.QName qName ) - throws org.apache.axis2.databinding.ADBException { - - java.util.ArrayList elementList = new java.util.ArrayList(); - java.util.ArrayList attribList = new java.util.ArrayList(); - - if ( local_returnTracker ) { - elementList.add( new javax.xml.namespace.QName( "", "return" ) ); - - elementList.add( local_return == null ? null : local_return ); - } - - return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl( qName, elementList.toArray(), - attribList.toArray() ); - - } - - /** - * Factory class that keeps the parse method - */ - public static class Factory { - - /** - * static method to create the object Precondition: If this object is an element, the current or next start - * element starts this object and any intervening reader events are ignorable If this object is not an element, it - * is a complex type and the reader is at the event just after the outer start element Postcondition: If this - * object is an element, the reader is positioned at its end element If this object is a complex type, the reader - * is positioned at the end element of its outer element - */ - public static GetDetailsResponse parse( javax.xml.stream.XMLStreamReader reader ) throws java.lang.Exception { - GetDetailsResponse object = new GetDetailsResponse(); - - int event; - java.lang.String nillableValue = null; - java.lang.String prefix = ""; - java.lang.String namespaceuri = ""; - try { - - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.getAttributeValue( "http://www.w3.org/2001/XMLSchema-instance", "type" ) != null ) { - java.lang.String fullTypeName = - reader.getAttributeValue( "http://www.w3.org/2001/XMLSchema-instance", "type" ); - if ( fullTypeName != null ) { - java.lang.String nsPrefix = null; - if ( fullTypeName.indexOf( ":" ) > -1 ) { - nsPrefix = fullTypeName.substring( 0, fullTypeName.indexOf( ":" ) ); - } - nsPrefix = nsPrefix == null ? "" : nsPrefix; - - java.lang.String type = fullTypeName.substring( fullTypeName.indexOf( ":" ) + 1 ); - - if ( !"getDetailsResponse".equals( type ) ) { - // find namespace for the prefix - java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI( nsPrefix ); - return (GetDetailsResponse) ExtensionMapper.getTypeObject( nsUri, type, reader ); - } - - } - - } - - // Note all attributes that were handled. Used to differ normal attributes - // from anyAttributes. - java.util.Vector handledAttributes = new java.util.Vector(); - - reader.next(); - - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.isStartElement() && new javax.xml.namespace.QName( "", "return" ).equals( reader.getName() ) ) { - - nillableValue = reader.getAttributeValue( "http://www.w3.org/2001/XMLSchema-instance", "nil" ); - if ( "true".equals( nillableValue ) || "1".equals( nillableValue ) ) { - object.set_return( null ); - reader.next(); - - reader.next(); - - } else { - - object.set_return( ComplexType.Factory.parse( reader ) ); - - reader.next(); - } - } - - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.isStartElement() ) - // A start element we are not expecting indicates a trailing invalid property - { - throw new org.apache.axis2.databinding.ADBException( "Unexpected subelement " + reader.getLocalName() ); - } - - } catch ( javax.xml.stream.XMLStreamException e ) { - throw new java.lang.Exception( e ); - } - - return object; - } - - } // end of factory class - - } - - public static class GetStringResponse implements org.apache.axis2.databinding.ADBBean { - - public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName( - "http://webservice.pentaho.com", "getStringResponse", "ns2" ); - - private static java.lang.String generatePrefix( java.lang.String namespace ) { - if ( namespace.equals( "http://webservice.pentaho.com" ) ) { - return "ns2"; - } - return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); - } - - /** - * field for _return - */ - - protected java.lang.String local_return; - - /* - * This tracker boolean wil be used to detect whether the user called the set method for this attribute. It will be - * used to determine whether to include this field in the serialized XML - */ - protected boolean local_returnTracker = false; - - /** - * Auto generated getter method - * - * @return java.lang.String - */ - public java.lang.String get_return() { - return local_return; - } - - /** - * Auto generated setter method - * - * @param param _return - */ - public void set_return( java.lang.String param ) { - - if ( param != null ) { - // update the setting tracker - local_returnTracker = true; - } else { - local_returnTracker = true; - - } - - this.local_return = param; - - } - - /** - * isReaderMTOMAware - * - * @return true if the reader supports MTOM - */ - public static boolean isReaderMTOMAware( javax.xml.stream.XMLStreamReader reader ) { - boolean isReaderMTOMAware = false; - - try { - isReaderMTOMAware = - java.lang.Boolean.TRUE - .equals( reader.getProperty( org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE ) ); - } catch ( java.lang.IllegalArgumentException e ) { - isReaderMTOMAware = false; - } - return isReaderMTOMAware; - } - - /** - * @param parentQName - * @param factory - * @return org.apache.axiom.om.OMElement - */ - public org.apache.axiom.om.OMElement getOMElement( final javax.xml.namespace.QName parentQName, - final org.apache.axiom.om.OMFactory factory ) - throws org.apache.axis2.databinding.ADBException { - - org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource( this, MY_QNAME ) { - - public void serialize( org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - GetStringResponse.this.serialize( MY_QNAME, factory, xmlWriter ); - } - }; - return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( MY_QNAME, factory, dataSource ); - - } - - public void serialize( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, - org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException { - serialize( parentQName, factory, xmlWriter, false ); - } - - public void serialize( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, - org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, - boolean serializeType ) - throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException { - - java.lang.String prefix = null; - java.lang.String namespace = null; - - prefix = parentQName.getPrefix(); - namespace = parentQName.getNamespaceURI(); - - if ( ( namespace != null ) && ( namespace.trim().length() > 0 ) ) { - java.lang.String writerPrefix = xmlWriter.getPrefix( namespace ); - if ( writerPrefix != null ) { - xmlWriter.writeStartElement( namespace, parentQName.getLocalPart() ); - } else { - if ( prefix == null ) { - prefix = generatePrefix( namespace ); - } - - xmlWriter.writeStartElement( prefix, parentQName.getLocalPart(), namespace ); - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - } - } else { - xmlWriter.writeStartElement( parentQName.getLocalPart() ); - } - - if ( serializeType ) { - - java.lang.String namespacePrefix = registerPrefix( xmlWriter, "http://webservice.pentaho.com" ); - if ( ( namespacePrefix != null ) && ( namespacePrefix.trim().length() > 0 ) ) { - writeAttribute( "xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", namespacePrefix - + ":getStringResponse", xmlWriter ); - } else { - writeAttribute( "xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", "getStringResponse", xmlWriter ); - } - - } - if ( local_returnTracker ) { - namespace = ""; - if ( !namespace.equals( "" ) ) { - prefix = xmlWriter.getPrefix( namespace ); - - if ( prefix == null ) { - prefix = generatePrefix( namespace ); - - xmlWriter.writeStartElement( prefix, "return", namespace ); - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - - } else { - xmlWriter.writeStartElement( namespace, "return" ); - } - - } else { - xmlWriter.writeStartElement( "return" ); - } - - if ( local_return == null ) { - // write the nil attribute - - writeAttribute( "xsi", "http://www.w3.org/2001/XMLSchema-instance", "nil", "1", xmlWriter ); - - } else { - - xmlWriter.writeCharacters( local_return ); - - } - - xmlWriter.writeEndElement(); - } - xmlWriter.writeEndElement(); - - } - - /** - * Util method to write an attribute with the ns prefix - */ - private void writeAttribute( java.lang.String prefix, java.lang.String namespace, java.lang.String attName, - java.lang.String attValue, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - if ( xmlWriter.getPrefix( namespace ) == null ) { - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - - } - - xmlWriter.writeAttribute( namespace, attName, attValue ); - - } - - /** - * Util method to write an attribute without the ns prefix - */ - private void writeAttribute( java.lang.String namespace, java.lang.String attName, java.lang.String attValue, - javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - if ( namespace.equals( "" ) ) { - xmlWriter.writeAttribute( attName, attValue ); - } else { - registerPrefix( xmlWriter, namespace ); - xmlWriter.writeAttribute( namespace, attName, attValue ); - } - } - - /** - * Util method to write an attribute without the ns prefix - */ - private void writeQNameAttribute( java.lang.String namespace, java.lang.String attName, - javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - - java.lang.String attributeNamespace = qname.getNamespaceURI(); - java.lang.String attributePrefix = xmlWriter.getPrefix( attributeNamespace ); - if ( attributePrefix == null ) { - attributePrefix = registerPrefix( xmlWriter, attributeNamespace ); - } - java.lang.String attributeValue; - if ( attributePrefix.trim().length() > 0 ) { - attributeValue = attributePrefix + ":" + qname.getLocalPart(); - } else { - attributeValue = qname.getLocalPart(); - } - - if ( namespace.equals( "" ) ) { - xmlWriter.writeAttribute( attName, attributeValue ); - } else { - registerPrefix( xmlWriter, namespace ); - xmlWriter.writeAttribute( namespace, attName, attributeValue ); - } - } - - /** - * method to handle Qnames - */ - - private void writeQName( javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - java.lang.String namespaceURI = qname.getNamespaceURI(); - if ( namespaceURI != null ) { - java.lang.String prefix = xmlWriter.getPrefix( namespaceURI ); - if ( prefix == null ) { - prefix = generatePrefix( namespaceURI ); - xmlWriter.writeNamespace( prefix, namespaceURI ); - xmlWriter.setPrefix( prefix, namespaceURI ); - } - - if ( prefix.trim().length() > 0 ) { - xmlWriter.writeCharacters( prefix + ":" - + org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qname ) ); - } else { - // i.e this is the default namespace - xmlWriter.writeCharacters( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qname ) ); - } - - } else { - xmlWriter.writeCharacters( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qname ) ); - } - } - - private void writeQNames( javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - - if ( qnames != null ) { - // we have to store this data until last moment since it is not possible to write any - // namespace data after writing the charactor data - java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); - java.lang.String namespaceURI = null; - java.lang.String prefix = null; - - for ( int i = 0; i < qnames.length; i++ ) { - if ( i > 0 ) { - stringToWrite.append( " " ); - } - namespaceURI = qnames[ i ].getNamespaceURI(); - if ( namespaceURI != null ) { - prefix = xmlWriter.getPrefix( namespaceURI ); - if ( ( prefix == null ) || ( prefix.length() == 0 ) ) { - prefix = generatePrefix( namespaceURI ); - xmlWriter.writeNamespace( prefix, namespaceURI ); - xmlWriter.setPrefix( prefix, namespaceURI ); - } - - if ( prefix.trim().length() > 0 ) { - stringToWrite.append( prefix ).append( ":" ).append( - org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qnames[ i ] ) ); - } else { - stringToWrite.append( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qnames[ i ] ) ); - } - } else { - stringToWrite.append( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qnames[ i ] ) ); - } - } - xmlWriter.writeCharacters( stringToWrite.toString() ); - } - - } - - /** - * Register a namespace prefix - */ - private java.lang.String registerPrefix( javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace ) - throws javax.xml.stream.XMLStreamException { - java.lang.String prefix = xmlWriter.getPrefix( namespace ); - - if ( prefix == null ) { - prefix = generatePrefix( namespace ); - - while ( xmlWriter.getNamespaceContext().getNamespaceURI( prefix ) != null ) { - prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); - } - - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - } - - return prefix; - } - - /** - * databinding method to get an XML representation of this object - */ - public javax.xml.stream.XMLStreamReader getPullParser( javax.xml.namespace.QName qName ) - throws org.apache.axis2.databinding.ADBException { - - java.util.ArrayList elementList = new java.util.ArrayList(); - java.util.ArrayList attribList = new java.util.ArrayList(); - - if ( local_returnTracker ) { - elementList.add( new javax.xml.namespace.QName( "", "return" ) ); - - elementList.add( local_return == null ? null : org.apache.axis2.databinding.utils.ConverterUtil - .convertToString( local_return ) ); - } - - return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl( qName, elementList.toArray(), - attribList.toArray() ); - - } - - /** - * Factory class that keeps the parse method - */ - public static class Factory { - - /** - * static method to create the object Precondition: If this object is an element, the current or next start - * element starts this object and any intervening reader events are ignorable If this object is not an element, it - * is a complex type and the reader is at the event just after the outer start element Postcondition: If this - * object is an element, the reader is positioned at its end element If this object is a complex type, the reader - * is positioned at the end element of its outer element - */ - public static GetStringResponse parse( javax.xml.stream.XMLStreamReader reader ) throws java.lang.Exception { - GetStringResponse object = new GetStringResponse(); - - int event; - java.lang.String nillableValue = null; - java.lang.String prefix = ""; - java.lang.String namespaceuri = ""; - try { - - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.getAttributeValue( "http://www.w3.org/2001/XMLSchema-instance", "type" ) != null ) { - java.lang.String fullTypeName = - reader.getAttributeValue( "http://www.w3.org/2001/XMLSchema-instance", "type" ); - if ( fullTypeName != null ) { - java.lang.String nsPrefix = null; - if ( fullTypeName.indexOf( ":" ) > -1 ) { - nsPrefix = fullTypeName.substring( 0, fullTypeName.indexOf( ":" ) ); - } - nsPrefix = nsPrefix == null ? "" : nsPrefix; - - java.lang.String type = fullTypeName.substring( fullTypeName.indexOf( ":" ) + 1 ); - - if ( !"getStringResponse".equals( type ) ) { - // find namespace for the prefix - java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI( nsPrefix ); - return (GetStringResponse) ExtensionMapper.getTypeObject( nsUri, type, reader ); - } - - } - - } - - // Note all attributes that were handled. Used to differ normal attributes - // from anyAttributes. - java.util.Vector handledAttributes = new java.util.Vector(); - - reader.next(); - - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.isStartElement() && new javax.xml.namespace.QName( "", "return" ).equals( reader.getName() ) ) { - - nillableValue = reader.getAttributeValue( "http://www.w3.org/2001/XMLSchema-instance", "nil" ); - if ( !"true".equals( nillableValue ) && !"1".equals( nillableValue ) ) { - - java.lang.String content = reader.getElementText(); - - object.set_return( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( content ) ); - - } else { - - reader.getElementText(); // throw away text nodes if any. - } - - reader.next(); - - } - - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.isStartElement() ) - // A start element we are not expecting indicates a trailing invalid property - { - throw new org.apache.axis2.databinding.ADBException( "Unexpected subelement " + reader.getLocalName() ); - } - - } catch ( javax.xml.stream.XMLStreamException e ) { - throw new java.lang.Exception( e ); - } - - return object; - } - - } // end of factory class - - } - - public static class SetString implements org.apache.axis2.databinding.ADBBean { - - public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName( - "http://webservice.pentaho.com", "setString", "ns2" ); - - private static java.lang.String generatePrefix( java.lang.String namespace ) { - if ( namespace.equals( "http://webservice.pentaho.com" ) ) { - return "ns2"; - } - return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); - } - - /** - * field for Str - */ - - protected java.lang.String localStr; - - /* - * This tracker boolean wil be used to detect whether the user called the set method for this attribute. It will be - * used to determine whether to include this field in the serialized XML - */ - protected boolean localStrTracker = false; - - /** - * Auto generated getter method - * - * @return java.lang.String - */ - public java.lang.String getStr() { - return localStr; - } - - /** - * Auto generated setter method - * - * @param param Str - */ - public void setStr( java.lang.String param ) { - - if ( param != null ) { - // update the setting tracker - localStrTracker = true; - } else { - localStrTracker = true; - - } - - this.localStr = param; - - } - - /** - * isReaderMTOMAware - * - * @return true if the reader supports MTOM - */ - public static boolean isReaderMTOMAware( javax.xml.stream.XMLStreamReader reader ) { - boolean isReaderMTOMAware = false; - - try { - isReaderMTOMAware = - java.lang.Boolean.TRUE - .equals( reader.getProperty( org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE ) ); - } catch ( java.lang.IllegalArgumentException e ) { - isReaderMTOMAware = false; - } - return isReaderMTOMAware; - } - - /** - * @param parentQName - * @param factory - * @return org.apache.axiom.om.OMElement - */ - public org.apache.axiom.om.OMElement getOMElement( final javax.xml.namespace.QName parentQName, - final org.apache.axiom.om.OMFactory factory ) - throws org.apache.axis2.databinding.ADBException { - - org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource( this, MY_QNAME ) { - - public void serialize( org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - SetString.this.serialize( MY_QNAME, factory, xmlWriter ); - } - }; - return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( MY_QNAME, factory, dataSource ); - - } - - public void serialize( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, - org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException { - serialize( parentQName, factory, xmlWriter, false ); - } - - public void serialize( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, - org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, - boolean serializeType ) - throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException { - - java.lang.String prefix = null; - java.lang.String namespace = null; - - prefix = parentQName.getPrefix(); - namespace = parentQName.getNamespaceURI(); - - if ( ( namespace != null ) && ( namespace.trim().length() > 0 ) ) { - java.lang.String writerPrefix = xmlWriter.getPrefix( namespace ); - if ( writerPrefix != null ) { - xmlWriter.writeStartElement( namespace, parentQName.getLocalPart() ); - } else { - if ( prefix == null ) { - prefix = generatePrefix( namespace ); - } - - xmlWriter.writeStartElement( prefix, parentQName.getLocalPart(), namespace ); - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - } - } else { - xmlWriter.writeStartElement( parentQName.getLocalPart() ); - } - - if ( serializeType ) { - - java.lang.String namespacePrefix = registerPrefix( xmlWriter, "http://webservice.pentaho.com" ); - if ( ( namespacePrefix != null ) && ( namespacePrefix.trim().length() > 0 ) ) { - writeAttribute( "xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", namespacePrefix + ":setString", - xmlWriter ); - } else { - writeAttribute( "xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", "setString", xmlWriter ); - } - - } - if ( localStrTracker ) { - namespace = ""; - if ( !namespace.equals( "" ) ) { - prefix = xmlWriter.getPrefix( namespace ); - - if ( prefix == null ) { - prefix = generatePrefix( namespace ); - - xmlWriter.writeStartElement( prefix, "str", namespace ); - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - - } else { - xmlWriter.writeStartElement( namespace, "str" ); - } - - } else { - xmlWriter.writeStartElement( "str" ); - } - - if ( localStr == null ) { - // write the nil attribute - - writeAttribute( "xsi", "http://www.w3.org/2001/XMLSchema-instance", "nil", "1", xmlWriter ); - - } else { - - xmlWriter.writeCharacters( localStr ); - - } - - xmlWriter.writeEndElement(); - } - xmlWriter.writeEndElement(); - - } - - /** - * Util method to write an attribute with the ns prefix - */ - private void writeAttribute( java.lang.String prefix, java.lang.String namespace, java.lang.String attName, - java.lang.String attValue, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - if ( xmlWriter.getPrefix( namespace ) == null ) { - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - - } - - xmlWriter.writeAttribute( namespace, attName, attValue ); - - } - - /** - * Util method to write an attribute without the ns prefix - */ - private void writeAttribute( java.lang.String namespace, java.lang.String attName, java.lang.String attValue, - javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - if ( namespace.equals( "" ) ) { - xmlWriter.writeAttribute( attName, attValue ); - } else { - registerPrefix( xmlWriter, namespace ); - xmlWriter.writeAttribute( namespace, attName, attValue ); - } - } - - /** - * Util method to write an attribute without the ns prefix - */ - private void writeQNameAttribute( java.lang.String namespace, java.lang.String attName, - javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - - java.lang.String attributeNamespace = qname.getNamespaceURI(); - java.lang.String attributePrefix = xmlWriter.getPrefix( attributeNamespace ); - if ( attributePrefix == null ) { - attributePrefix = registerPrefix( xmlWriter, attributeNamespace ); - } - java.lang.String attributeValue; - if ( attributePrefix.trim().length() > 0 ) { - attributeValue = attributePrefix + ":" + qname.getLocalPart(); - } else { - attributeValue = qname.getLocalPart(); - } - - if ( namespace.equals( "" ) ) { - xmlWriter.writeAttribute( attName, attributeValue ); - } else { - registerPrefix( xmlWriter, namespace ); - xmlWriter.writeAttribute( namespace, attName, attributeValue ); - } - } - - /** - * method to handle Qnames - */ - - private void writeQName( javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - java.lang.String namespaceURI = qname.getNamespaceURI(); - if ( namespaceURI != null ) { - java.lang.String prefix = xmlWriter.getPrefix( namespaceURI ); - if ( prefix == null ) { - prefix = generatePrefix( namespaceURI ); - xmlWriter.writeNamespace( prefix, namespaceURI ); - xmlWriter.setPrefix( prefix, namespaceURI ); - } - - if ( prefix.trim().length() > 0 ) { - xmlWriter.writeCharacters( prefix + ":" - + org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qname ) ); - } else { - // i.e this is the default namespace - xmlWriter.writeCharacters( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qname ) ); - } - - } else { - xmlWriter.writeCharacters( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qname ) ); - } - } - - private void writeQNames( javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - - if ( qnames != null ) { - // we have to store this data until last moment since it is not possible to write any - // namespace data after writing the charactor data - java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); - java.lang.String namespaceURI = null; - java.lang.String prefix = null; - - for ( int i = 0; i < qnames.length; i++ ) { - if ( i > 0 ) { - stringToWrite.append( " " ); - } - namespaceURI = qnames[ i ].getNamespaceURI(); - if ( namespaceURI != null ) { - prefix = xmlWriter.getPrefix( namespaceURI ); - if ( ( prefix == null ) || ( prefix.length() == 0 ) ) { - prefix = generatePrefix( namespaceURI ); - xmlWriter.writeNamespace( prefix, namespaceURI ); - xmlWriter.setPrefix( prefix, namespaceURI ); - } - - if ( prefix.trim().length() > 0 ) { - stringToWrite.append( prefix ).append( ":" ).append( - org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qnames[ i ] ) ); - } else { - stringToWrite.append( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qnames[ i ] ) ); - } - } else { - stringToWrite.append( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qnames[ i ] ) ); - } - } - xmlWriter.writeCharacters( stringToWrite.toString() ); - } - - } - - /** - * Register a namespace prefix - */ - private java.lang.String registerPrefix( javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace ) - throws javax.xml.stream.XMLStreamException { - java.lang.String prefix = xmlWriter.getPrefix( namespace ); - - if ( prefix == null ) { - prefix = generatePrefix( namespace ); - - while ( xmlWriter.getNamespaceContext().getNamespaceURI( prefix ) != null ) { - prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); - } - - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - } - - return prefix; - } - - /** - * databinding method to get an XML representation of this object - */ - public javax.xml.stream.XMLStreamReader getPullParser( javax.xml.namespace.QName qName ) - throws org.apache.axis2.databinding.ADBException { - - java.util.ArrayList elementList = new java.util.ArrayList(); - java.util.ArrayList attribList = new java.util.ArrayList(); - - if ( localStrTracker ) { - elementList.add( new javax.xml.namespace.QName( "", "str" ) ); - - elementList.add( localStr == null ? null : org.apache.axis2.databinding.utils.ConverterUtil - .convertToString( localStr ) ); - } - - return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl( qName, elementList.toArray(), - attribList.toArray() ); - - } - - /** - * Factory class that keeps the parse method - */ - public static class Factory { - - /** - * static method to create the object Precondition: If this object is an element, the current or next start - * element starts this object and any intervening reader events are ignorable If this object is not an element, it - * is a complex type and the reader is at the event just after the outer start element Postcondition: If this - * object is an element, the reader is positioned at its end element If this object is a complex type, the reader - * is positioned at the end element of its outer element - */ - public static SetString parse( javax.xml.stream.XMLStreamReader reader ) throws java.lang.Exception { - SetString object = new SetString(); - - int event; - java.lang.String nillableValue = null; - java.lang.String prefix = ""; - java.lang.String namespaceuri = ""; - try { - - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.getAttributeValue( "http://www.w3.org/2001/XMLSchema-instance", "type" ) != null ) { - java.lang.String fullTypeName = - reader.getAttributeValue( "http://www.w3.org/2001/XMLSchema-instance", "type" ); - if ( fullTypeName != null ) { - java.lang.String nsPrefix = null; - if ( fullTypeName.indexOf( ":" ) > -1 ) { - nsPrefix = fullTypeName.substring( 0, fullTypeName.indexOf( ":" ) ); - } - nsPrefix = nsPrefix == null ? "" : nsPrefix; - - java.lang.String type = fullTypeName.substring( fullTypeName.indexOf( ":" ) + 1 ); - - if ( !"setString".equals( type ) ) { - // find namespace for the prefix - java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI( nsPrefix ); - return (SetString) ExtensionMapper.getTypeObject( nsUri, type, reader ); - } - - } - - } - - // Note all attributes that were handled. Used to differ normal attributes - // from anyAttributes. - java.util.Vector handledAttributes = new java.util.Vector(); - - reader.next(); - - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.isStartElement() && new javax.xml.namespace.QName( "", "str" ).equals( reader.getName() ) ) { - - nillableValue = reader.getAttributeValue( "http://www.w3.org/2001/XMLSchema-instance", "nil" ); - if ( !"true".equals( nillableValue ) && !"1".equals( nillableValue ) ) { - - java.lang.String content = reader.getElementText(); - - object.setStr( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( content ) ); - - } else { - - reader.getElementText(); // throw away text nodes if any. - } - - reader.next(); - - } - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.isStartElement() ) - // A start element we are not expecting indicates a trailing invalid property - { - throw new org.apache.axis2.databinding.ADBException( "Unexpected subelement " + reader.getLocalName() ); - } - - } catch ( javax.xml.stream.XMLStreamException e ) { - throw new java.lang.Exception( e ); - } - - return object; - } - - } // end of factory class - - } - - public static class ThrowsError2Response implements org.apache.axis2.databinding.ADBBean { - - public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName( - "http://webservice.pentaho.com", "throwsError2Response", "ns2" ); - - private static java.lang.String generatePrefix( java.lang.String namespace ) { - if ( namespace.equals( "http://webservice.pentaho.com" ) ) { - return "ns2"; - } - return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); - } - - /** - * field for _return - */ - - protected java.lang.String local_return; - - /* - * This tracker boolean wil be used to detect whether the user called the set method for this attribute. It will be - * used to determine whether to include this field in the serialized XML - */ - protected boolean local_returnTracker = false; - - /** - * Auto generated getter method - * - * @return java.lang.String - */ - public java.lang.String get_return() { - return local_return; - } - - /** - * Auto generated setter method - * - * @param param _return - */ - public void set_return( java.lang.String param ) { - - if ( param != null ) { - // update the setting tracker - local_returnTracker = true; - } else { - local_returnTracker = true; - - } - - this.local_return = param; - - } - - /** - * isReaderMTOMAware - * - * @return true if the reader supports MTOM - */ - public static boolean isReaderMTOMAware( javax.xml.stream.XMLStreamReader reader ) { - boolean isReaderMTOMAware = false; - - try { - isReaderMTOMAware = - java.lang.Boolean.TRUE - .equals( reader.getProperty( org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE ) ); - } catch ( java.lang.IllegalArgumentException e ) { - isReaderMTOMAware = false; - } - return isReaderMTOMAware; - } - - /** - * @param parentQName - * @param factory - * @return org.apache.axiom.om.OMElement - */ - public org.apache.axiom.om.OMElement getOMElement( final javax.xml.namespace.QName parentQName, - final org.apache.axiom.om.OMFactory factory ) - throws org.apache.axis2.databinding.ADBException { - - org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource( this, MY_QNAME ) { - - public void serialize( org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - ThrowsError2Response.this.serialize( MY_QNAME, factory, xmlWriter ); - } - }; - return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( MY_QNAME, factory, dataSource ); - - } - - public void serialize( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, - org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException { - serialize( parentQName, factory, xmlWriter, false ); - } - - public void serialize( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, - org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, - boolean serializeType ) - throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException { - - java.lang.String prefix = null; - java.lang.String namespace = null; - - prefix = parentQName.getPrefix(); - namespace = parentQName.getNamespaceURI(); - - if ( ( namespace != null ) && ( namespace.trim().length() > 0 ) ) { - java.lang.String writerPrefix = xmlWriter.getPrefix( namespace ); - if ( writerPrefix != null ) { - xmlWriter.writeStartElement( namespace, parentQName.getLocalPart() ); - } else { - if ( prefix == null ) { - prefix = generatePrefix( namespace ); - } - - xmlWriter.writeStartElement( prefix, parentQName.getLocalPart(), namespace ); - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - } - } else { - xmlWriter.writeStartElement( parentQName.getLocalPart() ); - } - - if ( serializeType ) { - - java.lang.String namespacePrefix = registerPrefix( xmlWriter, "http://webservice.pentaho.com" ); - if ( ( namespacePrefix != null ) && ( namespacePrefix.trim().length() > 0 ) ) { - writeAttribute( "xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", namespacePrefix - + ":throwsError2Response", xmlWriter ); - } else { - writeAttribute( "xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", "throwsError2Response", - xmlWriter ); - } - - } - if ( local_returnTracker ) { - namespace = ""; - if ( !namespace.equals( "" ) ) { - prefix = xmlWriter.getPrefix( namespace ); - - if ( prefix == null ) { - prefix = generatePrefix( namespace ); - - xmlWriter.writeStartElement( prefix, "return", namespace ); - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - - } else { - xmlWriter.writeStartElement( namespace, "return" ); - } - - } else { - xmlWriter.writeStartElement( "return" ); - } - - if ( local_return == null ) { - // write the nil attribute - - writeAttribute( "xsi", "http://www.w3.org/2001/XMLSchema-instance", "nil", "1", xmlWriter ); - - } else { - - xmlWriter.writeCharacters( local_return ); - - } - - xmlWriter.writeEndElement(); - } - xmlWriter.writeEndElement(); - - } - - /** - * Util method to write an attribute with the ns prefix - */ - private void writeAttribute( java.lang.String prefix, java.lang.String namespace, java.lang.String attName, - java.lang.String attValue, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - if ( xmlWriter.getPrefix( namespace ) == null ) { - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - - } - - xmlWriter.writeAttribute( namespace, attName, attValue ); - - } - - /** - * Util method to write an attribute without the ns prefix - */ - private void writeAttribute( java.lang.String namespace, java.lang.String attName, java.lang.String attValue, - javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - if ( namespace.equals( "" ) ) { - xmlWriter.writeAttribute( attName, attValue ); - } else { - registerPrefix( xmlWriter, namespace ); - xmlWriter.writeAttribute( namespace, attName, attValue ); - } - } - - /** - * Util method to write an attribute without the ns prefix - */ - private void writeQNameAttribute( java.lang.String namespace, java.lang.String attName, - javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - - java.lang.String attributeNamespace = qname.getNamespaceURI(); - java.lang.String attributePrefix = xmlWriter.getPrefix( attributeNamespace ); - if ( attributePrefix == null ) { - attributePrefix = registerPrefix( xmlWriter, attributeNamespace ); - } - java.lang.String attributeValue; - if ( attributePrefix.trim().length() > 0 ) { - attributeValue = attributePrefix + ":" + qname.getLocalPart(); - } else { - attributeValue = qname.getLocalPart(); - } - - if ( namespace.equals( "" ) ) { - xmlWriter.writeAttribute( attName, attributeValue ); - } else { - registerPrefix( xmlWriter, namespace ); - xmlWriter.writeAttribute( namespace, attName, attributeValue ); - } - } - - /** - * method to handle Qnames - */ - - private void writeQName( javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - java.lang.String namespaceURI = qname.getNamespaceURI(); - if ( namespaceURI != null ) { - java.lang.String prefix = xmlWriter.getPrefix( namespaceURI ); - if ( prefix == null ) { - prefix = generatePrefix( namespaceURI ); - xmlWriter.writeNamespace( prefix, namespaceURI ); - xmlWriter.setPrefix( prefix, namespaceURI ); - } - - if ( prefix.trim().length() > 0 ) { - xmlWriter.writeCharacters( prefix + ":" - + org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qname ) ); - } else { - // i.e this is the default namespace - xmlWriter.writeCharacters( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qname ) ); - } - - } else { - xmlWriter.writeCharacters( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qname ) ); - } - } - - private void writeQNames( javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - - if ( qnames != null ) { - // we have to store this data until last moment since it is not possible to write any - // namespace data after writing the charactor data - java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); - java.lang.String namespaceURI = null; - java.lang.String prefix = null; - - for ( int i = 0; i < qnames.length; i++ ) { - if ( i > 0 ) { - stringToWrite.append( " " ); - } - namespaceURI = qnames[ i ].getNamespaceURI(); - if ( namespaceURI != null ) { - prefix = xmlWriter.getPrefix( namespaceURI ); - if ( ( prefix == null ) || ( prefix.length() == 0 ) ) { - prefix = generatePrefix( namespaceURI ); - xmlWriter.writeNamespace( prefix, namespaceURI ); - xmlWriter.setPrefix( prefix, namespaceURI ); - } - - if ( prefix.trim().length() > 0 ) { - stringToWrite.append( prefix ).append( ":" ).append( - org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qnames[ i ] ) ); - } else { - stringToWrite.append( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qnames[ i ] ) ); - } - } else { - stringToWrite.append( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qnames[ i ] ) ); - } - } - xmlWriter.writeCharacters( stringToWrite.toString() ); - } - - } - - /** - * Register a namespace prefix - */ - private java.lang.String registerPrefix( javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace ) - throws javax.xml.stream.XMLStreamException { - java.lang.String prefix = xmlWriter.getPrefix( namespace ); - - if ( prefix == null ) { - prefix = generatePrefix( namespace ); - - while ( xmlWriter.getNamespaceContext().getNamespaceURI( prefix ) != null ) { - prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); - } - - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - } - - return prefix; - } - - /** - * databinding method to get an XML representation of this object - */ - public javax.xml.stream.XMLStreamReader getPullParser( javax.xml.namespace.QName qName ) - throws org.apache.axis2.databinding.ADBException { - - java.util.ArrayList elementList = new java.util.ArrayList(); - java.util.ArrayList attribList = new java.util.ArrayList(); - - if ( local_returnTracker ) { - elementList.add( new javax.xml.namespace.QName( "", "return" ) ); - - elementList.add( local_return == null ? null : org.apache.axis2.databinding.utils.ConverterUtil - .convertToString( local_return ) ); - } - - return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl( qName, elementList.toArray(), - attribList.toArray() ); - - } - - /** - * Factory class that keeps the parse method - */ - public static class Factory { - - /** - * static method to create the object Precondition: If this object is an element, the current or next start - * element starts this object and any intervening reader events are ignorable If this object is not an element, it - * is a complex type and the reader is at the event just after the outer start element Postcondition: If this - * object is an element, the reader is positioned at its end element If this object is a complex type, the reader - * is positioned at the end element of its outer element - */ - public static ThrowsError2Response parse( javax.xml.stream.XMLStreamReader reader ) throws java.lang.Exception { - ThrowsError2Response object = new ThrowsError2Response(); - - int event; - java.lang.String nillableValue = null; - java.lang.String prefix = ""; - java.lang.String namespaceuri = ""; - try { - - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.getAttributeValue( "http://www.w3.org/2001/XMLSchema-instance", "type" ) != null ) { - java.lang.String fullTypeName = - reader.getAttributeValue( "http://www.w3.org/2001/XMLSchema-instance", "type" ); - if ( fullTypeName != null ) { - java.lang.String nsPrefix = null; - if ( fullTypeName.indexOf( ":" ) > -1 ) { - nsPrefix = fullTypeName.substring( 0, fullTypeName.indexOf( ":" ) ); - } - nsPrefix = nsPrefix == null ? "" : nsPrefix; - - java.lang.String type = fullTypeName.substring( fullTypeName.indexOf( ":" ) + 1 ); - - if ( !"throwsError2Response".equals( type ) ) { - // find namespace for the prefix - java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI( nsPrefix ); - return (ThrowsError2Response) ExtensionMapper.getTypeObject( nsUri, type, reader ); - } - - } - - } - - // Note all attributes that were handled. Used to differ normal attributes - // from anyAttributes. - java.util.Vector handledAttributes = new java.util.Vector(); - - reader.next(); - - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.isStartElement() && new javax.xml.namespace.QName( "", "return" ).equals( reader.getName() ) ) { - - nillableValue = reader.getAttributeValue( "http://www.w3.org/2001/XMLSchema-instance", "nil" ); - if ( !"true".equals( nillableValue ) && !"1".equals( nillableValue ) ) { - - java.lang.String content = reader.getElementText(); - - object.set_return( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( content ) ); - - } else { - - reader.getElementText(); // throw away text nodes if any. - } - - reader.next(); - - } - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.isStartElement() ) - // A start element we are not expecting indicates a trailing invalid property - { - throw new org.apache.axis2.databinding.ADBException( "Unexpected subelement " + reader.getLocalName() ); - } - - } catch ( javax.xml.stream.XMLStreamException e ) { - throw new java.lang.Exception( e ); - } - - return object; - } - - } // end of factory class - - } - - public static class GetDetails implements org.apache.axis2.databinding.ADBBean { - - public static final javax.xml.namespace.QName MY_QNAME = new javax.xml.namespace.QName( - "http://webservice.pentaho.com", "getDetails", "ns2" ); - - private static java.lang.String generatePrefix( java.lang.String namespace ) { - if ( namespace.equals( "http://webservice.pentaho.com" ) ) { - return "ns2"; - } - return org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); - } - - /** - * field for Object - */ - - protected ComplexType localObject; - - /* - * This tracker boolean wil be used to detect whether the user called the set method for this attribute. It will be - * used to determine whether to include this field in the serialized XML - */ - protected boolean localObjectTracker = false; - - /** - * Auto generated getter method - * - * @return ComplexType - */ - public ComplexType getObject() { - return localObject; - } - - /** - * Auto generated setter method - * - * @param param Object - */ - public void setObject( ComplexType param ) { - - if ( param != null ) { - // update the setting tracker - localObjectTracker = true; - } else { - localObjectTracker = true; - - } - - this.localObject = param; - - } - - /** - * isReaderMTOMAware - * - * @return true if the reader supports MTOM - */ - public static boolean isReaderMTOMAware( javax.xml.stream.XMLStreamReader reader ) { - boolean isReaderMTOMAware = false; - - try { - isReaderMTOMAware = - java.lang.Boolean.TRUE - .equals( reader.getProperty( org.apache.axiom.om.OMConstants.IS_DATA_HANDLERS_AWARE ) ); - } catch ( java.lang.IllegalArgumentException e ) { - isReaderMTOMAware = false; - } - return isReaderMTOMAware; - } - - /** - * @param parentQName - * @param factory - * @return org.apache.axiom.om.OMElement - */ - public org.apache.axiom.om.OMElement getOMElement( final javax.xml.namespace.QName parentQName, - final org.apache.axiom.om.OMFactory factory ) - throws org.apache.axis2.databinding.ADBException { - - org.apache.axiom.om.OMDataSource dataSource = new org.apache.axis2.databinding.ADBDataSource( this, MY_QNAME ) { - - public void serialize( org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - GetDetails.this.serialize( MY_QNAME, factory, xmlWriter ); - } - }; - return new org.apache.axiom.om.impl.llom.OMSourcedElementImpl( MY_QNAME, factory, dataSource ); - - } - - public void serialize( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, - org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException { - serialize( parentQName, factory, xmlWriter, false ); - } - - public void serialize( final javax.xml.namespace.QName parentQName, final org.apache.axiom.om.OMFactory factory, - org.apache.axis2.databinding.utils.writer.MTOMAwareXMLStreamWriter xmlWriter, - boolean serializeType ) - throws javax.xml.stream.XMLStreamException, org.apache.axis2.databinding.ADBException { - - java.lang.String prefix = null; - java.lang.String namespace = null; - - prefix = parentQName.getPrefix(); - namespace = parentQName.getNamespaceURI(); - - if ( ( namespace != null ) && ( namespace.trim().length() > 0 ) ) { - java.lang.String writerPrefix = xmlWriter.getPrefix( namespace ); - if ( writerPrefix != null ) { - xmlWriter.writeStartElement( namespace, parentQName.getLocalPart() ); - } else { - if ( prefix == null ) { - prefix = generatePrefix( namespace ); - } - - xmlWriter.writeStartElement( prefix, parentQName.getLocalPart(), namespace ); - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - } - } else { - xmlWriter.writeStartElement( parentQName.getLocalPart() ); - } - - if ( serializeType ) { - - java.lang.String namespacePrefix = registerPrefix( xmlWriter, "http://webservice.pentaho.com" ); - if ( ( namespacePrefix != null ) && ( namespacePrefix.trim().length() > 0 ) ) { - writeAttribute( "xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", namespacePrefix + ":getDetails", - xmlWriter ); - } else { - writeAttribute( "xsi", "http://www.w3.org/2001/XMLSchema-instance", "type", "getDetails", xmlWriter ); - } - - } - if ( localObjectTracker ) { - if ( localObject == null ) { - - java.lang.String namespace2 = ""; - - if ( !namespace2.equals( "" ) ) { - java.lang.String prefix2 = xmlWriter.getPrefix( namespace2 ); - - if ( prefix2 == null ) { - prefix2 = generatePrefix( namespace2 ); - - xmlWriter.writeStartElement( prefix2, "object", namespace2 ); - xmlWriter.writeNamespace( prefix2, namespace2 ); - xmlWriter.setPrefix( prefix2, namespace2 ); - - } else { - xmlWriter.writeStartElement( namespace2, "object" ); - } - - } else { - xmlWriter.writeStartElement( "object" ); - } - - // write the nil attribute - writeAttribute( "xsi", "http://www.w3.org/2001/XMLSchema-instance", "nil", "1", xmlWriter ); - xmlWriter.writeEndElement(); - } else { - localObject.serialize( new javax.xml.namespace.QName( "", "object" ), factory, xmlWriter ); - } - } - xmlWriter.writeEndElement(); - - } - - /** - * Util method to write an attribute with the ns prefix - */ - private void writeAttribute( java.lang.String prefix, java.lang.String namespace, java.lang.String attName, - java.lang.String attValue, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - if ( xmlWriter.getPrefix( namespace ) == null ) { - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - - } - - xmlWriter.writeAttribute( namespace, attName, attValue ); - - } - - /** - * Util method to write an attribute without the ns prefix - */ - private void writeAttribute( java.lang.String namespace, java.lang.String attName, java.lang.String attValue, - javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - if ( namespace.equals( "" ) ) { - xmlWriter.writeAttribute( attName, attValue ); - } else { - registerPrefix( xmlWriter, namespace ); - xmlWriter.writeAttribute( namespace, attName, attValue ); - } - } - - /** - * Util method to write an attribute without the ns prefix - */ - private void writeQNameAttribute( java.lang.String namespace, java.lang.String attName, - javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - - java.lang.String attributeNamespace = qname.getNamespaceURI(); - java.lang.String attributePrefix = xmlWriter.getPrefix( attributeNamespace ); - if ( attributePrefix == null ) { - attributePrefix = registerPrefix( xmlWriter, attributeNamespace ); - } - java.lang.String attributeValue; - if ( attributePrefix.trim().length() > 0 ) { - attributeValue = attributePrefix + ":" + qname.getLocalPart(); - } else { - attributeValue = qname.getLocalPart(); - } - - if ( namespace.equals( "" ) ) { - xmlWriter.writeAttribute( attName, attributeValue ); - } else { - registerPrefix( xmlWriter, namespace ); - xmlWriter.writeAttribute( namespace, attName, attributeValue ); - } - } - - /** - * method to handle Qnames - */ - - private void writeQName( javax.xml.namespace.QName qname, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - java.lang.String namespaceURI = qname.getNamespaceURI(); - if ( namespaceURI != null ) { - java.lang.String prefix = xmlWriter.getPrefix( namespaceURI ); - if ( prefix == null ) { - prefix = generatePrefix( namespaceURI ); - xmlWriter.writeNamespace( prefix, namespaceURI ); - xmlWriter.setPrefix( prefix, namespaceURI ); - } - - if ( prefix.trim().length() > 0 ) { - xmlWriter.writeCharacters( prefix + ":" - + org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qname ) ); - } else { - // i.e this is the default namespace - xmlWriter.writeCharacters( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qname ) ); - } - - } else { - xmlWriter.writeCharacters( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qname ) ); - } - } - - private void writeQNames( javax.xml.namespace.QName[] qnames, javax.xml.stream.XMLStreamWriter xmlWriter ) - throws javax.xml.stream.XMLStreamException { - - if ( qnames != null ) { - // we have to store this data until last moment since it is not possible to write any - // namespace data after writing the charactor data - java.lang.StringBuffer stringToWrite = new java.lang.StringBuffer(); - java.lang.String namespaceURI = null; - java.lang.String prefix = null; - - for ( int i = 0; i < qnames.length; i++ ) { - if ( i > 0 ) { - stringToWrite.append( " " ); - } - namespaceURI = qnames[ i ].getNamespaceURI(); - if ( namespaceURI != null ) { - prefix = xmlWriter.getPrefix( namespaceURI ); - if ( ( prefix == null ) || ( prefix.length() == 0 ) ) { - prefix = generatePrefix( namespaceURI ); - xmlWriter.writeNamespace( prefix, namespaceURI ); - xmlWriter.setPrefix( prefix, namespaceURI ); - } - - if ( prefix.trim().length() > 0 ) { - stringToWrite.append( prefix ).append( ":" ).append( - org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qnames[ i ] ) ); - } else { - stringToWrite.append( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qnames[ i ] ) ); - } - } else { - stringToWrite.append( org.apache.axis2.databinding.utils.ConverterUtil.convertToString( qnames[ i ] ) ); - } - } - xmlWriter.writeCharacters( stringToWrite.toString() ); - } - - } - - /** - * Register a namespace prefix - */ - private java.lang.String registerPrefix( javax.xml.stream.XMLStreamWriter xmlWriter, java.lang.String namespace ) - throws javax.xml.stream.XMLStreamException { - java.lang.String prefix = xmlWriter.getPrefix( namespace ); - - if ( prefix == null ) { - prefix = generatePrefix( namespace ); - - while ( xmlWriter.getNamespaceContext().getNamespaceURI( prefix ) != null ) { - prefix = org.apache.axis2.databinding.utils.BeanUtil.getUniquePrefix(); - } - - xmlWriter.writeNamespace( prefix, namespace ); - xmlWriter.setPrefix( prefix, namespace ); - } - - return prefix; - } - - /** - * databinding method to get an XML representation of this object - */ - public javax.xml.stream.XMLStreamReader getPullParser( javax.xml.namespace.QName qName ) - throws org.apache.axis2.databinding.ADBException { - - java.util.ArrayList elementList = new java.util.ArrayList(); - java.util.ArrayList attribList = new java.util.ArrayList(); - - if ( localObjectTracker ) { - elementList.add( new javax.xml.namespace.QName( "", "object" ) ); - - elementList.add( localObject == null ? null : localObject ); - } - - return new org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl( qName, elementList.toArray(), - attribList.toArray() ); - - } - - /** - * Factory class that keeps the parse method - */ - public static class Factory { - - /** - * static method to create the object Precondition: If this object is an element, the current or next start - * element starts this object and any intervening reader events are ignorable If this object is not an element, it - * is a complex type and the reader is at the event just after the outer start element Postcondition: If this - * object is an element, the reader is positioned at its end element If this object is a complex type, the reader - * is positioned at the end element of its outer element - */ - public static GetDetails parse( javax.xml.stream.XMLStreamReader reader ) throws java.lang.Exception { - GetDetails object = new GetDetails(); - - int event; - java.lang.String nillableValue = null; - java.lang.String prefix = ""; - java.lang.String namespaceuri = ""; - try { - - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.getAttributeValue( "http://www.w3.org/2001/XMLSchema-instance", "type" ) != null ) { - java.lang.String fullTypeName = - reader.getAttributeValue( "http://www.w3.org/2001/XMLSchema-instance", "type" ); - if ( fullTypeName != null ) { - java.lang.String nsPrefix = null; - if ( fullTypeName.indexOf( ":" ) > -1 ) { - nsPrefix = fullTypeName.substring( 0, fullTypeName.indexOf( ":" ) ); - } - nsPrefix = nsPrefix == null ? "" : nsPrefix; - - java.lang.String type = fullTypeName.substring( fullTypeName.indexOf( ":" ) + 1 ); - - if ( !"getDetails".equals( type ) ) { - // find namespace for the prefix - java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI( nsPrefix ); - return (GetDetails) ExtensionMapper.getTypeObject( nsUri, type, reader ); - } - - } - - } - - // Note all attributes that were handled. Used to differ normal attributes - // from anyAttributes. - java.util.Vector handledAttributes = new java.util.Vector(); - - reader.next(); - - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.isStartElement() && new javax.xml.namespace.QName( "", "object" ).equals( reader.getName() ) ) { - - nillableValue = reader.getAttributeValue( "http://www.w3.org/2001/XMLSchema-instance", "nil" ); - if ( "true".equals( nillableValue ) || "1".equals( nillableValue ) ) { - object.setObject( null ); - reader.next(); - - reader.next(); - - } else { - - object.setObject( ComplexType.Factory.parse( reader ) ); - - reader.next(); - } - } - while ( !reader.isStartElement() && !reader.isEndElement() ) { - reader.next(); - } - - if ( reader.isStartElement() ) - // A start element we are not expecting indicates a trailing invalid property - { - throw new org.apache.axis2.databinding.ADBException( "Unexpected subelement " + reader.getLocalName() ); - } - - } catch ( javax.xml.stream.XMLStreamException e ) { - throw new java.lang.Exception( e ); - } - - return object; - } - - } // end of factory class - } - - private org.apache.axiom.om.OMElement toOM( - org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.ThrowsError2Response param, - boolean optimizeContent ) throws org.apache.axis2.AxisFault { - - try { - return param.getOMElement( - org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.ThrowsError2Response.MY_QNAME, - org.apache.axiom.om.OMAbstractFactory.getOMFactory() ); - } catch ( org.apache.axis2.databinding.ADBException e ) { - throw org.apache.axis2.AxisFault.makeFault( e ); - } - - } - - private org.apache.axiom.om.OMElement toOM( - org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetStringResponse param, - boolean optimizeContent ) throws org.apache.axis2.AxisFault { - - try { - return param.getOMElement( - org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetStringResponse.MY_QNAME, - org.apache.axiom.om.OMAbstractFactory.getOMFactory() ); - } catch ( org.apache.axis2.databinding.ADBException e ) { - throw org.apache.axis2.AxisFault.makeFault( e ); - } - - } - - private org.apache.axiom.om.OMElement toOM( - org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetDetails param, boolean optimizeContent ) - throws org.apache.axis2.AxisFault { - - try { - return param.getOMElement( - org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetDetails.MY_QNAME, - org.apache.axiom.om.OMAbstractFactory.getOMFactory() ); - } catch ( org.apache.axis2.databinding.ADBException e ) { - throw org.apache.axis2.AxisFault.makeFault( e ); - } - - } - - private org.apache.axiom.om.OMElement toOM( - org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetDetailsResponse param, - boolean optimizeContent ) throws org.apache.axis2.AxisFault { - - try { - return param.getOMElement( - org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetDetailsResponse.MY_QNAME, - org.apache.axiom.om.OMAbstractFactory.getOMFactory() ); - } catch ( org.apache.axis2.databinding.ADBException e ) { - throw org.apache.axis2.AxisFault.makeFault( e ); - } - - } - - private org.apache.axiom.om.OMElement toOM( - org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.SetString param, boolean optimizeContent ) - throws org.apache.axis2.AxisFault { - - try { - return param.getOMElement( - org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.SetString.MY_QNAME, - org.apache.axiom.om.OMAbstractFactory.getOMFactory() ); - } catch ( org.apache.axis2.databinding.ADBException e ) { - throw org.apache.axis2.AxisFault.makeFault( e ); - } - - } - - private org.apache.axiom.soap.SOAPEnvelope toEnvelope( org.apache.axiom.soap.SOAPFactory factory, - org.pentaho.test.platform.plugin.services.webservices.wsdl - .ServiceStub.GetDetails param, - boolean optimizeContent ) - throws org.apache.axis2.AxisFault { - - try { - - org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope(); - emptyEnvelope.getBody().addChild( - param.getOMElement( - org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetDetails.MY_QNAME, factory ) ); - return emptyEnvelope; - } catch ( org.apache.axis2.databinding.ADBException e ) { - throw org.apache.axis2.AxisFault.makeFault( e ); - } - - } - - /* methods to provide back word compatibility */ - - private org.apache.axiom.soap.SOAPEnvelope toEnvelope( org.apache.axiom.soap.SOAPFactory factory, - org.pentaho.test.platform.plugin.services.webservices.wsdl - .ServiceStub.SetString param, - boolean optimizeContent ) - throws org.apache.axis2.AxisFault { - - try { - - org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope(); - emptyEnvelope.getBody().addChild( - param.getOMElement( - org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.SetString.MY_QNAME, factory ) ); - return emptyEnvelope; - } catch ( org.apache.axis2.databinding.ADBException e ) { - throw org.apache.axis2.AxisFault.makeFault( e ); - } - - } - - /* methods to provide back word compatibility */ - - /** - * get the default envelope - */ - private org.apache.axiom.soap.SOAPEnvelope toEnvelope( org.apache.axiom.soap.SOAPFactory factory ) { - return factory.getDefaultEnvelope(); - } - - private java.lang.Object fromOM( org.apache.axiom.om.OMElement param, java.lang.Class type, - java.util.Map extraNamespaces ) throws org.apache.axis2.AxisFault { - - try { - - if ( org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.ThrowsError2Response.class - .equals( type ) ) { - - return org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.ThrowsError2Response.Factory - .parse( param.getXMLStreamReaderWithoutCaching() ); - - } - - if ( org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetStringResponse.class - .equals( type ) ) { - - return org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetStringResponse.Factory - .parse( param.getXMLStreamReaderWithoutCaching() ); - - } - - if ( org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetDetails.class.equals( type ) ) { - - return org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetDetails.Factory.parse( param - .getXMLStreamReaderWithoutCaching() ); - - } - - if ( org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetDetailsResponse.class - .equals( type ) ) { - - return org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.GetDetailsResponse.Factory - .parse( param.getXMLStreamReaderWithoutCaching() ); - - } - - if ( org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.SetString.class.equals( type ) ) { - - return org.pentaho.test.platform.plugin.services.webservices.wsdl.ServiceStub.SetString.Factory.parse( param - .getXMLStreamReaderWithoutCaching() ); - - } - - } catch ( java.lang.Exception e ) { - throw org.apache.axis2.AxisFault.makeFault( e ); - } - return null; - } - -} diff --git a/extensions/src/test/resources/AxisWebServiceManagerTest/system/axis/axis2_config.xml b/extensions/src/test/resources/AxisWebServiceManagerTest/system/axis/axis2_config.xml deleted file mode 100644 index 5fd3c6fe1ee..00000000000 --- a/extensions/src/test/resources/AxisWebServiceManagerTest/system/axis/axis2_config.xml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - true - false - false - - - false - - - - true - - - - - - false - - - admin - axis2 - - - - - - - - - - - - - - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6060 - - - - - - - - - - - - - - - - - - - - - - HTTP/1.1 - chunked - - - HTTP/1.1 - chunked - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/extensions/src/test/resources/AxisWebServiceManagerTest/system/axis/themes.xml b/extensions/src/test/resources/AxisWebServiceManagerTest/system/axis/themes.xml deleted file mode 100644 index a0e48d4def7..00000000000 --- a/extensions/src/test/resources/AxisWebServiceManagerTest/system/axis/themes.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - styles.css - - \ No newline at end of file diff --git a/extensions/src/test/resources/AxisWebServiceManagerTest/system/axis/themes/onyx/styles.css b/extensions/src/test/resources/AxisWebServiceManagerTest/system/axis/themes/onyx/styles.css deleted file mode 100644 index f6c201085d6..00000000000 --- a/extensions/src/test/resources/AxisWebServiceManagerTest/system/axis/themes/onyx/styles.css +++ /dev/null @@ -1,3 +0,0 @@ -.h1 { - -} \ No newline at end of file diff --git a/extensions/src/test/resources/PluginManagerTest/system/axis/axis2_config.xml b/extensions/src/test/resources/PluginManagerTest/system/axis/axis2_config.xml deleted file mode 100644 index c906e6ffb61..00000000000 --- a/extensions/src/test/resources/PluginManagerTest/system/axis/axis2_config.xml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - true - false - false - - - false - - - - true - - - - - - false - - - admin - axis2 - - - - - - - - - - - - - - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6060 - - - - - - - - - - - - - - - - - - - - - - HTTP/1.1 - chunked - - - HTTP/1.1 - chunked - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/extensions/src/test/resources/webservices-solution/system/axis2_config.xml b/extensions/src/test/resources/webservices-solution/system/axis2_config.xml deleted file mode 100644 index 4aac1e7caaf..00000000000 --- a/extensions/src/test/resources/webservices-solution/system/axis2_config.xml +++ /dev/null @@ -1,279 +0,0 @@ - - - - - - - true - false - false - - - false - - - - true - - - - - - false - - - admin - axis2 - - - - - - - - - - - - - - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6060 - - - - - - - - - - - - - - - - - - - - - HTTP/1.1 - chunked - - - HTTP/1.1 - chunked - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/pom.xml b/pom.xml index b878d504e7f..00103afc1a1 100644 --- a/pom.xml +++ b/pom.xml @@ -63,7 +63,6 @@ 0.9.46 0.9 1.1 - 1.5 1.9.3 0.9.15 4.0.0 diff --git a/repository/src/test/resources/solution/system/data/hibernate.properties b/repository/src/test/resources/solution/system/data/hibernate.properties index 110bff575a0..fc9f4c2fe41 100644 --- a/repository/src/test/resources/solution/system/data/hibernate.properties +++ b/repository/src/test/resources/solution/system/data/hibernate.properties @@ -1,5 +1,5 @@ #HSQL Database Engine 1.8.0.5 -#Wed Oct 04 12:47:30 EDT 2023 +#Mon Nov 18 15:59:40 CST 2024 hsqldb.cache_version=1.7.0 sql.enforce_strict_size=false hsqldb.compatible_version=1.8.0