Re: Instantiate SOAP Request Objects

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

 



Samuel Vogel wrote:
> Hey,
> 
> I would like to know how I can instantiate the types that I get via the
> __getTypes() function or know if this is even possible.
> I am asking because I have a webservice in which all functions expect an
> specific object to be passed to them, rather than a list of arguments.
> And I am hoping that I do not have to code all those objects into my PHP
> Code, but rather instantiate them kinda from the wsdl!
> 
> Here is what I have:
> 
>     $map = array('Credentials' => 'Credentials', 'GetSourceTextRequest'
> => 'GetSourceTextRequest');
>     $ws = new SoapClient('http://192.168.0.1:8080/Service?wsdl',
> array('classmap' => $map));
> 
>     $test = new GetSourceTextRequest();
> 
> It does not work this way however, I do get a class not found failure.
> How can I instantiate an object from SOAP?
> 
> __getTypes() gives me something like this:
> 
> struct Credentials {
>  string Password;
>  string Username;
> }
> 
> Any hints would be appreciated!
> 
> Regards,
> Samy
> 

You are mapping SOAP types to PHP classes, so you need to define the PHP
class first:

class Credentials {
	public $Password
	public $Username
}

$map = array('Credentials' => 'Credentials', 'GetSourceTextRequest' =>
'GetSourceTextRequest');

$ws = new SoapClient('http://192.168.0.1:8080/Service?wsdl',
array('classmap' => $map));

$test = new Credentials();

-- 
Thanks!
-Shawn
http://www.spidean.com

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux