I am trying to create a SOAP server in my ZF2 application, which I can import using Visual Studio with a wizard into a C # application. I already created a service and tested it using soapUI. I ran the WS-I conformance test in soapUI and my service passed it. However, when I try to add a service to a C # application using Visual C # Express 2008, it says that there is no web service discovery information in the HTML document.
Here is the code I use 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{ public function sum ($a, $b){ return $a + $b; } public function twice($a){ return $a * 2; } }
Any ideas?
source share