Re: Help with Soap Client

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

 



Hi Naveen,

Now I can get the soap response back with the following code, but my
new problem is how I can parse out information from returned stdClass
Object. Originally I thought about using simplexml to get what I need,
but it didn't work since the returned results are in stdClass Objects.
I also listed the response I got from this code.

////////////////////
<?php

ini_set("soap.wsdl_cache_enabled", "0");
ini_set('default_socket_timeout', 600);
$client = new SoapClient("ss.wsdl",
                          array('trace'=> 1,
				'exceptions'=> 1,
				)
		        );
try {
 $a=$client->getStationCount(43.1,43.5,-83.5,-81.2);
 $stresults=$client->getStationsForMap(43.1,43.5,-83.5,-81.2);
 print $a;
 print_r($stresults);
} catch (SoapFault $exception) {
    echo $exception;
}

?>
/////////////////////////////////

////////////////////////////
stdClass Object ( [WQX] => stdClass Object ( [Organization] => Array (
[0] => stdClass Object ( [OrganizationDescription] => stdClass Object
( [OrganizationIdentifier] => 21MICH [OrganizationFormalName] =>
Michigan Department of Environmental Quality ) [MonitoringLocation] =>
Array ( [0] => stdClass Object ( [MonitoringLocationIdentity] =>
stdClass Object ( [MonitoringLocationIdentifier] => 760172
[MonitoringLocationName] => BERRY DRAIN AT UPSTREAM SANDUSKY WWTP;
T11N R14E S04 [MonitoringLocationTypeName] => River/Stream )
[MonitoringLocationGeospatial] => stdClass Object ( [LatitudeMeasure]
=> 43.41801 [LongitudeMeasure] => -82.81985 ) ) [1] => stdClass Object
( [MonitoringLocationIdentity] => stdClass Object (
[MonitoringLocationIdentifier] => 760089 [MonitoringLocationName] =>
BERRY DRAIN AT CUSTER ROAD BRIDGE; CUSTER TOWNSHIP, SEC 24
[MonitoringLocationTypeName] => River/Stream )
[MonitoringLocationGeospatial] => stdClass Object ( [LatitudeMeasure]
=> 43.452781 [LongitudeMeasure] => -82.752227 ) ) [2] => stdClass
Object ( [MonitoringLocationIdentity] => stdClass Object (
[MonitoringLocationIdentifier] => 760197 [MonitoringLocationName] =>
Lake Huron, Birch Beach South #1 [MonitoringLocationTypeName] => BEACH
Program Site-Lake ) [MonitoringLocationGeospatial] => stdClass Object
( [LatitudeMeasure] => 43.20194 [LongitudeMeasure] => -82.51139 ) )
[3] => stdClass Object ( [MonitoringLocationIdentity] => stdClass
Object ( [MonitoringLocationIdentifier] => 760174
[MonitoringLocationName] => BERRY DRAIN AT DOWNSTREAM SANDUSKY WWTP;
T11N R14E S04 [MonitoringLocationTypeName] => River/Stream )
[MonitoringLocationGeospatial] => stdClass Object ( [LatitudeMeasure]
=> 43.4211 [LongitudeMeasure] => -82.8199 ) ) [4] => stdClass Object (
[MonitoringLocationIdentity] => stdClass Object (
[MonitoringLocationIdentifier] => 760201 [MonitoringLocationName] =>
Lake Huron, Lexington Beach [MonitoringLocationTypeName] => BEACH
Program Site-Lake ) [MonitoringLocationGeospatial] => stdClass Object
( [LatitudeMeasure] => 43.26965 [LongitudeMeasure] => -82.52617 ) )
[5] => stdClass Object ( [MonitoringLocationIdentity] => stdClass
Object ( [MonitoringLocationIdentifier] => 760180
[MonitoringLocationName] => MILLER CREEK AT HURON VIEW ROAD; SANILAC
TOWNSHIP, SEC 21 [MonitoringLocationTypeName] => River/Stream )
[MonitoringLocationGeospatial] => stdClass Object ( [LatitudeMeasure]
=> 43.4694 [LongitudeMeasure] => -82.5745 ) ) [6] => stdClass Object (
[MonitoringLocationIdentity] => stdClass Object (
[MonitoringLocationIdentifier] => 250444 [MonitoringLocationName] =>
HOLLOWAY RES. IN S.CENT.BAS. RICHFIELD TOWNSHIP SEC12
[MonitoringLocationTypeName] => Lake ) [MonitoringLocationGeospatial]
=> stdClass Object ( [LatitudeMeasure] => 43.112504 [LongitudeMeasure]
=> -83.462782 ) ) [7] => stdClass Object (
[MonitoringLocationIdentity] => stdClass Object (
[MonitoringLocationIdentifier] => 760207 [MonitoringLocationName] =>
BERRY DRAIN UPSTREAM OF STRINGER ROAD (U/S MICHIGAN PEAT OUT
[MonitoringLocationTypeName] => River/Stream )
[MonitoringLocationGeospatial] => stdClass Object ( [LatitudeMeasure]
=> 43.4223957 [LongitudeMeasure] => -82.790092 ) ) [8] => stdClass
Object ( [MonitoringLocationIdentity] => stdClass Object (
[MonitoringLocationIdentifier] => 790157 [MonitoringLocationName] =>
EVERGREEN CREEK AT WATERMAN ROAD; T11N R08E S01
[MonitoringLocationTypeName] => River/Stream )
[MonitoringLocationGeospatial] => stdClass Object ( [LatitudeMeasure]
=> 43.3943 [LongitudeMeasure] => -83.476 ) ) [9] => stdClass Object (
[MonitoringLocationIdentity] => stdClass Object (
[MonitoringLocationIdentifier] => 760090 [MonitoringLocationName] =>
BERRY DRAIN 0.1 MILES FROM MOUTH; BRHAMPTON TOWNSHIP,
[MonitoringLocationTypeName] => River/Stream )
[MonitoringLocationGeospatial] => stdClass Object ( [LatitudeMeasure]
=> 43.453337 [LongitudeMeasure] => -82.745837 ) ) [10] => stdClass
Object ( [MonitoringLocationIdentity] => stdClass Object (
[MonitoringLocationIdentifier] => 760199 [MonitoringLocationName] =>
Lake Huron, Birch Beach Middle #2 [MonitoringLocationTypeName] =>
BEACH Program Site-Lake ) [MonitoringLocationGeospatial] => stdClass
Object ( [LatitudeMeasure] => 43.19766 [LongitudeMeasure] => -82.5093
) ) [11] => stdClass Object ( [MonitoringLocationIdentity] => stdClass
Object ( [MonitoringLocationIdentifier] => 760198
[MonitoringLocationName] => Lake Huron, Birch Beach North #3
[MonitoringLocationTypeName] => BEACH Program Site-Lake )
[MonitoringLocationGeospatial] => stdClass Object ( [LatitudeMeasure]
=> 43.20249 [LongitudeMeasure] => -82.51188 ) ) [12] => stdClass
Object ( [MonitoringLocationIdentity] => stdClass Object (
[MonitoringLocationIdentifier] => 760206 [MonitoringLocationName] =>
DWIGHT DRAIN AT STRINGER ROAD, T12N R14E S34
[MonitoringLocationTypeName] => River/Stream )
[MonitoringLocationGeospatial] => stdClass Object ( [LatitudeMeasure]
=> 43.4405246 [LongitudeMeasure] => -82.792078 ) ) [13] => stdClass
Object ( [MonitoringLocationIdentity] => stdClass Object (
[MonitoringLocationIdentifier] => 760087 [MonitoringLocationName] =>
BERRY DRN AT STRINGER ROAD BRIDGE; CUSTER TOWNSHIP, SEC 35
[MonitoringLocationTypeName] => River/Stream )
[MonitoringLocationGeospatial] => stdClass Object ( [LatitudeMeasure]
=> 43.422503 [LongitudeMeasure] => -82.790838 ) ) [14] => stdClass
Object ( [MonitoringLocationIdentity] => stdClass Object (
[MonitoringLocationIdentifier] => 440103 [MonitoringLocationName] =>
OTTER LK. IN S-CENT.BASIN,MARATHON TOWNSHIP.,SEC.6
[MonitoringLocationTypeName] => Lake ) [MonitoringLocationGeospatial]
=> stdClass Object ( [LatitudeMeasure] => 43.21667 [LongitudeMeasure]
=> -83.458892 ) ) [15] => stdClass Object (
[MonitoringLocationIdentity] => stdClass Object (
[MonitoringLocationIdentifier] => 760200 [MonitoringLocationName] =>
Lake Huron, Lexington County Park [MonitoringLocationTypeName] =>
BEACH Program Site-Lake ) [MonitoringLocationGeospatial] => stdClass
Object ( [LatitudeMeasure] => 43.31639 [LongitudeMeasure] => -82.52889
) ) [16] => stdClass Object ( [MonitoringLocationIdentity] => stdClass
Object ( [MonitoringLocationIdentifier] => 730088
[MonitoringLocationName] => CASS RIVER AT STUDOR ROAD; T11N R05E S17
[MonitoringLocationTypeName] => River/Stream )
[MonitoringLocationGeospatial] => stdClass Object ( [LatitudeMeasure]
=> 43.351949 [LongitudeMeasure] => -82.91528 ) ) [17] => stdClass
Object ( [MonitoringLocationIdentity] => stdClass Object (
[MonitoringLocationIdentifier] => 760202 [MonitoringLocationName] =>
Lake Huron, Port Sanilac Park [MonitoringLocationTypeName] => BEACH
Program Site-Lake ) [MonitoringLocationGeospatial] => stdClass Object
( [LatitudeMeasure] => 43.43832 [LongitudeMeasure] => -82.54007 ) ) )
) [1] => stdClass Object ( [OrganizationDescription] => stdClass
Object ( [OrganizationIdentifier] => NARS [OrganizationFormalName] =>
EPA National Aquatic Resource Survey Data ) [MonitoringLocation] =>
Array ( [0] => stdClass Object ( [MonitoringLocationIdentity] =>
stdClass Object ( [MonitoringLocationIdentifier] => OWW04440-0418
[MonitoringLocationName] => Bottom Creek [MonitoringLocationTypeName]
=> River/Stream ) [MonitoringLocationGeospatial] => stdClass Object (
[LatitudeMeasure] => 43.2 [LongitudeMeasure] => -83.2 ) ) [1] =>
stdClass Object ( [MonitoringLocationIdentity] => stdClass Object (
[MonitoringLocationIdentifier] => OWW04440-0482
[MonitoringLocationName] => HEMMINGWAY AND WHIPPLE DRAIN
[MonitoringLocationTypeName] => River/Stream )
[MonitoringLocationGeospatial] => stdClass Object ( [LatitudeMeasure]
=> 43.18 [LongitudeMeasure] => -83.4 ) ) ) ) [2] => stdClass Object (
[OrganizationDescription] => stdClass Object (
[OrganizationIdentifier] => 21MICH_WQX [OrganizationFormalName] =>
Michigan Department of Environmental Quality ) [MonitoringLocation] =>
Array ( [0] => stdClass Object ( [MonitoringLocationIdentity] =>
stdClass Object ( [MonitoringLocationIdentifier] => 740413
[MonitoringLocationName] => Washington Street Park
[MonitoringLocationTypeName] => BEACH Program Site-Great Lake )
[MonitoringLocationGeospatial] => stdClass Object ( [LatitudeMeasure]
=> 43.112637 [LongitudeMeasure] => -82.487213 ) ) [1] => stdClass
Object ( [MonitoringLocationIdentity] => stdClass Object (
[MonitoringLocationIdentifier] => 740405 [MonitoringLocationName] =>
Jeddo Road Beach [MonitoringLocationTypeName] => BEACH Program
Site-Great Lake ) [MonitoringLocationGeospatial] => stdClass Object (
[LatitudeMeasure] => 43.155186 [LongitudeMeasure] => -82.498795 ) )
[2] => stdClass Object ( [MonitoringLocationIdentity] => stdClass
Object ( [MonitoringLocationIdentifier] => 760200
[MonitoringLocationName] => Lexington County Park
[MonitoringLocationTypeName] => BEACH Program Site-Great Lake )
[MonitoringLocationGeospatial] => stdClass Object ( [LatitudeMeasure]
=> 43.316391 [LongitudeMeasure] => -82.528893 ) ) [3] => stdClass
Object ( [MonitoringLocationIdentity] => stdClass Object (
[MonitoringLocationIdentifier] => 760202 [MonitoringLocationName] =>
Port Sanilac Park [MonitoringLocationTypeName] => BEACH Program
Site-Great Lake ) [MonitoringLocationGeospatial] => stdClass Object (
[LatitudeMeasure] => 43.43832 [LongitudeMeasure] => -82.54007 ) ) [4]
=> stdClass Object ( [MonitoringLocationIdentity] => stdClass Object (
[MonitoringLocationIdentifier] => 760201 [MonitoringLocationName] =>
Lexington Beach [MonitoringLocationTypeName] => BEACH Program
Site-Great Lake ) [MonitoringLocationGeospatial] => stdClass Object (
[LatitudeMeasure] => 43.26965 [LongitudeMeasure] => -82.526169 ) ) [5]
=> stdClass Object ( [MonitoringLocationIdentity] => stdClass Object (
[MonitoringLocationIdentifier] => 740406 [MonitoringLocationName] =>
Burtchville Township Park [MonitoringLocationTypeName] => BEACH
Program Site-Great Lake ) [MonitoringLocationGeospatial] => stdClass
Object ( [LatitudeMeasure] => 43.145527 [LongitudeMeasure] =>
-82.495018 ) ) [6] => stdClass Object ( [MonitoringLocationIdentity]
=> stdClass Object ( [MonitoringLocationIdentifier] => 740401
[MonitoringLocationName] => Lakeport State Campground
[MonitoringLocationTypeName] => BEACH Program Site-Great Lake )
[MonitoringLocationGeospatial] => stdClass Object ( [LatitudeMeasure]
=> 43.126648 [LongitudeMeasure] => -82.492172 ) ) [7] => stdClass
Object ( [MonitoringLocationIdentity] => stdClass Object (
[MonitoringLocationIdentifier] => 740400 [MonitoringLocationName] =>
Lakeport State Park [MonitoringLocationTypeName] => BEACH Program
Site-Great Lake ) [MonitoringLocationGeospatial] => stdClass Object (
[LatitudeMeasure] => 43.107735 [LongitudeMeasure] => -82.486801 ) ) )
) ) ) )
//////////////////////////////////////

Again, thanks a lot for your help!
Tom


On Sun, Apr 19, 2009 at 9:15 AM, NAVEEN <naveenkr2001@yahoo.com> wrote:
> Hi Tom,
>
> The problem is in the WSDL.
> Search for  those lines  having  use="encoded" in WSDL file and append
>  encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" ; with them.
>
> Previous:
>  use="encoded"
> After Modification :
>  use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
>
> Hope it works!
>
> Naveen
>
> --- On Sun, 4/19/09, EPA WC <epawcweb@gmail.com> wrote:
>
> From: EPA WC <epawcweb@gmail.com>
> Subject:  Help with Soap Client
> To: soap@lists.php.net
> Date: Sunday, April 19, 2009, 9:57 AM
>
> Hi All,
>
> I am using the following code to build a SoapClient with some web service:
>
> ////////////////
> <?php
>
> ini_set("soap.wsdl_cache_enabled", "0");
> ini_set('default_socket_timeout', 600);
> $client = new
> SoapClient("http://iaspub.epa.gov/webservices/StationService/index.html?WSDL",array('trace'
> => 1));
> try {
> $sc = $client->getStationCount(43.1,43.5,-83.5,-83.1);
> print $sc;
> } catch (SoapFault $exception) {
>     echo $exception;
> }
>
> ?>
> //////////////
>
> But I got the following error:
> ///////////////
> Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing
> WSDL: Unspecified encodingStyle in /var/www/myphp/wqxststest.php:5
> Stack trace: #0 /var/www/myphp/wqxststest.php(5):
> SoapClient->SoapClient('http://iaspub.e...', Array) #1 {main} thrown
> in /var/www/myphp/wqxststest.php on line 5
> ///////////////
>
> Also when I tried same code (See below) with another service, it seems
> working fine.
> ///////////////
> <?php
> $huc = $_REQUEST['huc'];
> ini_set("soap.wsdl_cache_enabled", "0");
> ini_set('default_socket_timeout', 600);
> $client = new
> SoapClient("http://iaspub.epa.gov/webservices/WatershedSummaryService/index.html?WSDL",array('trace'
> => 1));
> try {
> $client->getCharacteristicSummary($huc);
> print $client->__getLastResponse();
> } catch (SoapFault $exception) {
>     echo $exception;
> }
> ///////////////
> ?>
>
> I tried to find what's causing this error on Google but no success.
> Anyone know what's going on?
>
> Your help is highly appreciated!
>
> Tom
>
> --
> PHP Soap Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

-- 
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