I'm trying to create a SOAP server in my ZF2 application that I can import with Visual Studio using the wizard into a C# application. I've already created the service and tested it using soapUI. I ran the WS-I compliance test in soapUI and my service passed it. However, when I try to add the service into a C# application using Visual C# Express 2008, it says that the HTML document does not have webservice discovery information.
Here is the code I'm using in my ZF2 controller:
public function exampleAction() {
if (isset($_GET['wsdl'])) {
$soapAutoDiscover = new AutoDiscover();
$soapAutoDiscover->setBindingStyle(array('style' => 'document'));
$soapAutoDiscover->setOperationBodyStyle(array('use' => 'literal'));
$soapAutoDiscover->setClass('SoapClass');
$soapAutoDiscover->setUri($serverUrl);
echo $soapAutoDiscover->generate()->toXml();
} else {
$soap = new Server($serverUrl . '?wsdl');
$soap->setClass('SoapClass');
$soap->handle();
}
}
This is the SoapClass class:
class SoapClass{
/**
* returns the sum of two parameters
* @param int $a
* @param int $b
* @return int
*/
public function sum ($a, $b){
return $a + $b;
}
/**
* twice function doc
* @param int $a
* @return int
*/
public function twice($a){
return $a * 2;
}
}
Any ideas?