0

I'm having a problem with authentication when I try to consume a web service soap. When entering with the url in the browser, it appears u dailog requesting user and password. But I need to do this authentication without this dialog being presented, that is, all authentication in the back end. I tried to pass the login and password through SoapHeader but without success. Note: the web-service is written in Java. Here's the script:

 //!IMPORTANT: O tipo de autenticação é (Basic auth)    

 $credenciais = self::fncGeraAuth();   
 //array containing user and password for authentication   
 //Array ( [UserName] => xxxxx [Password] => xxxxx) 

 $_rCliente2 = new SoapClient($wsdl, array("encoding" => "ISO-8859-1"));  

 $Header = new SoapHeader($wsdl,'Authorization', $credenciais, false);

 $_rCliente2->__setSoapHeaders($Header);

 $result = $_rCliente2->fncRecuperaPapel($Instituição);

 var_dump($result);
 exit();

Error:

SoapFault: SOAP-ERROR: Parsing WSDL: Couldn't load from ' ...........?wsdl' : failed to load external entity ".........wsdl"

I do not have much experience with webservice consumption and if someone can help me I appreciate it

John Conde
  • 217,595
  • 99
  • 455
  • 496
  • That means the wsdl is not parsable (Is the url correct?) – Dieter Kräutl Sep 03 '18 at 13:19
  • I think not, because I tested on the post man and managed to get the return normally – Rafael Uemura Sep 03 '18 at 13:45
  • Thanks guys for pointing me out a solution, i'm trying, but no success – Rafael Uemura Sep 03 '18 at 13:48
  • Here is the actual script: $credentials = self::fncHash(); $options = array( 'UserName' => $credentials[Username], 'Password' => $credentials[Password] ); var_dump($options); echo "i'am here"; $_rClient2 = new SoapClient($_uWS, $options); $result = $_rClient2->fncPaperRecovery($param); var_dump($result); echo "i'am here"; – Rafael Uemura Sep 03 '18 at 14:10

0 Answers0