Hello,
I am trying to find some kind of php class generator for Web Services (WCF service if that matters) without any luck so far. Any ideas?
thanks
Hello,
I am trying to find some kind of php class generator for Web Services (WCF service if that matters) without any luck so far. Any ideas?
thanks
I'd say there's a dubious benefit from static generation of the classes wrapping a SOAP service in a dynamic language like PHP. What I usually do is just hand-crafting the SOAP HTTP request and then feeding the results to SimpleXMLElement, like:
$Response = new SimpleXMLElement($soap_response_xml);
echo strval($Response->ElementA->ElementB['AttributeC']);
Which corresponds to SOAP response XML:
<Response>
<ElementA>
<ElementB AttributeC="foo"/>
</ElementA>
</Response>
and outputs "foo".
This way has no WSDL parsing overhead. But if you do want to deal with WSDL, and avoid hand-crafting the HTTP request, check this out.
In either way, it's better to "generate the classes" at runtime, because your language allows that.
According to this Question & Answer, you can use the generateProxyCode() method of the PEAR SOAP_WSDL class.