Page 1 of 1

NuSOAP Authentication

Posted: Wed Oct 13, 2004 3:15 pm
by howpom
twigletmac | Help us, help you. Please use

Code: Select all

and

Code: Select all

tags where approriate when posting code. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

I have been trying to connect to a Web service that requires a login and pw but apparently the credentials are not being passed appropriately so I get an authentication error. It should be straight forward but I have tried dozens of combinations without success.

Here is the error message that I generate:

Code: Select all

Request
Response

wsdl error: HTTP ERROR: HTTP authentication failed
This is test 10
=====================================================
Here's a little test.

Code: Select all

<?php
// soapTst.php
  require_once( 'nusoap.php' );

  $url = "http://nnn.nnn.nnn.nnn:nnnn/services/Discovery?wsdl";
//   $soapclient->debug_flag = true;
//  $client = new soapclient( $url, array("trace" => 1, "exceptions" => 0 ) );

  $client = new soapclient( $url, 'wsdl' );
  $client->username = "frbit";
  $client->password = "froboz"; 
//  $client->setCredentials( "fribit", "froboz" );
  echo '<h2>Request</h2>';
  echo '' . htmlspecialchars($client->request, ENT_QUOTES) . '';
  echo '<h2>Response</h2>';
  echo '' . htmlspecialchars($client->response, ENT_QUOTES) . '';

/*  echo $soapclient->debug_data;
  echo 'Request: <xmp>'.$soapclient->request.'</xmp>';
  echo 'Response: <xmp>'.$soapclient->response.'</xmp>';
  echo 'Debug log: <pre>'.$soapclient->debug_str.'</pre>';
 */
  $sErr = $client->getError();
  if ( $sErr )
  {
  	echo "<p><b>" . $sErr . "</b></p>";
  }
  
  print "This is test 10";
 ?>
Thanks in advance for your help.