问题
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>
I tried to define on the composite, also the oracle.webservices.auth.password and oracle.webservices.auth.username password for the external service.
Also the javax.xml.ws.security.auth.username and javax.xml.ws.security.auth.password properties without sucess.
Any sugestion?
Kind regards, Ricardo
回答1:
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>
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>
来源:https://stackoverflow.com/questions/47081479/bpel-12c-call-webservices-with-basic-authentication