java - 如何在服务调用中排除 Rampart 模块

标签 java xml web-services apache-axis rampart

我们有一个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/

相关文章:

linux - java运行jar文件失败不退出回提示

java - 适用于 Android 的 Canny 边缘检测器——关于递归函数的 StackOverflow

java - 在 Jena 自定义 PropertyFunction 中等待服务器响应

c# - xml,xmlreader使用c#只读特定部分

python - 我如何使用 urllib3 发布 XML

java - 在 apache servicemix 中以编程方式启动 OSGI 包

java - 使用 Web 服务时避免多次调用

java - 如何返回没有来自其他类的嵌套对象的 JSON 对象?

java - 解析 XML 时出错 : unbound prefix - Element type "LinearLayout" must be followed by either attribute specifications

c# - XmlSerializer - 反序列化 SoapException 详细元素