2008年10月29日星期三

RE: [fw-webservices] See the soap message

I have found another webservice to test with. And i got a result.
Here is my message:

<?
set_include_path('./library/');
require_once('Zend/Loader.php');
Zend_Loader::registerAutoload();
$wsdl = "http://www.webservicex.com/globalweather.asmx?WSDL";
$client = new Zend_Soap_Client($wsdl);
$client ->setSoapVersion(SOAP_1_1);
$params =array(
'CityName' => 'Antwerp',
'CountryName' => 'Belgium'
);
$client->GetWeather($params);
$bla = $client->getLastResponse();
Zend_Debug::dump($bla, 'bla',true);

?>

The result is:
bla string(1087) "<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><GetWeatherResponse
xmlns="http://www.webserviceX.NET"><GetWeatherResult>&lt;?xml version="1.0"
encoding="utf-16"?&gt;
&lt;CurrentWeather&gt;
&lt;Location&gt;Antwerpen / Deurne, Belgium (EBAW) 51-12N 004-28E
14M&lt;/Location&gt;
&lt;Time&gt;Oct 29, 2008 - 06:20 AM EST / 2008.10.29 1120 UTC&lt;/Time&gt;
&lt;Wind&gt; from the E (100 degrees) at 3 MPH (3 KT) (direction
variable):0&lt;/Wind&gt;
&lt;Visibility&gt; 4 mile(s):0&lt;/Visibility&gt;
&lt;SkyConditions&gt; mostly clear&lt;/SkyConditions&gt;
&lt;Temperature&gt; 46 F (8 C)&lt;/Temperature&gt;
&lt;DewPoint&gt; 39 F (4 C)&lt;/DewPoint&gt;
&lt;RelativeHumidity&gt; 75%&lt;/RelativeHumidity&gt;
&lt;Pressure&gt; 29.80 in. Hg (1009 hPa)&lt;/Pressure&gt;
&lt;Status&gt;Success&lt;/Status&gt;
&lt;/CurrentWeather&gt;</GetWeatherResult></GetWeatherResponse></soap:Body></soap:Envelope>"

My question is why the < and > are escaped.

