i created a webservice in yii,

this is my controller:


class ApplicationController extends Controller{


	public function actions(){


        return array(







     * @return string

     * @soap


	public function testWebService(){


		return "Something";





I’m trying to call this webservice in CSharp,

It’s my code:

ServiceReference1.ApplicationControllerPortTypeClient p = new TestMySqlSynchronizeWebService.ServiceReference1.ApplicationControllerPortTypeClient();

string a = p.testWebService();

[size="3"]but i got this error:[/size]

There is a problem with the XML that was received from the network. See inner exception for more details.


inner exception: [/size]

{"CData elements not valid at top level of an XML document. Line 1, position 3."}

What should I do ?

Shoud I set something ?

I am not able to see your C# code calling the service URL but have you?

http://hostname/path/to/index.php?r=CONTROLLERID/service’ ?

Watching the server response XML code would also help to find out what is happening.


This XML file does not appear to have any style information associated with it. The document tree is shown below.



<definitions name="ApplicationController" targetNamespace="urn:ApplicationControllerwsdl">

<wsdl:message name="testWebServiceRequest"/>


<wsdl:message name="testWebServiceResponse">

<wsdl:part name="return" type="xsd:string"/>



<wsdl:portType name="ApplicationControllerPortType">


<wsdl:operation name="testWebService">


<wsdl:input message="tns:testWebServiceRequest"/>

<wsdl:output message="tns:testWebServiceResponse"/>




<wsdl:binding name="ApplicationControllerBinding" type="tns:ApplicationControllerPortType">

<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>


<wsdl:operation name="testWebService">

<soap:operation soapAction="urn:ApplicationControllerwsdl#testWebService" style="rpc"/>



<soap:body use="encoded" namespace="urn:ApplicationControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>




<soap:body use="encoded" namespace="urn:ApplicationControllerwsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>





<wsdl:service name="ApplicationControllerService">


<wsdl:port name="ApplicationControllerPort" binding="tns:ApplicationControllerBinding">

<soap:address location=""/>




dear Antonio Ramirez:

i used rewrite url

Csharp adds and compiles the webservice before running application, and i dont know what will happening when a soap method call in Csharp !

It looks correct.

Are you sure that you are not printing the debug info also? (the Yii log table)

When I browsed ,

I got this error:

[b][size="4"][color="#FF0000"]Internal Server Error[/color]

include(SoapServer.php) [<a href=‘function.include’>function.include</a>]: failed to open stream: No such file or directory

An internal error occurred while the Web server was processing your request.

Please contact the webmaster to report this problem.

Thank you.

2010-10-26 13:09:34 [/size][/b]

Have you checked that the SOAP extension is installed ?

For some reason I had to use the service URL when testing web service calls from a C# client.

In get format:


or in path format:




In PHP SoapClient we use the wsdl URL.

i installed soap extension

Now when I browsing ,

I getting this error:

[color="#FF0000"][size="4"][b]XML Parsing Error: no element found


Line Number 1, Column 1:



Why are you appending the ?ws=1… just remove that…

After reading all the posts, I have to say that is very weird isn’t working now from browser URL as the xml seemed ok. Have you tried with a simple php file to consume that service?

$client=new SoapClient(’’);

echo $client->testWebService();

Lets see what happens after…

thanks all, my web service is working

I had the wrong about SOAP Extension

Hey Ramin,

Could you please post the right solution so others would be able to learn from?

Thanks and congratulations!

we must first be sure about installing SOAP Extension on our apache server