Reputation: 4135
I am working on web service client in PHP. Each request must supply a licence key which is a guid such as 17a18c4d-63ab-4eab-778f-20a67e1fe83a.
The problem is that according to the specification, the license is not a string but a Guid and the examples are in C, eg.
ListAllBookSubjects(Guid licenseKey, LanguageCodeTypeEnum language)
If I try this snippet in PHP (login and license are not the actual ones):
$url= "http://service.qa.pubhub.dk/MediaService1_4.asmx?WSDL";
$config = array( "login" => "[email protected]", "password" => "1234", "trace" => 1,"exceptions" => 0);
$objSoapClient = new SoapClient($url,$config);
print_r($objSoapClient->ListAllBookSubjects('{17a18c4d-63ab-4eab-778f-20a67e1fe83a}', 'DAN'));
I get the following error response:
[message:protected] => System.Web.Services.Protocols.SoapException: Invalid LicenseKey {00000000-0000-0000-0000-000000000000}
I have also tried without the braces. Apparently the guid format is wrong, but how do I represent a C Guid in PHP?
I found the answer, see below
Upvotes: 0
Views: 2301
Reputation: 4135
I tried sending the request using Storm and realized that the request needed the parameter names:
print_r($objSoapClient->ListAllBookSubjects(array("licenseKey" => "17a18c4d-63ab-4eab-778f-20a67e1fe83a", "language"=>"DAN")));
The above version works perfectly!
I didn't know Storm but was pointed to it by the service provider's support. It seems be a very useful tool: http://storm.codeplex.com
Upvotes: 1
Reputation: 3194
According to the WSDL at http://service.qa.pubhub.dk/MediaService.asmx?WSDL , it would seem as though a GUID is 'defined' with a pattern value of:
[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}
so it should definitely be good if you do it without the braces. Is it possible that the license key isn't authorised or something on the server? It may pay to ask the service provider, giving them a copy or two of the SOAP requests that are being made.
Upvotes: 1