Hi Graham, I didn't think about what I was saying enough when I suggested Business and Application logic should be able to see the SoapHeader.
I suggest that an ideal solution would be to bind SoapHeader to a header() function optionally to each class. Upon a SOAP client request for a function, the first step for SCA would be to call the header() function and if the header function returns true then the function that was called would then be invoked, otherwise a SoapFault should be returned. A crass example follows: <?php include "SDO/DAS/Relational.php"; include "SCA/SCA.php"; /** * @service * @binding.ws * @types http://productsc/Product _data/XSD/Products.xsd */ class provisioning { /** * @reference * @binding.wsdl http://barra:8080/productsc.php?wsdl */ public $products; /** * @param fnn $fnn http://productsc/Product * @return fnn http://productsc/Product */ function getExistingInfo($fnn) { $this->products->getByFNN("033959595"); return $fnn; } /** * @param username $username http://products/Product */ function header($username) { if ($username=="fred") { return true; } else { return false; } } } ?> I've only had a small amount of time to review the PHP SOAP extension. To summarize from my brief exposure to it, I think that SoapHeader consumption on the server side wouldn't be difficult to implement. I am still investigating this, though time is scarce for me. If I've not been clear enough on anything, please let me know. Regards, Kieran. On 3/1/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Hi Kieran, > > I wrote a response a couple of days ago, but for some reason I can't > see it here, so here goes again... > > On 27 Feb, 00:45, "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> wrote: > > Thanks for your replies, > > > > I'd like the WSDL generator to define the SOAP headers. Also the > > business/application logic should be able to access any headers sent > > from a SOAP client as SDO objects. I think the best place for the > > definition of the headers would be in the annotations above each > > class. > > > > I like the idea of adding support to generate Soap headers in the > WSDL. I agree that a class level annotation makes sense as the place > to add the headers. > > I think of Soap headers as things which cut across services and > ideally should not be surfaced in the business/applications logic > (e.g. security). If the business logic needs the info, then I'd > typically consider moving into the body. > > That said, there are sometimes reasons outside ones control which > might lead to the requirement to access headers from application > logic, so I wouldn't want us to proclude it, perhaps just not > recommend it ;-) > > > > The bug request mentioned seems to not have any real solution except > > for the fact that there's no current way to do what I want using the > > SoapServer from PHP. > > > > The lack of real solution was partly why I mentioned it. Sorry I > didn't make that clear. > > > Consequently, I've posted a feature request (http://bugs.php.net/ > > bug.php?id=40652) for writing SoapHeaders with SoapServer, although > > after rereading my request, I may not have been clear enough. If you > > were to post comments of support and/or clarification to the request > > it would be greatly appreciated, and might give it some more swing. > > > > I've added a comment to try to make sure whatever gets implemented can > be used in SCA in an effective way. > > > Regards, > > > > Kieran > > > > On 26 Feb, 16:40, "[EMAIL PROTECTED]" > > > > <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > > I added the __setSoapHeader() to allow me to write a custom Binding > > > for eBay. I needed to be able to flow an eBay CustomSecurityHeader in > > > the SoapHeader. An extract of its use is as follows (I've modified > > > the code a little to show how you would use it directly on the proxy > > > rather than in a custom binding for clarity, but to preserve the > > > protocol/business logic separation, this is best done in a binding): > > > > > $requester_credentials = > > > > $proxy->createDataObject('urn:ebay:apis:eBLBaseComponents', > > > > > 'CustomSecurityHeaderType'); > > > $requester_credentials->eBayAuthToken = > $this->config['authtoken']; > > > > > $credentials = > $requester_credentials->createDataObject('Credentials'); > > > > > $credentials->AppId = $this->config['appid']; > > > $credentials->DevId = $this->config['devid']; > > > $credentials->AuthCert = $this->config['authcert']; > > > $proxy->__setSoapHeader($requester_credentials, > > > 'urn:ebay:apis:eBLBaseComponents', > > > 'RequesterCredentials'); > > > $response = $proxy->GetSearchResults($request); > > > > > I think it would be good to provide the equivalent on the server > > > side. This would probably be best used by custom binding > > > implementations to keep header handling separate from business logic > > > (I'm not sure how this could be cleanly done any other way since an > > > SCA component does not know about the binding implementation, so can't > > > easily explicitly request the header). > > > > > Ideally the SoapServer would provide a hook for this to be > > > implemented, but unfortunately this is not the case > (seehttp://bugs.php.net/bug.php?id=38309). It may be possible to extend > > > the SCA_Bindings_ws_ServiceRequestHandler to parse out the header into > > > an SDO, but this will impact performance (the SoapServer has already > > > parsed the request once). > > > > > We may be able to request that the SoapServer provide the hook (or > > > offer to contribute it), if that's what we decide is the best way > > > forward. > > > > > On 26 Feb, 11:51, [EMAIL PROTECTED] wrote: > > > > > > On 26 Feb, 00:54, "[EMAIL PROTECTED]" > > > > > > <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > > > I'm working with a medium sized telco in Australia to reimplement > > > > > their CRM. First thing we're doing is to turn all their core > services > > > > > into SOAP exposed services. > > > > > > > SOAP headers would make our life a lot easier. I've read the > > > > > documentation and had a quick look at the source code - but it > seems > > > > > as though there's no way to do this. > > > > > > > Is there technical limitations as to why this isn't implemented? > We > > > > > have a few developers here, and if it's not too difficult to > implement > > > > > we may be ale to allocate resources to implementing it. > > > > > > > Great work, by the way. > > > > > > > Regards, > > > > > > > Kieran > > > > > > Hi Kieran and thanks:-) > > > > > > Do you mean you want to be able to set the SOAP hearders that are > sent > > > > with a SOAP request? Looking at the AVOCET branch in CVS it seems > > > > Graham Charters has had this problem as a method was added to allow > > > > SOAP headers to be set. If you look in the branch at file > SCA/Bindings/ > > > > ws/Proxy.php there is a new method. > > > > > > public function __setSoapHeader($header_sdo, $ns, $name) { > > > > > > I don't see any examples of how to use it though so maybe Graham > will > > > > comment with some detail on the ins and outs of the change. > > > > > > If you want to read the SOAP headers in a service then I'm not sure > > > > how you go about it at present. There is no technical reason why we > > > > shouldn't allow access to the headers but we would have to add an > API > > > > to retireve the information for a call. > > > > > > Thanks for the offer of help it's very welcome. Lets discuss your > > > > exact requirements here then we can work out how we implement it. > > > > > > Regards > > > > > > Simon > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "phpsoa" group. To post to this group, send email to phpsoa@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.co.uk/group/phpsoa?hl=en -~----------~----~----~----~------~----~------~--~---