Discussion:
PHP and curl
Alf Stockton
2013-09-25 14:17:33 UTC
Permalink
In an attempt to interface with a webservice on a Windows 7 server I
have started writing the following:-
[code]
<?php
$strTerminalname = "CIS";
$version = "1.2";
$client = new
SoapClient("http://192.168.0.10/CISWebService/Mediamanager.asmx?WSDL");
var_dump($client->__getFunctions());
$result =
$client->__doRequest("GetSequenceNo",$strTerminalname,$version, $one_way
= 0);
?>
[/code]
and I execute it via
php php-soap-web-service.php > test.txt
on my Ubuntu 13.04 laptop using php version Zend Engine v2.4.0
in return I get
array(20) {
[0]=>
string(59) "GetMediaListResponse GetMediaList(GetMediaList $parameters)"
[1]=>
string(68) "GetMediaListAllResponse GetMediaListAll(GetMediaListAll
$parameters)"
[2]=>
string(59) "GetSoundListResponse GetSoundList(GetSoundList $parameters)"
[3]=>
string(77) "GetTerminalDataXMLResponse
GetTerminalDataXML(GetTerminalDataXML $parameters)"
[4]=>
string(59) "GetRouterXmlResponse GetRouterXml(GetRouterXml $parameters)"
[5]=>
string(80) "GetTerminalSoundXMLResponse
GetTerminalSoundXML(GetTerminalSoundXML $parameters)"
[6]=>
string(62) "SetSequenceNoResponse SetSequenceNo(SetSequenceNo
$parameters)"
[7]=>
string(50) "GetConfigResponse GetConfig(GetConfig $parameters)"
[8]=>
string(62) "GetSequenceNoResponse GetSequenceNo(GetSequenceNo
$parameters)"
[9]=>
string(95) "UpdateClientMediaLogTimeResponse
UpdateClientMediaLogTime(UpdateClientMediaLogTime $parameters)"
[10]=>
string(59) "GetMediaListResponse GetMediaList(GetMediaList $parameters)"
[11]=>
string(68) "GetMediaListAllResponse GetMediaListAll(GetMediaListAll
$parameters)"
[12]=>
string(59) "GetSoundListResponse GetSoundList(GetSoundList $parameters)"
[13]=>
string(77) "GetTerminalDataXMLResponse
GetTerminalDataXML(GetTerminalDataXML $parameters)"
[14]=>
string(59) "GetRouterXmlResponse GetRouterXml(GetRouterXml $parameters)"
[15]=>
string(80) "GetTerminalSoundXMLResponse
GetTerminalSoundXML(GetTerminalSoundXML $parameters)"
[16]=>
string(62) "SetSequenceNoResponse SetSequenceNo(SetSequenceNo
$parameters)"
[17]=>
string(50) "GetConfigResponse GetConfig(GetConfig $parameters)"
[18]=>
string(62) "GetSequenceNoResponse GetSequenceNo(GetSequenceNo
$parameters)"
[19]=>
string(95) "UpdateClientMediaLogTimeResponse
UpdateClientMediaLogTime(UpdateClientMediaLogTime $parameters)"
}

now this is all great but my question is how do I call each of these
functions with parameters.
The call I immediately need to make is to GetSequenceNo() which requires
a parameter of "CIS" in my current configuration.
How do I do this ? Obviously $client->__doRequest is not the way to go.
--
Regards,
Alf Stockton www.stockton.co.za
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Shawn McKenzie
2013-09-25 14:52:47 UTC
Permalink
SOAP functions can be called as methods of the SoapClient object. Maybe:

$client->GetSequenceNo( $parameters );

