我们有一个axis 2服务,它调用2个另一个服务。对于一个服务调用,我们需要rampart安全性。因此我们在axis2.xml中配置了这一点。但是在另一个服务调用中,我想排除ramart,因为该调用不需要安全性。但是,由于只有1个axis2.xml是常见的,因此它在两个调用中都包含ramart。我如何排除这个。
最佳答案
您可以在服务级别甚至操作级别添加 Rampart 模块,例如
<service name="name of the service" scope="name of the scope" class="full qualifide name the service lifecycle class" targetNamespace="target namespase for the service">
<Description> The description of the service </Description>
<module ref="rampart" />
<operation name="echoString" mep="operation MEP">
<actionMapping>Mapping to action</actionMapping>
<module ref="rampart" />
<messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
</operation>
</service>
轴 2 配置 http://axis.apache.org/axis2/java/core/docs/axis2config.html#Service_Configuration
对于客户端
REPOSITORY_PATH 应该有一个名为“modules”的文件夹,并且 Rampart mar 应该位于该文件夹内。
ConfigurationContext ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(REPOSITORY_PATH, null);
SimpleServiceStub stub = new SimpleServiceStub(ctx, "http://sbswsvm1426ou:9091/axis2/services/SimpleService?wsdl");
stub._getServiceClient().engageModule("rampart");
关于java - 如何在服务调用中排除 Rampart 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27634722/