Web Service safeMethods

Just trying out Yii Web Service authentication/authorization here.

Generated CRUD controller extended with IWebServiceProvider implementation from Phonebook sample. Method getFirstItem added to safeMethods array.

With a PHP client all works well, even the login method and my custom method requiring login. The latter method calls are commented out.

HTTP request from PHP client executes getFirstItem() as expected

Quote

POST /AppYii103/index.php?r=item/itemsWS&ws=1 HTTP/1.1

Host: somehost.com

Connection: Keep-Alive

User-Agent: PHP-SOAP/5.2.4-2ubuntu5.5

Content-Type: text/xml; charset=utf-8

SOAPAction: "urn:ItemControllerwsdl#getFirstItem"

Content-Length: 394

C# client ends up with the "Login required" exception

Quote

POST /AppYii103/index.php?r=item/itemsWS&ws=1 HTTP/1.1

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.3082)

Content-Type: text/xml; charset=utf-8

SOAPAction: "urn:ItemControllerwsdl#getFirstItem"

Host: somehost.com

Content-Length: 472

Expect: 100-continue

Connection: Keep-Alive

Something wrong with my C# client config? It worked well until I added the IWebServiceProvider implementation in the controller.

/Tommy

Here's the actual SOAP requests:

Quote

<?xml version="1.0" encoding="UTF-8"?>

<SOAP-ENV:Envelope

  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"

  xmlns:ns1="urn:ItemControllerwsdl"

  xmlns:xsd="http://www.w3.org/2001/XMLSchema"

  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"

  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

 

  <SOAP-ENV:Body>

    <ns1:getFirstItem/>

  </SOAP-ENV:Body>

</SOAP-ENV:Envelope>

Quote

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope

  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"

  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

  xmlns:tns="urn:ItemControllerwsdl"

  xmlns:types="urn:ItemControllerwsdl/encodedTypes"

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

    <tns:getFirstItem />

  </soap:Body>

</soap:Envelope>

Ubuntu/PHP and WinXP/.NET 2.0 respectively. The latter in a continuation packet.

/Tommy

I added a trace statement:



public function beforeWebMethod($service)


{


  Yii::trace("({$service->methodName})");


  return true;


  ...


}


PHP client:

Quote

2009/03/20 19:47:29 [trace] [application] (getFirstItem)

.Net client, obviously $service->methodName is empty:

Quote

2009/03/20 19:49:46 [trace] [application] ()

I just checked in a fix. Thank you for helping debug.