-Shawn
In an attempt to interface with a webservice on a Windows 7 server I have
started writing the following:-
[code]
<?php
$strTerminalname = "CIS";
$version = "1.2";
$client = new SoapClient("http://192.168.0.**
10/CISWebService/Mediamanager.**asmx?WSDL<http://192.168.0.10/CISWebService/Mediamanager.asmx?WSDL>
");
var_dump($client->__**getFunctions());
$result = $client->__doRequest("**GetSequenceNo",$**strTerminalname,$version,
$one_way = 0);
?>
[/code]
and I execute it via
php php-soap-web-service.php > test.txt
on my Ubuntu 13.04 laptop using php version Zend Engine v2.4.0
in return I get
array(20) {
[0]=>
string(59) "GetMediaListResponse GetMediaList(GetMediaList $parameters)"
[1]=>
string(68) "GetMediaListAllResponse GetMediaListAll(**GetMediaListAll
$parameters)"
[2]=>
string(59) "GetSoundListResponse GetSoundList(GetSoundList $parameters)"
[3]=>
string(77) "GetTerminalDataXMLResponse GetTerminalDataXML(**GetTerminalDataXML
$parameters)"
[4]=>
string(59) "GetRouterXmlResponse GetRouterXml(GetRouterXml $parameters)"
[5]=>
string(80) "GetTerminalSoundXMLResponse GetTerminalSoundXML(**GetTerminalSoundXML
$parameters)"
[6]=>
string(62) "SetSequenceNoResponse SetSequenceNo(SetSequenceNo
$parameters)"
[7]=>
string(50) "GetConfigResponse GetConfig(GetConfig $parameters)"
[8]=>
string(62) "GetSequenceNoResponse GetSequenceNo(GetSequenceNo
$parameters)"
[9]=>
string(95) "**UpdateClientMediaLogTimeRespon**se
UpdateClientMediaLogTime(**UpdateClientMediaLogTime $parameters)"
[10]=>
string(59) "GetMediaListResponse GetMediaList(GetMediaList $parameters)"
[11]=>
string(68) "GetMediaListAllResponse GetMediaListAll(**GetMediaListAll
$parameters)"
[12]=>
string(59) "GetSoundListResponse GetSoundList(GetSoundList $parameters)"
[13]=>
string(77) "GetTerminalDataXMLResponse GetTerminalDataXML(**GetTerminalDataXML
$parameters)"
[14]=>
string(59) "GetRouterXmlResponse GetRouterXml(GetRouterXml $parameters)"
[15]=>
string(80) "GetTerminalSoundXMLResponse GetTerminalSoundXML(**GetTerminalSoundXML
$parameters)"
[16]=>
string(62) "SetSequenceNoResponse SetSequenceNo(SetSequenceNo
$parameters)"
[17]=>
string(50) "GetConfigResponse GetConfig(GetConfig $parameters)"
[18]=>
string(62) "GetSequenceNoResponse GetSequenceNo(GetSequenceNo
$parameters)"
[19]=>
string(95) "**UpdateClientMediaLogTimeRespon**se
UpdateClientMediaLogTime(**UpdateClientMediaLogTime $parameters)"
}
now this is all great but my question is how do I call each of these
functions with parameters.
The call I immediately need to make is to GetSequenceNo() which requires a
parameter of "CIS" in my current configuration.
How do I do this ? Obviously $client->__doRequest is not the way to go.
--
Regards,
Alf Stockton www.stockton.co.za
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Shawn McKenzie
2013-09-25 15:24:32 UTC
Permalink
Keep on list.

$result = $client->GetSequenceNo( "CIS" ); shouldn't be throwing that
error. Maybe you are trying to do something with $result afterwards? Try
var_dump($result);
Post by Shawn McKenzie
$client->GetSequenceNo( $parameters );
That unfortunately returns
php-soap-web-service.php > test.txt
PHP Catchable fatal error: Object of class stdClass could not be
converted to string in
/home/alf/Development/PHP/DevIt/php-soap-web-service.php on line 7
No matter if I use
$result = $client->GetSequenceNo( "CIS" );
or
$result = $client->GetSequenceNo($strTerminalname);
--
Regards,
Alf Stockton www.stockton.co.za
--
----------------------
Thanks!
-Shawn
----------------------
Shawn McKenzie
2013-09-26 14:49:40 UTC
Permalink
Unfortunately this isn't anything to do with PHP. I don't have any info on
the app, what it's supposed to return or what the parameter passed should
be. The PHP soap call is working, but the app isn't returning what you
want or expect I guess.
Shawn, that was silly of me. I have now removed the echo but I still do
not get the expected result from the server.
var_dump of $result returns:-
object(stdClass)#2 (1) {
["GetSequenceNoResult"]=>
object(stdClass)#3 (6) {
["iServerNo"]=>
int(0)
["iClientNo"]=>
int(0)
["bNoLimitDownload"]=>
bool(false)
["dtStartDate"]=>
string(19) "0001-01-01T00:00:00"
["dtEndDate"]=>
string(19) "0001-01-01T00:00:00"
["dtServerTime"]=>
string(19) "0001-01-01T00:00:00"
}
}
whereas the expected result is to have each of those fields containing
data.
My code now looks like
<?php
$strTerminalname = "CIS";
$version = "1.2";
$client = new SoapClient(
"http://192.168.0.10/CISWebService/Mediamanager.asmx?WSDL"<http://192.168.0.10/CISWebService/Mediamanager.asmx?WSDL>
);
$result = $client->GetSequenceNo($strTerminalname);
print_r($result);
var_dump($result);
?>
$result = $client->GetSequenceNo( "CIS" ); shouldn't be throwing that
error. Maybe you are trying to do something with $result afterwards? Try
var_dump($result);
Post by Shawn McKenzie
$client->GetSequenceNo( $parameters );
That unfortunately returns
php-soap-web-service.php > test.txt
PHP Catchable fatal error: Object of class stdClass could not be
converted to string in
/home/alf/Development/PHP/DevIt/php-soap-web-service.php on line 7
No matter if I use
$result = $client->GetSequenceNo( "CIS" );
or
$result = $client->GetSequenceNo($strTerminalname);
--
Regards,
Alf Stockton www.stockton.co.za
--
----------------------
Thanks!
-Shawn
----------------------
--
Regards,
Alf Stockton www.stockton.co.za
--
Thanks!
-Shawn
Loading...