SOAP Header login

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
LuaMadman
Forum Commoner
Posts: 35
Joined: Tue Jul 20, 2010 6:58 am

SOAP Header login

Post 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?
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: SOAP Header login

Post by Jade »

Are you sure you're sending the correct login information?
User avatar
LuaMadman
Forum Commoner
Posts: 35
Joined: Tue Jul 20, 2010 6:58 am

Re: SOAP Header login

Post 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
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: SOAP Header login

Post 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());

User avatar
LuaMadman
Forum Commoner
Posts: 35
Joined: Tue Jul 20, 2010 6:58 am

Re: SOAP Header login

Post 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 =)
Post Reply