Page 1 of 1

SOAP Header login

Posted: Thu Aug 25, 2011 8:09 am
by LuaMadman
I'm new to SOAP.
And the support of the site i'm connetcing to dosent know PHP.

What i'm trying to do is to login to there webservice, and then run getSalesPartCatalog() call to get there inventory.

This is what i have now.

Code: Select all

	$apiUrl = 'https://secure.brightpoint.eu/ws/external/partCatalog/external.asmx?WSDL'; //Address to API
	$client = new SoapClient($apiUrl,array("trace" => 1, "exceptions" => 1)); //Create Soap client
	$harray = array(
		"sCustomerNo" => "**",
		"sInstance" => "**",
		"sSite" => "**",
		"sPassword" => "**"
	);
	$headurl = "https://secure.brightpoint.eu/ws/external/partCatalog";
	$header = new SOAPHeader($headurl, 'AuthHeaderUser', $harray); // Send header
	$client->__setSoapHeaders($header);
	$result = $client->getSalesPartCatalog(); // Line 57
	echo($result);
And that gives me
Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Login failed in /home/telldsse/public_html_new/CSVSystem/Brightpoint.php:57

They provieded me with the xml I need to send

Code: Select all

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:par="https://secure.brightpoint.eu/ws/external/partCatalog">
   <soapenv:Header>
      <par:AuthHeaderUser>
         <par:sCustomerNo>**</par:sCustomerNo>
         <par:sInstance>**</par:sInstance>
         <par:sSite>**</par:sSite>
         <par:sPassword>**</par:sPassword>
      </par:AuthHeaderUser>
   </soapenv:Header>
   <soapenv:Body>
      <par:getSalesPartCatalog/>
   </soapenv:Body>
</soapenv:Envelope>
Why does login fail?

Re: SOAP Header login

Posted: Fri Aug 26, 2011 9:35 am
by Jade
Are you sure you're sending the correct login information?

Re: SOAP Header login

Posted: Sun Aug 28, 2011 3:11 am
by LuaMadman
Yes, I copied it directly from the mail he sent.
But I mailed yesterday about that very thing, bescuse they have test line there you can do a &psw=**&cuno=** and that failed, so i'm waiting on him to make sure he gave me right info and that i'm acctually regged

Re: SOAP Header login

Posted: Mon Aug 29, 2011 6:34 am
by yacahuma
I think something is wrong with the wsdl or the php library is wrong. I can read amazon wsdl but not yours.

Code: Select all

$url="https://secure.brightpoint.eu/ws/external/partCatalog/external.asmx?WSDL"; // DOES NOT WORK
//$url= 'http://soap.amazon.com/schemas3/AmazonWebServices.wsdl';  WORKS
$client = new SoapClient($url);
var_dump($client->__getFunctions());


Re: SOAP Header login

Posted: Tue Aug 30, 2011 2:23 am
by LuaMadman
@yacahuma
That is very strange, using your code i get an array of 36 from my address, and array of 26 from amazon

@Jade
You were sort of correct.
The problem is that i have been given an demo account to test on untill i finished writing my program, what anyone failed to mentions is that, the demoaccounts uses an cloned WSDL on a DIFFRENT server. So all I had to do was to change the address of the $apiUrl

Now I know it work, beacuse it fails on an stdClass can be converting to string on the echo line =)