Bpel 12c - 使用基本身份验证调用 Web 服务

问题描述:

我正在使用 Oracle BPEL 12c 来开发流程.

I'm using Oracle BPEL 12c to develop a process.

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

I need to call a external service with basic authentication. I need to pass the credentials received on my exposed service endpoint to the external service.

当我打电话时,我收到:

When i call, i receive this:

<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 密码.

I tried to define on the composite, also the oracle.webservices.auth.password and oracle.webservices.auth.username password for the external service.

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

Also the javax.xml.ws.security.auth.username and javax.xml.ws.security.auth.password properties without sucess.

有什么建议吗?

亲切的问候,里卡多

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

I suppose your composite snippet should look like this:

<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>

在定义用户名和密码而不是明确的用户名和密码时使用变量也是一个好习惯

And also good practice to use variables when defining user and password instead of explicitly username and password

    <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 中覆盖它们

and then override them in generated cfg_plan.xml while deploying composite application

 <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>