namespace Acme\ApiBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; class SoapServiceController extends Controller { public function indexAction() { $server = new \SoapServer('/home/kallosz/www/acme.project/src/Acme/soap.wsdl'); $server->setObject($this->get('soap_service')); $response = new Response(); $response->headers->set('Content-Type', 'text/xml; charset=utf-8'); $server->handle(); } return $response; } }
Service
namespace Acme\ApiBundle\Services; use \SimpleXMLElement; class SoapService { public function sendSms($name) {/* $soap = new SimpleXMLElement('<soap/>'); $errors = $soap->addChild('errors'); $errors->addChild('error', $name); */ return 'testsend'.$name; } public function getSms($name) {/* $soap = new SimpleXMLElement('<soap/>'); $errors = $soap->addcslashes(str, charlist)Child('errors'); $errors->addChild('error', $name); */ return 'testget'.$name; } }
WSDL
<?xml version="1.0" encoding="UTF-8"?> <definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:acme" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:acme"> <types> <xsd:schema targetNamespace="urn:acme"> <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" /> </xsd:schema> </types> <message name="getSmsRequest"> <part name="name" type="xsd:string" /> </message> <message name="getSmsResponse"> <part name="return" type="xsd:string" /> </message> <portType name="avmePortType"> <operation name="getSms"> <documentation>Hello World</documentation> <input message="tns:getSmsRequest"/> <output message="tns:getSmsResponse"/> </operation> </portType> <binding name="acmeBinding" type="tns:acmePortType"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="getSms"> <soap:operation soapAction="urn:acme#getSms" style="rpc"/> <input> <soap:body use="encoded" namespace="urn:acme" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </input> <output> <soap:body use="encoded" namespace="urn:acme" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output> </operation> </binding> <service name="acme"> <port name="acmePort" binding="tns:acmeBinding"> <soap:address location="http://acme.project/app_dev.php/api/soap" /> </port> </service> </definitions>
Testowy plik klienta
$client = new \Soapclient('http://acme.project/app_dev.php/api/soap?wsdl'); $result = $client->hello('test');
Problemem jest ciągła odpowiedź null nie ważne jaką zmianę dokonam w WSDL czy pozostałych plikach. Co jakiś czas pojawi się błąd dotyczący braku procedury getSms.
Problem został rozwiązany.
Winowajcą był cache

Temat można zamknąć.