Yii Framework Forum: SOAP-ERROR: Parsing WSDL - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

SOAP-ERROR: Parsing WSDL Rate Topic: -----

#1 User is offline   seboraid 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 21-September 09

Posted 01 October 2009 - 03:00 PM

Hi !

Im trying to make work the Web Service example in the Yiis Doc Guide.

This is my controller :


class GolController extends CController
{
	public function actions()
    {
        return array(
            'quote'=>array(
                'class'=>'CWebServiceAction',
            ),
        );
    }
    
    /**
     * @param string the symbol of the stock
     * @return float the stock price
     * @soap
     */
    public function getPrice($symbol)
    {
        $prices=array('IBM'=>100, 'GOOGLE'=>350);
        return isset($prices[$symbol])?$prices[$symbol]:0;
        //...return stock price for $symbol
    }

}


When i browse my controller/action like : http://myrealdomain.com/gol/quote

I see the following XML :

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:GolControllerwsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" name="GolController" targetNamespace="urn:GolControllerwsdl"><wsdl:message name="getPriceRequest"><wsdl:part name="symbol" type="xsd:string"/></wsdl:message><wsdl:message name="getPriceResponse"><wsdl:part name="return" type="xsd:float"/></wsdl:message><wsdl:portType name="GolControllerPortType"><wsdl:operation name="getPrice"><wsdl:documentation></wsdl:documentation><wsdl:input message="tns:getPriceRequest"/><wsdl:output message="tns:getPriceResponse"/></wsdl:operation></wsdl:portType><wsdl:binding name="GolControllerBinding" type="tns:GolControllerPortType"><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operation name="getPrice"><soap:operation soapAction="urn:GolControllerwsdl#getPrice" style="rpc"/><wsdl:input><soap:body use="encoded" namespace="urn:GolControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></wsdl:input><wsdl:output><soap:body use="encoded" namespace="urn:GolControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:service name="GolControllerService"><wsdl:port name="GolControllerPort" binding="tns:GolControllerBinding"><soap:address location="http://myrealdomain.com/gol/quote/ws/1"/></wsdl:port></wsdl:service></definitions>



But when i try to access it from the same server with this client :

<?php
  
  try {
      $client=new SoapClient('http://myrealdomain.com/gol/quote');
      $client->getPrice('GOOGLE');
  }
  catch (SoapFault $e)
  {
      echo "<pre>";
      print_r($e);
      echo "</pre>";
  }
  
?>

I got the following error :

Warning: SoapClient::SoapClient(http://myrealdomain.com/gol/quote) [soapclient.soapclient]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found <br /> HTTP request failed! HTTP/1.1 404 Not Found in /home/sperez/html/sdg/public/soap.php on line 8

Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O warning : failed to load external entity "http://myrealdomain.com/gol/quote" in /home/sperez/html/sdg/public/soap.php on line 8

SoapFault Object
(
    [message:protected] => SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://myrealdomain.com/gol/quote'
    [string:private] => 
    [code:protected] => 0
    [file:protected] => /home/sperez/html/sdg/public/soap.php
    [line:protected] => 8
    [trace:private] => Array
        (
            [0] => Array
                (
                    [file] => /home/sperez/html/sdg/public/soap.php
                    [line] => 8
                    [function] => SoapClient
                    [class] => SoapClient
                    [type] => ->
                    [args] => Array
                        (
                            [0] => http://myrealdomain.com/gol/quote
                            [1] => Array
                                (
                                    [compression] => 32
                                    [encoding] => UTF-8
                                )

                        )

                )

        )

    [faultstring] => SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://myrealdomain.com/gol/quote'
    [faultcode] => WSDL
)



What is going on?

Im using php 5.2.6

regards
0

#2 User is offline   Pradhan 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 209
  • Joined: 01-May 09
  • Location:Charlotte, NC

Posted 09 October 2009 - 11:20 PM

Just try : http://myrealdomain.com/gol/quote
and you should get the WSDL

I tried yor example and got this!
But still and CHttpException exception as follows.

[faultstring] => CHttpException
[faultcode] => HTTP


SoapFault Object
(
[message:protected] => CHttpException
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => G:\home\www\gemisoft.com\protected\controllers\SiteController.php
[line:protected] => 32
[trace:Exception:private] => Array
(
[0] => Array
(
[function] => __doRequest
[class] => SoapClient
[type] => ->
[args] => Array
(
[0] =>
GOOGLE

[1] => http://localhost/gem...quote/ws/1.html
[2] => urn:StockControllerwsdl#getPrice
[3] => 1
[4] => 0
)

)

[1] => Array
(
[function] => __call
[class] => SoapClient
[type] => ->
[args] => Array
(
[0] => getPrice
[1] => Array
(
[0] => GOOGLE
)

)

)

[2] => Array
(
[file] => G:\home\www\gemisoft.com\protected\controllers\SiteController.php
[line] => 32
[function] => getPrice
[class] => SoapClient
[type] => ->
[args] => Array
(
[0] => GOOGLE
.....
)

[previous:Exception:private] =>
[faultstring] => CHttpException
[faultcode] => HTTP
)
0

#3 User is offline   seboraid 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 21-September 09

Posted 10 October 2009 - 11:25 AM

Hi !

I got an WSDL parsing error because my server cant resolve his own domain name.
0

#4 User is offline   jprakash 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 04-May 10

Posted 13 May 2010 - 07:15 PM

Hi ,

I faced the same issue. But i was using 'localhost'. Later i resumed using 'IP Address' and its working fine.
0

#5 User is offline   makasoli 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 12-January 11

Posted 18 January 2011 - 03:02 AM

I got a worse error xml parsing error : junk after document element???
0

#6 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,628
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 18 January 2011 - 05:40 AM

View Postmakasoli, on 18 January 2011 - 03:02 AM, said:

I got a worse error xml parsing error : junk after document element???


Do you have web logging/profiling enabled?

/Tommy
Don't forget to read The Definitive Guide to Yii (en) (sv) | The class reference has the details
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users