web service problems when using more than one method

For some reason, I can only access the first soap method in my controller. My controller is set up as follows…




class ApiController extends Controller

{

	public function actions()

    {

        return array(

            'api'=>array(

                'class'=>'CWebServiceAction',

            ),

        );

    }

	

	/**

	 * @return string a test string

	 * @soap

	 */

	public function test()

	{

		return 'this is a test';

	}

	

	/**

	 * @return string a test string

	 * @soap

	 */

	public function testb()

	{

		return 'this is another test';

	}

	

}



Now when I test these 2 methods, the first (test()) is recognised and returns the string but testb is prompts an exception;

Looking at the xml output if I navigate to my controller, testb() is recognised as an operation…




<definitions name="ApiController" targetNamespace="urn:ApiControllerwsdl">

<wsdl:message name="testRequest"/>

−

<wsdl:message name="testResponse">

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

</wsdl:message>

<wsdl:message name="testbRequest"/>

−

<wsdl:message name="testbResponse">

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

</wsdl:message>

−

<wsdl:portType name="ApiControllerPortType">

−

<wsdl:operation name="test">

<wsdl:documentation/>

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

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

</wsdl:operation>

−

<wsdl:operation name="testb">

<wsdl:documentation/>

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

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

</wsdl:operation>

</wsdl:portType>

−

<wsdl:binding name="ApiControllerBinding" type="tns:ApiControllerPortType">

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

−

<wsdl:operation name="test">

<soap:operation soapAction="urn:ApiControllerwsdl#test" style="rpc"/>

−

<wsdl:input>

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

</wsdl:input>

−

<wsdl:output>

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

</wsdl:output>

</wsdl:operation>

−

<wsdl:operation name="testb">

<soap:operation soapAction="urn:ApiControllerwsdl#testb" style="rpc"/>

−

<wsdl:input>

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

</wsdl:input>

−

<wsdl:output>

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

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

−

<wsdl:service name="ApiControllerService">

−

<wsdl:port name="ApiControllerPort" binding="tns:ApiControllerBinding">

<soap:address location="http://mydomain.com/index.php?r=api/api&ws=1"/>

</wsdl:port>

</wsdl:service>

</definitions>



Is this normal or has something gone wrong here?

I can see that the second method is in your WSDL, but you did disable wsdl caching, didn’t you? (Can’t recall whether there’s still a cache related problem if the wsdl looks fine.)

I guess you should get some other error message if the method was restricted by access rules in the controller.

/Tommy

Thank for you reply. Not sure, how/where do I disable WSDL caching?

If you use PHP’s SOAP client for testing, check here for runtime configuration:

http://de.php.net/manual/en/soap.configuration.php