consuming WCF with php5.2.6

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm having trouble finding the magic combination to consume a WCF
service, can anyone advise on where I'm wrong?

I've got a test script as follows, (it's locked down to my IP so i
dont think you;'ll be able to test it, but i've included the wsdl
location for completeness)

any help really appreciated.

D

<?php

try{
    $client = new
SoapClient("http://services.ciphe.org.uk/FindPlumber/FindPlumberService.svc?wsdl";);
    # get a list of the available methods
    print "Functions:\n";
    var_dump($client->__getFunctions());

/* this outputs


Functions:
array(1) {
  [0]=>
  string(62) "PerformSearchResponse PerformSearch(PerformSearch $parameters)"
}

*/



    print "\n\n";
    print "Types:\n";
    var_dump($client->__getTypes());
    print "\n\n";

/* this outputs


Types:
array(11) {
  [0]=>
  string(40) "struct ArrayOfResult {
 Result Result;
}"
  [1]=>
  string(344) "struct Result {
 string Address1;
 string Address2;
 string Address3;
 string CompanyName;
 string Contact;
 string Country;
 string County;
 string Email;
 string Fax;
 string FullAddress;
 GMapPoint MapPoint;
 string Mobile;
 string Postcode;
 boolean Registered;
 string Telephone;
 string Town;
 string WebAddress;
 string WorkCategories;
}"
  [2]=>
  string(120) "struct GMapPoint {
 string Address;
 int ID;
 string IconImage;
 string InfoHTML;
 double Latitude;
 double Longitude;
}"
  [3]=>
  string(8) "int char"
  [4]=>
  string(17) "duration duration"
  [5]=>
  string(11) "string guid"
  [6]=>
  string(21) "string ResponseStatus"
  [7]=>
  string(109) "struct RequestMessage {
 int MaxResults;
 string Password;
 string PostCode;
 int Radius;
 string Username;
}"
  [8]=>
  string(92) "struct ResponseMessage {
 string Messsage;
 ArrayOfResult Results;
 ResponseStatus Status;
}"
  [9]=>
  string(56) "struct PerformSearch {
 RequestMessage requestMessage;
}"
  [10]=>
  string(70) "struct PerformSearchResponse {
 ResponseMessage PerformSearchResult;
}"
}

*/

/* based on the above, i think i need an array of paramaters, and that
array is named RequestMessage


    $myParam=array("RequestMessage"=>array(
        'MaxResults'=> 10,
        'Password '=> 'mypasswordgoeshere',
        'PostCode'=> 'BS24 0HT',
        'Radius'=> 25,
        'Username '=> ',username'
         ));


    #$result = $client->__soapCall('PerformSearch',array('RequestMessage'
=>$myParam));

    I believe that either the line above or the three lines below should work

    $wcf = $client->PerformSearch($myParam);
    #$wcfResult = $wcf->ResponseMessage;
    #print  $wsResult;


} catch (Exception $e) {
    print  'Caught exception: '.  $e->getMessage(). "\n";


/* an exception is thrown :

Caught exception: Object reference not set to an instance of an object.

*/


}

-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux