RE: [SOAP] Apache Basic Authentication PEAR::SOAP Client
| From: | Mike Carter | Date: | Mon, 19 May 2003 16:03:18 +0000 |
| Subject: | RE: [SOAP] Apache Basic Authentication PEAR::SOAP Client | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-609@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: anthony@acolebourne.co.uk [mailto:anthony@acolebourne.co.uk]
>
> > I had to make the SOAP client pass a unique 'key' in the
> header of all
> > SOAP requests sent to our SOAP server. This was achieved by doing:
>
> What format should this userToken be in?
>
> How about..
>
> array('username'=>'myuser','password'=>'mypassword')
It's totally up to your SOAP server. Our server is implemented in .NET so
I've not really been involved in how they coded the requirements.
The way we implemented authentication was:
A username and password to sent to an login webservice method.
If it was valid a "token" was returned as a unique identifier. It uses
something called a GUID from Microsoft world - basically a long string built
up from various attributes (time, IP address etc I think).
In order to get valid responses from any other webservers (apart from login
one!) the SOAP server methods all expect to receive their SOAP request
envelopes along with the SOAP Header containing a usertoken.
I was totally fumbling around in the dark to get this working :-)
> > $ourHeader = new SOAP_Header('TokenHeader', 'Struct',
> > array('InnerToken' => $this->userToken), false);
> > $ourHeader->attributes['xmlns'] =
> "http://www.adomain.co.uk/services";
> > // get from
> $this->fqn() ?? $this->addHeader($ourHeader);
>
> Does this mean that I have to write code to handle the
> TokenHeader I recieve within the Server? I was hopeing to get
> Apache to do it for me!
Pass. I've not touched the SOAP server side on my current project, it's
being handled by a .NET server.
Looking at the WSDL generated form the server it appears that the requirment
of a 'usertoken' is specified in each <operation> ...
<operation name="GetMemberMedicalRecordEntryList">
<soap:operation
soapAction="http://www.co.uk/services/GetMemberMedicalRecordEntryList"
style="document" />
<input>
<soap:body use="literal" />
<soap:header d5p1:required="true"
message="s0:GetMemberMedicalRecordEntryListTokenHeader" part="TokenHeader"
use="literal" xmlns:d5p1="http://schemas.xmlsoap.org/wsdl/" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
> > It's a bit hacky having the xmlns hardcoded like this though, I
> > thought it might have been possible to get it from the 'fqn'
> > attribute. I've not had time to look into this more. IT works for
> > now.
>
> Please excuse my lack of understanding but I don't know what
> a 'fqn' attribute is! (Fully Qualified Name?? ..what if you
> ns is not your FQDN?).
I can't remember myself now, its been a few months since I touched it.
I think it was the name of one of the SOAP Client object attributes when I
was doing var_dump() trying to get the whole header() thing working.
> Anyway is there a way to specify that this header information
> is required from within the WSDL?
See above. Good luck :)
- mike c
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.480 / Virus Database: 276 - Release Date: 5/12/2003
________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________