WSDL Client Not Working - php

I have a wsdl :
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:part element="impl:getIMIPremiumResponse" name="parameters">
</wsdl:part>
<wsdl:part element="impl:getIMIPremium" name="parameters">
</wsdl:part>
<wsdl:operation name="getIMIPremium">
<wsdl:input message="impl:getIMIPremiumRequest" name="getIMIPremiumRequest">
</wsdl:input>
<wsdl:output message="impl:getIMIPremiumResponse" name="getIMIPremiumResponse">
</wsdl:output>
</wsdl:operation>
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getIMIPremium">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getIMIPremiumRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getIMIPremiumResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:port binding="impl:IMIPremiumWebServiceSoapBinding" name="IMIPremiumWebService">
<wsdlsoap:address location="http://mysite.com/nsoap/IMIPremiumWebService.wsdl"/>
</wsdl:port>
And I want to submit information to get response. I created client.php which goes as follows :
<?php
try{
$client = new SoapClient("http://mysite.com/nsoap/IMIPremiumWebService.wsdl");
$args= array("expiryDate"=>'25',"imiInsured"=>'N',"inceptionDate"=>'43',"noOfInsured"=>'23',"partnerCode"=>'21',"stateCode"=>'MP' );
$something = $client->getIMIPremium($args);
echo $client->responseData;
}
catch (Exception $e)
{
print_r($e);
}
?>
But it is showing error in browser :
SoapFault Object ( [message:protected] => SOAP-ERROR: Encoding: object has no 'imiPolicy' property [string:Exception:private] => [code:protected] => 0 [file:protected] => C:\wamp\www\nsoap\phpclient.php [line:protected] => 8 [trace:Exception:private] => Array ( [0] => Array ( [file] => C:\wamp\www\nsoap\phpclient.php [line] => 8 [function] => __call [class] => SoapClient [type] => -> [args] => Array ( [0] => getIMIPremium [1] => Array ( [0] => Array ( [expiryDate] => 25 [imiInsured] => N [inceptionDate] => 43 [noOfInsured] => 23 [partnerCode] => 21 [stateCode] => MP ) ) ) ) [1] => Array ( [file] => C:\wamp\www\nsoap\phpclient.php [line] => 8 [function] => getIMIPremium [class] => SoapClient [type] => -> [args] => Array ( [0] => Array ( [expiryDate] => 25 [imiInsured] => N [inceptionDate] => 43 [noOfInsured] => 23 [partnerCode] => 21 [stateCode] => MP ) ) ) ) [previous:Exception:private] => [faultstring] => SOAP-ERROR: Encoding: object has no 'imiPolicy' property [faultcode] => Client [faultcodens] => http://schemas.xmlsoap.org/soap/envelope/ [xdebug_message] => ( ! ) SoapFault: SOAP-ERROR: Encoding: object has no 'imiPolicy' property in C:\wamp\www\nsoap\phpclient.php on line 8 Call Stack #TimeMemoryFunctionLocation 10.0010672312{main}( )..\phpclient.php:0 20.0104698552SoapClient->getIMIPremium( )..\phpclient.php:8 )
Where am I wrong ? What should be possible solution for this?
Edit :
I have create a php file :
client.php
<?php
require_once('nusoap.php');
$client = new nusoap_client('http://localhost/nsoap/IMIPremiumWebService.wsdl', True);
$err = $client->getError();
if ($err) {
// Display the error
echo 'client construction error: ' . $err ;
} else {
$args= array("imiPolicy" => array("expiryDate" => "23-09-2013", "imiInsured" =>array("item" => array("item" => array("age"=>'23', "basicSumInsured"=>'33233', "coverRageType"=>'12',"dateOfBirth"=>'26-09-1986',"preExistingDisease" => 'no'))), "inceptionDate"=>"12-09-2009" ,"noOfInsured"=>'1',"partnerCode" => '2121', "stateCode" => '233'));
$answer = $client->call('getIMIPremium',
$args);
$err = $client->getError();
if ($err) {
// Display the error
echo 'Call error: ' . $err;
echo $client->response;
//print_r($client->response);
//print_r($client->getDebug());
} else {
echo "*******************";
print_r($answer);
}
}
?>
But it is generating this error :
Call error: Response not of type text/xml: application/wsdl+xmlHTTP/1.1 200 OK Date: Tue, 17 Sep 2013 15:10:38 GMT Server: Apache/2.2.22 (Win64) PHP/5.3.13 Last-Modified: Tue, 17 Sep 2013 13:18:39 GMT ETag: "a0000000a818c-12e9-4e69428b54054" Accept-Ranges: bytes Content-Length: 4841 Connection: close Content-Type: application/wsdl+xml
As per suggestion, I have added imiPolicy in $args :
$args= array("imiPolicy" => array("expiryDate" => "23-09-2013", "imiInsured" =>array("item" => array("item" => array("age"=>'23', "basicSumInsured"=>'33233', "coverRageType"=>'12',"dateOfBirth"=>'26-09-1986',"preExistingDisease" => 'no'))), "inceptionDate"=>"12-09-2009" ,"noOfInsured"=>'1',"partnerCode" => '2121', "stateCode" => '233'));
But now error becomes:
SoapFault Object ( [message:protected] => Wrong Version [string:Exception:private] => [code:protected] => 0 [file:protected] => C:\wamp\www\nsoap\phpclient.php [line:protected] => 10 [trace:Exception:private] => Array ( [0] => Array ( [file] => C:\wamp\www\nsoap\phpclient.php [line] => 10 [function] => __call [class] => SoapClient [type] => -> [args] => Array ( [0] => getIMIPremium [1] => Array ( [0] => Array ( [imiPolicy] => Array ( [expiryDate] => 23-09-2013 [imiInsured] => Array ( [item] => Array ( [item] => Array ( [age] => 23 [basicSumInsured] => 33233 [coverRageType] => 12 [dateOfBirth] => 26-09-1986 [preExistingDisease] => no ) ) ) [inceptionDate] => 12-09-2009 [noOfInsured] => 1 [partnerCode] => 2121 [stateCode] => 233 ) ) ) ) ) [1] => Array ( [file] => C:\wamp\www\nsoap\phpclient.php [line] => 10 [function] => getIMIPremium [class] => SoapClient [type] => -> [args] => Array ( [0] => Array ( [imiPolicy] => Array ( [expiryDate] => 23-09-2013 [imiInsured] => Array ( [item] => Array ( [item] => Array ( [age] => 23 [basicSumInsured] => 33233 [coverRageType] => 12 [dateOfBirth] => 26-09-1986 [preExistingDisease] => no ) ) ) [inceptionDate] => 12-09-2009 [noOfInsured] => 1 [partnerCode] => 2121 [stateCode] => 233 ) ) ) ) ) [previous:Exception:private] => [faultstring] => Wrong Version [faultcode] => VersionMismatch [faultcodens] => http://schemas.xmlsoap.org/soap/envelope/ [xdebug_message] => ( ! ) SoapFault: Wrong Version in C:\wamp\www\nsoap\phpclient.php on line 10 Call Stack #TimeMemoryFunctionLocation 10.0012674576{main}( )..\phpclient.php:0 20.0184702744SoapClient->getIMIPremium( )..\phpclient.php:10 )

Like what was previously said..
The error is surrounding the follwoing:
[xdebug_message] => ( ! ) SoapFault: SOAP-ERROR: Encoding: object has no 'imiPolicy' property in C:\wamp\www\nsoap\phpclient.php on line 8 Call Stack #TimeMemoryFunctionLocation 10.0010672312{main}( )..\phpclient.php:0 20.0104698552SoapClient->getIMIPremium( )..\phpclient.php:8 )
Let's pick this apart:
OAP-ERROR: Encoding: object has no 'imiPolicy' property in C:\wamp\www\nsoap\phpclient.php on line 8 Call Stack #TimeMemoryFunctionLocation 10.0010672312{main}( )..\phpclient.php
and this breaks down to:
C:\wamp\www\nsoap\phpclient.php
on line 8 Call Stack #TimeMemoryFunctionLocation 10.0010672312{main}( )..\phpclient.php
Is there a line/setting in the php file for: 'imiPolicy'
I think once that is set, you should be good-to-go.
Hope this helps.
Kent

Related

Parsing SimpleXML Object data

How to get "file_url" from this data?
Response can contain few objects, and how to parse it?
Code that I use:
<?php
$r34data = simplexml_load_file('https://rule34.xxx/index.php?page=dapi&s=post&q=index&tags=green_hair&limit=2');
print_r($r34data);
Response:
SimpleXMLElement Object ( [#attributes] => Array ( [count] => 69175 [offset] => 0 ) [post] => Array ( [0] => SimpleXMLElement Object ( [#attributes] => Array ( [height] => 2039 [score] => 1 [file_url] => https://wimg.rule34.xxx/images/3820/01e0a587f6e303c34669a4f79c994100.png [parent_id] => [sample_url] => https://rule34.xxx/samples/3820/sample_01e0a587f6e303c34669a4f79c994100.jpg [sample_width] => 850 [sample_height] => 667 [preview_url] => https://rule34.xxx/thumbnails/3820/thumbnail_01e0a587f6e303c34669a4f79c994100.jpg [rating] => e [tags] => 1boy 2girls annette_(fire_emblem) annette_fantine_dominic ass back back_view bare_back big_ass big_breasts blue_eyes blue_lingerie breasts_outside byleth_(fire_emblem) byleth_(fire_emblem)_(male) byleth_(male) ffm_threesome fingering fingering_partner fire_emblem fire_emblem:_three_houses french_kiss green_hair kissing light_blue_lingerie lingerie long_hair lysithea_(fire_emblem) lysithea_von_ordelia medium_breasts medium_hair nintendo nipples orange_hair pink_eyes purple_lingerie pussy pussy_juice pussy_juice_trail quan_ming sex threesome vaginal_penetration white_hair [id] => 4324333 [width] => 2600 [change] => 1608630074 [md5] => 01e0a587f6e303c34669a4f79c994100 [creator_id] => 503169 [has_children] => false [created_at] => Tue Dec 22 09:21:59 +0000 2020 [status] => active [source] => https://www.pixiv.net/en/artworks/86455582 [has_notes] => false [has_comments] => false [preview_width] => 150 [preview_height] => 117 ) ) [1] => SimpleXMLElement Object ( [#attributes] => Array ( [height] => 1600 [score] => 10 [file_url] => https://wimg.rule34.xxx/images/3820/4a88c87d1cb18928bcee85207bf1c61b.jpeg [parent_id] => [sample_url] => https://rule34.xxx/samples/3820/sample_4a88c87d1cb18928bcee85207bf1c61b.jpg [sample_width] => 850 [sample_height] => 618 [preview_url] => https://rule34.xxx/thumbnails/3820/thumbnail_4a88c87d1cb18928bcee85207bf1c61b.jpg [rating] => e [tags] => 1boy 1boy1girl 1girls all_fours anal anal_sex barefoot bent_over big_breasts christmas clothed_male_nude_female clothing cum cum_in_ass cum_inside cum_leaking doggy_style ejaculation ejaculation_while_penetrated faceless_male feet female female_focus forehead_protector green_hair hair_bun headband huge_breasts kneeling long_hair looking_at_viewer looking_back male multicolored_hair naked naruto naruto_(series) naruto_shippuden nude open_mouth orange_eyes orange_hair pakura penetration pussy santa_costume smile soles standing tied_hair toes two_tone_hair vagina [id] => 4324142 [width] => 2202 [change] => 1608622103 [md5] => 4a88c87d1cb18928bcee85207bf1c61b [creator_id] => 631992 [has_children] => false [created_at] => Tue Dec 22 07:28:01 +0000 2020 [status] => active [source] => [has_notes] => false [has_comments] => false [preview_width] => 150 [preview_height] => 108 ) ) ) )
Please help!
(don't ask why I parsing rule34)
Hi You can conver it to the array and work with is easy
libxml_use_internal_errors(TRUE);
$objXmlDocument = simplexml_load_file("https://rule34.xxx/index.php?page=dapi&s=post&q=index&tags=green_hair&limit=2");
if ($objXmlDocument === FALSE) {
echo "There were errors parsing the XML file.\n";
foreach(libxml_get_errors() as $error) {
echo $error->message;
}
exit;
}
$objJsonDocument = json_encode($objXmlDocument);
$arrOutput = json_decode($objJsonDocument, TRUE);
echo "<pre>";
print_r($arrOutput);

Hybridauth - TwitchTV : error 400 No client id specified after login-

I'm getting an error while using TwitchTV provider on HybridAuth 2.9, after login/permission given. I'm getting well my permission app's page.
'TwitchTV' => [
'enabled' => true,
'keys' => [
'id' => 'xxxxx',
'secret' => 'xxxxx',
],
],
Error :
Fatal error: Uncaught exception 'Hybridauth\Exception\HttpRequestFailedException' with message 'Signed API request has returned an error. HTTP error 400.
Raw Provider API response: {"error":"Bad Request","status":400,"message":"No client id specified"}.' in /home/partagesuv/www/tournaments/oauth/src/Adapter/AbstractAdapter.php:360 Stack trace: #0 /home/partagesuv/www/tournaments/oauth/src/Adapter/OAuth2.php(682): Hybridauth\Adapter\AbstractAdapter->validateApiResponse('Signed API requ...') #1 /home/partagesuv/www/tournaments/oauth/src/Provider/TwitchTV.php(55): Hybridauth\Adapter\OAuth2->apiRequest('user') #2 /home/partagesuv/www/tournaments/oauth/examples/example_06/index.php(41): Hybridauth\Provider\TwitchTV->getUserProfile() #3 {main} thrown in /home/partagesuv/www/tournaments/oauth/src/Adapter/AbstractAdapter.php on line 360
Any ideas on how to resolve this?
Thanks,
Additionnal infos (array after login) :
Array ( [TwitchTV] => Hybridauth\Provider\TwitchTV Object ( [scope:protected] => user_read channel_read [apiBaseUrl:protected] => https://api.twitch.tv/kraken/ [authorizeUrl:protected] => https://api.twitch.tv/kraken/oauth2/authorize [accessTokenUrl:protected] => https://api.twitch.tv/kraken/oauth2/token [accessTokenName:protected] => oauth_token [apiDocumentation:protected] => https://dev.twitch.tv/docs/v5/guides/authentication/ [clientId:protected] => ikp9amliqu9d23wysppu6eahqu1w6l [clientSecret:protected] => secret [accessTokenInfoUrl:protected] => [callback:protected] => http://www.shareyour.live/tournaments/oauth/examples/example_06/callback.php [AuthorizeUrlParameters:protected] => Array ( [response_type] => code [client_id] => ikp9amliqu9d23wysppu6eahqu1w6l [redirect_uri] => http://www.shareyour.live/tournaments/oauth/examples/example_06/callback.php [scope] => user_read channel_read ) [supportRequestState:protected] => 1 [tokenExchangeMethod:protected] => POST [tokenExchangeParameters:protected] => Array ( [client_id] => ikp9amliqu9d23wysppu6eahqu1w6l [client_secret] => secret [grant_type] => authorization_code [redirect_uri] => http://www.shareyour.live/tournaments/oauth/examples/example_06/callback.php ) [tokenExchangeHeaders:protected] => Array ( ) [tokenRefreshMethod:protected] => POST [tokenRefreshParameters:protected] => Array ( [grant_type] => refresh_token [refresh_token] => aueso5pw6zfxijwbytzr9zik0hkfak0s49hs7tpwhvbiodny07 ) [tokenRefreshHeaders:protected] => Array ( ) [apiRequestParameters:protected] => Array ( ) [apiRequestHeaders:protected] => Array ( [Authorization] => Bearer kquwfvdq95ruh0rzmbl1s2zg636oyl ) [providerId:protected] => TwitchTV [config:protected] => Hybridauth\Data\Collection Object ( [collection:protected] => stdClass Object ( [enabled] => 1 [keys] => Array ( [id] => ikp9amliqu9d23wysppu6eahqu1w6l [secret] => secret) [callback] => http://www.shareyour.live/tournaments/oauth/examples/example_06/callback.php ) ) [params:protected] => [storage] => Hybridauth\Storage\Session Object ( [storeNamespace:protected] => HYBRIDAUTH::STORAGE [keyPrefix:protected] => ) [httpClient] => Hybridauth\HttpClient\Curl Object ( [curlOptions:protected] => Array ( [13] => 30 [78] => 30 [64] => [81] => [19913] => 1 [52] => 1 [68] => 5 [2] => 1 [10102] => identity [10018] => HybridAuth, PHP Social Authentication Library (https://github.com/hybridauth/hybridauth) ) [requestArguments:protected] => Array ( ) [requestHeader:protected] => Array ( [Accept] => / [Cache-Control] => max-age=0 [Connection] => keep-alive [Expect] => [Pragma] => ) [responseBody:protected] => [responseHeader:protected] => Array ( ) [responseHttpCode:protected] => 0 [responseClientError:protected] => [responseClientInfo:protected] => Array ( ) [logger:protected] => Hybridauth\Logger\Logger Object ( [level:protected] => none [file:protected] => ) ) [logger] => Hybridauth\Logger\Logger Object ( [level:protected] => none [file:protected] => ) [validateApiResponseHttpCode:protected] => 1 ) )
This was a bug, fixed in the latest v3.
See https://github.com/hybridauth/hybridauth/pull/956

WSDL TO PHP implementation

I got converted WSDL to PHP script but something is not working very I am trying to connect http://www.regcheck.org.uk/api/reg.asmx?wsdl, but getting this error
Array ( [RegCheckServiceCheck::Check] => SoapFault Object ( [message:protected] => System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object. at webtropy.CarReg.Check(String RegistrationNumber, String username) in c:\inetpub\wwwroot\regcheck.org.uk\api\reg.asmx:line 26 --- End of inner exception stack trace --- [string:Exception:private] => [code:protected] => 0 [file:protected] => C:\xampp\htdocs\Check\RegCheckServiceCheck.php [line:protected] => 32 [trace:Exception:private] => Array ( [0] => Array ( [file] => C:\xampp\htdocs\Check\RegCheckServiceCheck.php [line] => 32 [function] => __call [class] => SoapClient [type] => -> [args] => Array ( [0] => Check [1] => Array ( [0] => RegCheckStructCheck Object ( [RegistrationNumber] => [username] => [result:RegCheckWsdlClass:private] => [lastError:RegCheckWsdlClass:private] => Array ( ) [internArrayToIterate:RegCheckWsdlClass:private] => [internArrayToIterateIsArray:RegCheckWsdlClass:private] => [internArrayToIterateOffset:RegCheckWsdlClass:private] => ) ) ) ) [1] => Array ( [file] => C:\xampp\htdocs\Check\RegCheckServiceCheck.php [line] => 32 [function] => Check [class] => SoapClient [type] => -> [args] => Array ( [0] => RegCheckStructCheck Object ( [RegistrationNumber] => [username] => [result:RegCheckWsdlClass:private] => [lastError:RegCheckWsdlClass:private] => Array ( ) [internArrayToIterate:RegCheckWsdlClass:private] => [internArrayToIterateIsArray:RegCheckWsdlClass:private] => [internArrayToIterateOffset:RegCheckWsdlClass:private] => ) ) ) [2] => Array ( [file] => C:\xampp\htdocs\sample-regcheck.php [line] => 46 [function] => Check [class] => RegCheckServiceCheck [type] => -> [args] => Array ( [0] => RegCheckStructCheck Object ( [RegistrationNumber] => [username] => [result:RegCheckWsdlClass:private] => [lastError:RegCheckWsdlClass:private] => Array ( ) [internArrayToIterate:RegCheckWsdlClass:private] => [internArrayToIterateIsArray:RegCheckWsdlClass:private] => [internArrayToIterateOffset:RegCheckWsdlClass:private] => ) ) ) ) [previous:Exception:private] => [faultstring] => System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object. at webtropy.CarReg.Check(String RegistrationNumber, String username) in c:\inetpub\wwwroot\regcheck.org.uk\api\reg.asmx:line 26 --- End of inner exception stack trace --- [faultcode] => soap:Server [detail] => ) )
I am sure something is missing in config files, mybe someone got idea ?
It's possible to call that web service via a HTTP GET request as follows;
<?php
$username = 'Your username here';
$regNumber = 'SK08KPT';
$xmlData = file_get_contents("https://www.regcheck.org.uk/api/reg.asmx/Check?RegistrationNumber=" . $regNumber ."&username=" . $username);
$xml=simplexml_load_string($xmlData);
$strJson = $xml->vehicleJson;
$json = json_decode($strJson);
print_r($json->Description);
?>
Not as elegant as a SOAP call, but simpler.
Script open source files
You can see all main files
https://www.wsdltophp.com/Wsdls/8a71627601a684624c5694104cce023f/RegCheck-1-0-1-1-1-1-0-0-0-0

Extracting data from simplexml_load_file not working

I'm stuck on getting a value from a xml file, I've decided to use simplexml as it makes life easier but atm its doing the opposite.
My xml file look something like this:
<?xml version="1.0"?>
<fslb server="12345">
<statistics>
<frontend-connections>145</frontend-connections>
<global-response-time-average>1899ms</global-response-time-average>
<ecm-blacklist-size>0</ecm-blacklist-size>
<backend-connections>0 of 0</backend-connections>
<global-max-response-time>6888ms</global-max-response-time>
<global-ecm-cache-size>2396</global-ecm-cache-size>
<global-queue-length>0</global-queue-length>
<global-sidless-poll-average>0.00</global-sidless-poll-average>
<actual-card-requests>0</actual-card-requests>
<sid-sidless-requests>75% [109]/24% [36]</sid-sidless-requests>
<invalidated-clients>0</invalidated-clients>
<global-queue-average>0.00</global-queue-average>
<global-max-sidless-polls>0</global-max-sidless-polls>
<average-requests-per-card>0.00</average-requests-per-card>
<global-cache-efficiency>0%</global-cache-efficiency>
<total-requests-received>102934</total-requests-received>
</statistics>
<active-users>
<user name="RS.DOS" unread-messages="0" ipaddress="xxxx" client="Mgcamd" loggedonsince="2014-08-18 06:01:03p" requests="338" period=" 8.53" sid="0695" service-name="INT" request-handling="Queued in GC (External)" hop-list="[0]: None" hash="DE:26" latency="1900" />
<user name="S9" unread-messages="0" ipaddress="xxxx" client="Mgcamd" loggedonsince="2014-08-18 06:01:03p" requests="263" period="10.97" sid="0174" service-name=" XD" request-handling="Queued in GC (External)" hop-list="[0]: None" hash="80:C0" latency="748" />
<user name="M1" unread-messages="0" ipaddress="174.93.86.83" client="Newcamd" loggedonsince="2014-08-18 06:01:03p" requests="12844" period=" 0.22" sid="0688" service-name="INT" request-handling="Global Cached CWs" hop-list="[0]: None" hash="4A:3F" latency="0" />
<user name="S9" unread-messages="0" ipaddress="xxxx" client="Mgcamd" loggedonsince="2014-08-18 06:01:03p" requests="300" period=" 9.61" sid="0650" service-name="INT" request-handling="Queued in GC (External)" hop-list="[0]: None" hash="8A:4C" latency="909" />
</active-users>
</fslb>
My end goal is to extract the data from one "user" line (or the statistics line) and output it to mysql so that its saved in my db. The outputting part seems pretty easy, however I can't even get the data to be extracted in the first place -.-. This is my php code:
ini_set("user_agent","Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
ini_set("max_execution_time", 0);
ini_set("memory_limit", "10000M");
$file_xml = "users.xml";
if(!file_exists($file_xml))
{
exit('Failed to open');
}
$fslb = simplexml_load_file($file_xml, 'SimpleXMLElement',LIBXML_NOCDATA);
$json_string = json_encode($fslb);
$result_array = json_decode($json_string, TRUE);
//print_r($fslb);
echo('<p> Total number of connections: ');
echo $result_array->statistics[0]->{'frontend-connections'};
echo('</p>');
echo('<p> Global-response-time-average: ');
echo $result_array->statistics[0]->{'global-response-time-average'};
echo('</p>');
I've spent hours trying to figure out how I can extract some data but it just wont go!
SimpleXMLElement Object ( [#attributes] => Array ( [server] => 12345 ) [statistics] => SimpleXMLElement Object ( [frontend-connections] => 145 [global-response-time-average] => 1899ms [ecm-blacklist-size] => 0 [backend-connections] => 0 of 0 [global-max-response-time] => 6888ms [global-ecm-cache-size] => 2396 [global-queue-length] => 0 [global-sidless-poll-average] => 0.00 [actual-card-requests] => 0 [sid-sidless-requests] => 75% [109]/24% [36] [invalidated-clients] => 0 [global-queue-average] => 0.00 [global-max-sidless-polls] => 0 [average-requests-per-card] => 0.00 [global-cache-efficiency] => 0% [total-requests-received] => 102934 ) [active-users] => SimpleXMLElement Object ( [user] => Array ( [0] => SimpleXMLElement Object ( [#attributes] => Array ( [name] => RS.DOS [unread-messages] => 0 [ipaddress] => xxxx [client] => Mgcamd [loggedonsince] => 2014-08-18 06:01:03p [requests] => 338 [period] => 8.53 [sid] => 0695 [service-name] => INT [request-handling] => Queued in GC (External) [hop-list] => [0]: None [hash] => DE:26 [latency] => 1900 ) ) [1] => SimpleXMLElement Object ( [#attributes] => Array ( [name] => S9 [unread-messages] => 0 [ipaddress] => xxxx [client] => Mgcamd [loggedonsince] => 2014-08-18 06:01:03p [requests] => 263 [period] => 10.97 [sid] => 0174 [service-name] => XD [request-handling] => Queued in GC (External) [hop-list] => [0]: None [hash] => 80:C0 [latency] => 748 ) ) [2] => SimpleXMLElement Object ( [#attributes] => Array ( [name] => M1 [unread-messages] => 0 [ipaddress] => 174.93.86.83 [client] => Newcamd [loggedonsince] => 2014-08-18 06:01:03p [requests] => 12844 [period] => 0.22 [sid] => 0688 [service-name] => INT [request-handling] => Global Cached CWs [hop-list] => [0]: None [hash] => 4A:3F [latency] => 0 ) ) [3] => SimpleXMLElement Object ( [#attributes] => Array ( [name] => S9 [unread-messages] => 0 [ipaddress] => xxxx [client] => Mgcamd [loggedonsince] => 2014-08-18 06:01:03p [requests] => 300 [period] => 9.61 [sid] => 0650 [service-name] => INT [request-handling] => Queued in GC (External) [hop-list] => [0]: None [hash] => 8A:4C [latency] => 909 ) ) ) ) )
That works for me
var_dump((string)$fslb->statistics->{"frontend-connections"});
http://php.net/manual/en/simplexmlelement.tostring.php

PHP SoapClient Version Mismatch [duplicate]

This question already has answers here:
Does this SOAP Fault mean what I think it means?
(3 answers)
Closed 8 years ago.
There is nothing too much to write here other than this error message :
SoapFault Object ( [message:protected] => Wrong Version [string:Exception:private] => [code:protected] => 0 [file:protected] => C:\wamp\www\nsoap\phpclient.php [line:protected] => 10 [trace:Exception:private] => Array ( [0] => Array ( [file] => C:\wamp\www\nsoap\phpclient.php [line] => 10 [function] => __call [class] => SoapClient [type] => -> [args] => Array ( [0] => getIMIPremium [1] => Array ( [0] => Array ( [imiPolicy] => Array ( [expiryDate] => 23-09-2013 [imiInsured] => Array ( [item] => Array ( [item] => Array ( [age] => 23 [basicSumInsured] => 33233 [coverRageType] => 12 [dateOfBirth] => 26-09-1986 [preExistingDisease] => no ) ) ) [inceptionDate] => 12-09-2009 [noOfInsured] => 1 [partnerCode] => 2121 [stateCode] => 233 ) ) ) ) ) [1] => Array ( [file] => C:\wamp\www\nsoap\phpclient.php [line] => 10 [function] => getIMIPremium [class] => SoapClient [type] => -> [args] => Array ( [0] => Array ( [imiPolicy] => Array ( [expiryDate] => 23-09-2013 [imiInsured] => Array ( [item] => Array ( [item] => Array ( [age] => 23 [basicSumInsured] => 33233 [coverRageType] => 12 [dateOfBirth] => 26-09-1986 [preExistingDisease] => no ) ) ) [inceptionDate] => 12-09-2009 [noOfInsured] => 1 [partnerCode] => 2121 [stateCode] => 233 ) ) ) ) ) [previous:Exception:private] => [faultstring] => Wrong Version [faultcode] => VersionMismatch [faultcodens] => http://schemas.xmlsoap.org/soap/envelope/ [xdebug_message] => ( ! ) SoapFault: Wrong Version in C:\wamp\www\nsoap\phpclient.php on line 10 Call Stack #TimeMemoryFunctionLocation 10.0009674576{main}( )..\phpclient.php:0 20.0704702744SoapClient->getIMIPremium( )..\phpclient.php:10 )
Is it possible that there is an error in the client php code for it ? I have tried NuSoap, but it is also generating error that "Call error: Response not of type text/xml: application/wsdl+xmlHTTP/1.1 200 OK Date: Tue, 17 Sep 2013 16:55:39 GMT Server: Apache/2.2.22 (Win64) PHP/5.3.13 Last-Modified: Tue, 17 Sep 2013 13:18:39 GMT ETag: "a0000000a818c-12e9-4e69428b54054" Accept-Ranges: bytes Content-Length: 4841 Connection: close Content-Type: application/wsdl+xml ".
Do you know any fix for it ?
PHP Code :
<?php
try{
$client = new SoapClient("http://mysite.com/nsoap/IMIPremiumWebService.wsdl");
$args= array("imiPolicy" => array("expiryDate" => "23-09-2013", "imiInsured" =>array("item" => array("item" => array("age"=>'23', "basicSumInsured"=>'33233', "coverRageType"=>'12',"dateOfBirth"=>'26-09-1986',"preExistingDisease" => 'no'))), "inceptionDate"=>"12-09-2009" ,"noOfInsured"=>'1',"partnerCode" => '2121', "stateCode" => '233'));
$something = $client->getIMIPremium($args);
echo $client->responseData;
print_r($something);
}
catch (Exception $e)
{
echo "*****************";
print_r($e);
}
?>
You can find wsdl here (in my question related to NuSOAP:
WSDL Client Not Working
A little bit of googling with that particular error message reveals that it might be related to the Soap server answering in Soap version 1.2, while the default setting in PHP is Soap version 1.1.
Try adding an options array to the SoapClient with array('soap_version'=> SOAP_1_2) as the second parameter (see http://de1.php.net/manual/en/soapclient.soapclient.php for details).

Categories