Java 如何覆盖Soa套件12c中REST绑定引用的OWSM策略?
我正在开发Oracle Fusion中间件12.1.3 在我的组合中,我添加了一个“Rest绑定”外部引用,为此我添加了一个oracle/wss_http_令牌_客户端_策略,并重写了csf密钥属性 在文件中,它看起来像: myComposite.BAS: 但它不起作用。我知道应用了配置计划,因为我可以看到该组合试图访问Java 如何覆盖Soa套件12c中REST绑定引用的OWSM策略?,java,authentication,oracle-fusion-middleware,soa-suite,Java,Authentication,Oracle Fusion Middleware,Soa Suite,我正在开发Oracle Fusion中间件12.1.3 在我的组合中,我添加了一个“Rest绑定”外部引用,为此我添加了一个oracle/wss_http_令牌_客户端_策略,并重写了csf密钥属性 在文件中,它看起来像: myComposite.BAS: 但它不起作用。我知道应用了配置计划,因为我可以看到该组合试图访问myDevServer上的REST服务器,但“原始”策略没有被删除。这在企业管理器上得到了确认:在CMProxyRSPolicies选项卡上,oracle/wss\u http\
myDevServer
上的REST服务器,但“原始”策略没有被删除。这在企业管理器上得到了确认:在CMProxyRS
Policies选项卡上,oracle/wss\u http\u token\u client\u policy
仍然可见,Effective
和Enabled
被选中
覆盖“composite.xml”中的策略
我还尝试直接在composite.xml
中重新定义策略,以查看是否可以覆盖wsm assembly.xml
文件中定义的内容。我尝试了几种不同的方法:
composite.xml:
[…]
[....]
11g和12c之间的差异
我在网上找到的样品是为11g设计的,不是12c。
通过jDeveloper GUI设置策略时唯一可能不同的行为是:
- 在12c中,
标记被添加到
文件中,用包装在wsm assembly.xml
中李> - 在11g中,
标记似乎直接添加到
文件中。(这就是我在上一次测试中试图直接在组合中设置策略的原因…)composite.xml
,但失败了
名称空间中的差异
如果您处理了wsp:
,您将看到:
- 在
中,这里定义了它:wsm assembly.xml
xmlns:wsp=”http://www.w3.org/ns/ws-policy“
- 在
和composite.xml
中,定义如下:configuration plan
xmlns:wsp=”http://schemas.xmlsoap.org/ws/2004/09/policy“
http://www.w3.org/ns/ws-policy
在我的配置计划中,但部署失败(即未应用配置计划)
我不知道如何才能走得更远……
有人能分享一个想法吗?是否有人在不同的环境中成功地使用不同的策略查询REST服务
非常感谢。一旦您在DEV环境中部署了项目,那么 1) 转到Oracle Fusion中间件控制台。 2) 打开项目。 3) 在“OWSM策略”选项卡下,可以添加或删除此策略。 4) 删除会话后,请保存会话并重试 还有一个选择 不使用oracle/wss\U http\U令牌\U客户端\U策略,您可以通过复制oracle/wss\U http\U令牌\U客户端\U策略类型的permit all类型策略来创建自己的新策略 在此新策略中,您可以添加在weblogic上创建的用户或组
在DEV server上部署项目时,请勿在此新策略中添加任何用户或组,默认情况下,这将允许所有用户访问此服务。您好,谢谢您的回答。事实上,我使用了您的第一个解决方案,但是在每次部署时手动覆盖控制台中的策略太无聊了。因此,我编写了一个WLST脚本来自动删除策略。但我会在有时间的时候试试你的第二个建议。非常感谢。
<?xml version="1.0" encoding="UTF-8" ?>
<!-- Generated by Oracle SOA Modeler version 12.1.3.0.0 at [01-06-2016 16:01]. -->
<composite name="MyCompositeBAS"
revision="9.8.8"
label="2016-06-01_16-01-48_442"
mode="active"
state="on"
xmlns="http://xmlns.oracle.com/sca/1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:orawsp="http://schemas.oracle.com/ws/2006/01/policy"
xmlns:ui="http://xmlns.oracle.com/soa/designer/"
xmlns:sca-ext="http://xmlns.oracle.com/sca/1.0-ext">
[.....]
<component name="MyCompositeBASProcess" version="2.0">
<implementation.bpel src="BPEL/MyCompositeBASProcess.bpel"/>
<componentType>
<service name="mycompositebasprocess_client" ui:wsdlLocation="WSDLs/MyCompositeBASProcess.wsdl">
<interface.wsdl interface="http://xmlns.oracle.com/GDDSOA/MyCompositeBAS/MyCompositeBASProcess#wsdl.interface(MyCompositeBASProcess)"
callbackInterface="http://xmlns.oracle.com/GDDSOA/MyCompositeBAS/MyCompositeBASProcess#wsdl.interface(MyCompositeBASProcessCallback)"/>
</service>
<reference name="CMProxyRS" ui:wsdlLocation="WSDLs/CMProxyRS.wsdl">
<interface.wsdl interface="http://xmlns.oracle.com/GDDSOA/MyCompositeBAS/CMProxyRS#wsdl.interface(CMProxyRS_ptt)"/>
</reference>
</componentType>
<property name="bpel.config.oneWayDeliveryPolicy" type="xs:string" many="false">async.persist</property>
</component>
<reference name="CMProxyRS" ui:wsdlLocation="WSDLs/CMProxyRS.wsdl">
<interface.wsdl interface="http://xmlns.oracle.com/GDDSOA/MyCompositeBAS/CMProxyRS#wsdl.interface(CMProxyRS_ptt)"/>
<binding.rest config="Adapters/CMProxyRS.wadl" location="http://myUatServer/cmproxy/resources/v2/" />
</reference>
[....]
<wire>
<source.uri>MyCompositeBASProcess/CMProxyRS</source.uri>
<target.uri>CMProxyRS</target.uri>
</wire>
</composite>
<?xml version="1.0" encoding="windows-1252" ?>
<orawsp:wsm-assembly xmlns:orawsp="http://schemas.oracle.com/ws/2006/01/policy">
<sca11:policySet xmlns:sca11="http://docs.oasis-open.org/ns/opencsa/sca/200912" name="policySet"
appliesTo="SCA-REST-REFERENCE()" attachTo="REFERENCE('CMProxyRS')" orawsp:highId="2"
xml:id="SCA-REST-REFERENCE__REFERENCE__CMProxyRS__">
<wsp:PolicyReference xmlns:wsp="http://www.w3.org/ns/ws-policy"
DigestAlgorithm="http://www.w3.org/ns/ws-policy/Sha1Exc"
URI="oracle/wss_http_token_client_policy" orawsp:status="enabled" orawsp:id="2">
<orawsp:OverrideProperty xmlns:orawsp="http://schemas.oracle.com/ws/2006/01/policy" orawsp:name="csf-key"
orawsp:value="cmproxy.rest"/>
</wsp:PolicyReference>
</sca11:policySet>
</orawsp:wsm-assembly>
<?xml version="1.0" encoding="UTF-8"?>
<SOAConfigPlan xmlns:jca="http://platform.integration.oracle/blocks/adapter/fw/metadata"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:orawsp="http://schemas.oracle.com/ws/2006/01/policy"
xmlns:edl="http://schemas.oracle.com/events/edl" xmlns="http://schemas.oracle.com/soa/configplan">
<composite name="MyCompositeBAS">
<import>
<searchReplace>
<search/>
<replace/>
</searchReplace>
</import>
<reference name="CMProxyRS">
<binding type="rest">
<attribute name="location">
<replace>http://myDevServer/cmproxy/resources/v2/</replace>
</attribute>
<wsp:PolicyReference URI="oracle/no_authentication_client_policy" orawsp:category="security" orawsp:status="enabled"/>
</binding>
</reference>
</composite>
</SOAConfigPlan>
[....]
<reference name="CMProxyRS">
<binding type="rest">
<attribute name="location">
<replace>http://myDevServer/cmproxy/resources/v2/</replace>
</attribute>
<wsp:PolicyReference orawsp:category="security" orawsp:status="disabled" URI="oracle/wss_username_token_client_policy"/>
<!--wsp:PolicyReference URI="oracle/no_authentication_client_policy" orawsp:category="security" orawsp:status="enabled"/ -->
</binding>
</reference>
[....]
[....]
<binding.rest config="Adapters/CMProxyRS.wadl" location="http://myDevServer/cmproxy/resources/v2/" >
<wsp:PolicyReference URI="oracle/wss_http_token_client_policy" orawsp:category="security" orawsp:status="disabled"/>
</binding.rest>
[....]