DerMika wrote:
>
> Hello,
>
> When I go to http://www.ejse.com/WeatherService/Service.asmx and invoke
> the webservice through the browser, I get the same error. I think you
> need to use a different soap server to test your client ;)
>
> Dieter
>
> -----Original Message-----
> From: jjsanders [mailto:jigalroecha@gmail.com]
> Sent: dinsdag 28 oktober 2008 16:37
> To: fw-webservices@lists.zend.com
> Subject: RE: [fw-webservices] See the soap message
>
>
> I think i still don't understand it.
>
> I tried a testserver:
>
> <?
> set_include_path('./library/');
> require_once('Zend/Loader.php');
> Zend_Loader::registerAutoload();
>
> $wsdl = "http://www.ejse.com/WeatherService/Service.asmx?WSDL";
> $options = array('trace' => true);
>
> $client = new Zend_Soap_Client($wsdl);
> $client ->setEncoding("UTF-8");
> $client ->setSoapVersion(SOAP_1_1);
> $params = array(
> "zipCode" => '1082'
> );
> $client->GetWeatherInfo($params);
> $bla = $client->getLastRequest();
> Zend_Debug::dump($bla, 'bla',true);
>
> ?>
>
> But this gives me the result:
> Fatal error: Uncaught SoapFault exception: [soap:Server] Server was
> unable
> to process request. --> Object reference not set to an instance of an
> object. in /usr/local/wwwroot/jigal/library/Zend/Soap/Client.php:887
> Stack
> trace: #0 [internal function]: SoapClient->__call('GetWeatherInfo',
> Array)
> #1 [internal function]: Zend_Soap_Client_Common->GetWeatherInfo(Array)
> #2
> /usr/local/wwwroot/jigal/library/Zend/Soap/Client.php(887):
> call_user_func_array(Array, Array) #3 [internal function]:
> Zend_Soap_Client->__call('GetWeatherInfo', Array) #4
> /usr/local/wwwroot/jigal/wstest.php(15):
> Zend_Soap_Client->GetWeatherInfo(Array) #5 {main} thrown in
> /usr/local/wwwroot/jigal/library/Zend/Soap/Client.php on line 887
>
> DerMika wrote:
>>
>> Well, assuming the soap server has a method TestMe (defined in the
> WSDL
>> for example) with a parameter number (which is of type integer) you do
>> this:
>>
>> $client->TestMe(array($number));
>>
>> $bla = $client->getLastRequest();
>>
>> You can also do this:
>>
>> $client->__call('TestMe', array($number));
>>
>> $bla = $client->getLastRequest();
>>
>>
>>
>> -----Original Message-----
>> From: jjsanders [mailto:jigalroecha@gmail.com]
>> Sent: dinsdag 28 oktober 2008 13:29
>> To: fw-webservices@lists.zend.com
>> Subject: RE: [fw-webservices] See the soap message
>>
>>
>> ok but then I first need to do an request. .. I assume.
>> How do I do that?
>> How do I send out an SoapRequest?
>>
>> This is what I have till now:
>>
>> $options = array('trace' => true);
>>
>> $client = new Zend_Soap_Client($wsdl);
>> $client ->setEncoding("UTF-8");
>> $client ->setSoapVersion(SOAP_1_1);
>>
>> $bla = $client->getLastRequest();
>>
>> Zend_Debug::dump($bla, 'bla',true);
>>
>> beberlei wrote:
>>>
>>>
>>> this is why its called "getLastRequest", you can only use it AFTER
> the
>>> request has been fired. How should it know which soap Action with
>> which
>>> parameters you are calling?
>>>
>>> On Tue, 28 Oct 2008 02:00:24 -0700 (PDT), jjsanders
>>> <jigalroecha@gmail.com>
>>> wrote:
>>>>
>>>> Okaay,
>>>>
>>>> But why then do i get an empty string?
>>>> I just want to see the soap message before it gets sent?
>>>>
>>>> DerMika wrote:
>>>>>
>>>>> Trace is enabled by default in Zend_Soap_Client. You don't have to
>>>>> define it.
>>>>>
>>>>> Just use the getlastresponse and getlastrequest methods, they
> should
>>>>> work.
>>>>>
>>>>> Dieter
>>>>>
>>>>> -----Original Message-----
>>>>> From: jjsanders [mailto:jigalroecha@gmail.com]
>>>>> Sent: dinsdag 28 oktober 2008 9:20
>>>>> To: fw-webservices@lists.zend.com
>>>>> Subject: Re: [fw-webservices] See the soap message
>>>>>
>>>>>
>>>>> When i do $client = new Zend_Soap_Client($wsdl, array('trace' =>
>> true));
>>>>> I get the error message:
>>>>> Fatal error: Uncaught exception 'Zend_Soap_Client_Exception' with
>>>>> message
>>>>> 'Unknown SOAP client option' in
>>>>> /usr/local/wwwroot/jigal/library/Zend/Soap/Client.php:223 Stack
>> trace:
>>>>> #0
>>>>> /usr/local/wwwroot/jigal/library/Zend/Soap/Client.php(122):
>>>>> Zend_Soap_Client->setOptions(Array) #1
>>>>> /usr/local/wwwroot/jigal/wstest.php(10):
>>>>> Zend_Soap_Client->__construct('http://andijvie...', Array) #2
> {main}
>>>>> thrown
>>>>> in /usr/local/wwwroot/jigal/library/Zend/Soap/Client.php on line
> 223
>>>>>
>>>>> Furthermore:
>>>>>
>>>>> this
>>>>> $client = new Zend_Soap_Client($wsdl, $options);
>>>>> $client ->setEncoding("UTF-8");
>>>>> $client ->setSoapVersion(SOAP_1_1);
>>>>> $bla = $client->getLastRequest();
>>>>> Zend_Debug::dump($bla, 'bla',true);
>>>>>
>>>>> gives me an empty string.
>>>>>
>>>>>
>>>>> beberlei wrote:
>>>>>>
>>>>>> yes, there are possibilities to see both request and response:
>>>>>>
>>>>>> $client = new Zend_Soap_Client($wsdl, array('trace' => true));
>>>>>>
>>>>>> $client->... do stuff;
>>>>>>
>>>>>> and then you can do:
>>>>>>
>>>>>> $client->getLastRequest();
>>>>>> $client->getLastResponse();
>>>>>> $client->getLastRequestHeaders();
>>>>>> $client->getLastResponseHeaders();
>>>>>>
>>>>>> On Monday 27 October 2008 17:45:29 Jigal sanders wrote:
>>>>>>> Hello everyone.
>>>>>>>
>>>>>>> I have the following test stuff for a soap message :
>>>>>>>
>>>>>>> <?
>>>>>>> //if(is_dir('./library/')) echo "ja"; exit;
>>>>>>> set_include_path('./library/');
>>>>>>> require_once('Zend/Loader.php');
>>>>>>> Zend_Loader::registerAutoload();
>>>>>>> $wsdl = "http://buzz.nl/WSCRM/SubscriptionService?wsdl";
>>>>>>> $client = new Zend_Soap_Client($wsdl);
>>>>>>> $client ->setEncoding("UTF-8");
>>>>>>> $client ->setSoapVersion(SOAP_1_1);
>>>>>>>
>>>>>>> Zend_Debug::dump($client, 'bla',true);
>>>>>>>
>>>>>>> ?>
>>>>>>>
>>>>>>> is there a way to see the acutal soap message in xml?
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Benjamin Eberlei
>>>>>> http://www.beberlei.de
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/See-the-soap-message-tp20191520p20202969.html
>>>>> Sent from the Zend Web Services mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> No virus found in this incoming message.
>>>>> Checked by AVG - http://www.avg.com
>>>>> Version: 8.0.175 / Virus Database: 270.8.3/1748 - Release Date:
>>>>> 27/10/2008 7:57
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/See-the-soap-message-tp20191520p20203472.html
>>>> Sent from the Zend Web Services mailing list archive at Nabble.com.
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/See-the-soap-message-tp20191520p20206306.html
>> Sent from the Zend Web Services mailing list archive at Nabble.com.
>>
>>
>> No virus found in this incoming message.
>> Checked by AVG - http://www.avg.com
>> Version: 8.0.175 / Virus Database: 270.8.3/1748 - Release Date:
>> 27/10/2008 22:44
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/See-the-soap-message-tp20191520p20209124.html
> Sent from the Zend Web Services mailing list archive at Nabble.com.
>
>
> No virus found in this incoming message.
> Checked by AVG - http://www.avg.com
> Version: 8.0.175 / Virus Database: 270.8.4/1751 - Release Date:
> 27/10/2008 22:44
>
>

--
View this message in context: http://www.nabble.com/See-the-soap-message-tp20191520p20225569.html
Sent from the Zend Web Services mailing list archive at Nabble.com.

没有评论: