Bpel 12c - 使用基本身份验证调用webservices

时间:2017-11-02 17:39:55

标签: soa oracle12c bpel soa-suite

我使用Oracle BPEL 12c开发流程。

我需要使用基本身份验证调用外部服务。我需要将在公开的服务端点上收到的凭据传递给外部服务。

当我打电话时,我会收到:

<remoteFault xmlns="http://schemas.oracle.com/bpel/extension">
-<part name="summary">
<summary>
oracle.fabric.common.FabricException: oracle.fabric.common.FabricException: Error in getting XML input stream:XXXXXX?WSDL: Server Authentication Required: Error in getting XML input stream: XXXX?WSDL: Server Authentication Required
</summary>
</part>
-<part name="detail">
<detail>Server Authentication Required</detail>
</part>
</remoteFault>

我尝试在复合上定义外部服务的oracle.webservices.auth.password和oracle.webservices.auth.username密码。

还有没有成功的javax.xml.ws.security.auth.username和javax.xml.ws.security.auth.password属性。

任何消化?

亲切的问候, 里卡多

1 个答案:

答案 0 :(得分:2)

我想你的复合片段应该是这样的:

<reference name="Service1" ui:wsdlLocation="test1.wsdl">
    <interface.wsdl  interface="http://tempuri.org/#wsdl.interface(IService1)"/>
    <binding.ws port="http://tempuri.org/#wsdl.endpoint(Service1/BasicHttpBinding_IService1)"  location="test1.wsdl" soapVersion="1.1">
        <property name="weblogic.wsee.wsat.transaction.flowOption" type="xs:string" many="false">WSDLDriven</property>
        <property name="oracle.webservices.auth.username" type="xs:string" many="false">test</property>
        <property name="oracle.webservices.auth.password" type="xs:string" many="false">password</property>
        <property name="oracle.webservices.preemptiveBasicAuth" type="xs:string" many="false">true</property>
    </binding.ws>
</reference>

在定义用户和密码时使用变量而不是明确的用户名和密码

也是一种很好的做法
    <property name="oracle.webservices.auth.username" type="xs:string" many="false">{$username}</property>
     <property name="oracle.webservices.auth.password" type="xs:string" many="false">{$password}</property>

然后在部署复合应用程序时在生成的cfg_plan.xml中覆盖它们

 <reference name="Service1">
     <!--Add search and replace rules for the binding properties-->
     <binding type="ws">
        <attribute name="port">
           <replace>{your_port}</replace>
        </attribute>
        <attribute name="location">
           <replace>{your_location}</replace>
        </attribute>
        <property name="weblogic.wsee.wsat.transaction.flowOption">
           <replace>WSDLDriven</replace>
        </property>
        <property name="oracle.webservices.auth.username">
           <replace>test</replace>
        </property>
        <property name="oracle.webservices.auth.password">
           <replace>password</replace>
        </property>
        <property name="oracle.webservices.preemptiveBasicAuth">
           <replace>true</replace>
        </property>
     </binding>
  </reference>