You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Thomas Grabietz <to...@toms-toy.de> on 2011/10/13 11:52:37 UTC

Parameter.setParameterElement(OMElement element) fails (1.60 & 1.61)

Hello All,

I'm trying to configure the service.xml dynamicly in axis 1.60 & 1.61

The first modification of the "serviceClass" works.
The second modification "InflowSecurity" is a litte bit more complex,
because the parameter is an XML Element. This parameter works when I put
it staticly in the service.xml but fails when I try to configure it by
the serviceUpdate listener.

org.apache.axis2.AxisFault: Must Understand check failed for header
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
: Security

Any ideas?

Regards Tom




public class ConfigurationObserver extends ParameterIncludeImpl
implements AxisObserver
{


	@Override
	public void serviceUpdate(AxisEvent axisEvent, AxisService axisService)
	{

		if (axisService.getName().equals("level5Service"))
		{
			//works
			String serviceClass = "org.vip_eu.level5Service.service.Server";
			axisService.getParameter("ServiceClass").setValue(serviceClass);
			Logger.getLogger(this.getClass()).info("level5Service serviceClass
set to: " + serviceClass);

			//doesn't work, no effect. But works staticly in the service.xml
			OMFactory omFactory = OMAbstractFactory.getOMFactory();

			OMElement parameter = omFactory.createOMElement("parameter", null);
			parameter.addAttribute("name", "InflowSecurity", null);
			OMElement action = omFactory.createOMElement("action", null);
			parameter.addChild(action);
			OMElement items = omFactory.createOMElement("items", null);
			items.setText("UsernameToken");
			action.addChild(items);
			OMElement passwordCallbackClass =
omFactory.createOMElement("passwordCallbackClass", null);
		
passwordCallbackClass.setText("org.vip_eu.level5Service.helper.PasswordCallbackHandler");
			action.addChild(passwordCallbackClass);

			Parameter inflowSecurity = new Parameter();
			inflowSecurity.setName("InflowSecurity");
			inflowSecurity.setParameterElement(parameter);
			inflowSecurity.setParameterType(2);	
			
			try
			{
				axisService.addParameter(inflowSecurity);
			}
			catch (AxisFault e)
			{
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

			for (Parameter parameterToInvestigate : axisService.getParameters())
			{
				Logger.getLogger(this.getClass()).info("Parameter name " +
parameterToInvestigate.getName());
				Logger.getLogger(this.getClass()).info("Parameter value " +
parameterToInvestigate.getParameterElement());
				Logger.getLogger(this.getClass()).info("Parameter Type: " +
parameterToInvestigate.getParameterType());
				Logger.getLogger(this.getClass()).info("Parameter Element: " +
parameterToInvestigate.getParameterElement());
				Logger.getLogger(this.getClass()).info("Parameter Locked: " +
parameterToInvestigate.isLocked());
				Logger.getLogger(this.getClass()).info("Parameter Transient: " +
parameterToInvestigate.isTransient());
			}

		}
	}
}




-- 
Für's private
http://toms-toy.de/Thomas%20Grabietz%20tom@toms-toy.de%20(0xE43515AC)%20pub.asc

GIT d-(---)? s():()> a+ C$>++ UL$>+ P? L>++ E W>+++ N>++$ o K--? w>--- O
M>-- V PS>+ PE Y PGP>++$ t 5 X R tv b>+++ DI D G e> h>++ !r y>+

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org