开发者

PHP class generator for web services

开发者 https://www.devze.com 2022-12-11 00:34 出处:网络
I am trying to find some kind of php class generator for Web Services (WCF service if that matters) w开发者_Go百科ithout any luck so far. Any ideas?

I am trying to find some kind of php class generator for Web Services (WCF service if that matters) w开发者_Go百科ithout any luck so far. Any ideas?

thanks


According to this Question & Answer, you can use the generateProxyCode() method of the PEAR SOAP_WSDL class.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号