com.sap.cloud.sdk.s4hana.connectivity.soap.Axis2CustomConverterListener Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of soap Show documentation
Show all versions of soap Show documentation
SOAP queries for SAP S/4HANA.
/*
* Copyright (c) 2018 SAP SE or an SAP affiliate company. All rights reserved.
*/
package com.sap.cloud.sdk.s4hana.connectivity.soap;
import javax.annotation.Nonnull;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import org.apache.axis2.databinding.utils.ConverterUtil;
import org.slf4j.Logger;
import com.sap.cloud.sdk.cloudplatform.logging.CloudLoggerFactory;
/**
* Servlet listener that is responsible for registering a default custom converter class in the Axis2 framework.
*/
@WebListener
public class Axis2CustomConverterListener implements ServletContextListener
{
private static final Logger logger = CloudLoggerFactory.getLogger(Axis2CustomConverterListener.class);
@Override
public void contextInitialized( @Nonnull final ServletContextEvent servletContextEvent )
{
registerCustomConverterForSoap(SoapCustomConverter.class);
}
@Override
public void contextDestroyed( @Nonnull final ServletContextEvent servletContextEvent )
{
}
private void registerCustomConverterForSoap( final Class extends ConverterUtil> converterClass )
{
try {
SoapQuery.registerCustomConverter(converterClass);
if( logger.isInfoEnabled() ) {
logger.info(
"Axis2 Custom Converter Class " + converterClass.getSimpleName() + " registered during startup.");
}
}
catch( final SoapException e ) {
logger.error(
"Error during registering Axis2 Custom Converter Class "
+ converterClass.getSimpleName()
+ ": "
+ e.getMessage(),
e);
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy