I'm wondering if there is anything in PHP or Python which would properly parse WSDL files. For example i need to parse http://www.onvif.org/ver10/media/wsdl/media.wsdl. PHP SOAP extension generates code like this:
<ns1:GetStreamUri env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
<param0 xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">StreamSetup</key>
<value xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">Stream</key>
<value xsi:type="xsd:string">RTP-Unicast</value>
</item>
<item>
<key xsi:type="xsd:string">Transport</key>
<value xsi:type="ns2:Map">
<item>
<key xsi:type="xsd:string">Protocol</key>
<value xsi:type="xsd:string">UDP</value>
</item>
</value>
</item>
</value>
</item>
<item>
<key xsi:type="xsd:string">ProfileToken</key>
<value xsi:type="xsd:string">main</value>
</item>
</param0>
</ns1:GetStreamUri>
And i need like this:
<GetStreamUri xmlns="http://www.onvif.org/ver10/media/wsdl">
<StreamSetup>
<Stream xmlns="http://www.onvif.org/ver10/schema">RTP-Unicast</Stream>
<Transport xmlns="http://www.onvif.org/ver10/schema">
<Protocol>UDP</Protocol>
</Transport>
</StreamSetup>
<ProfileToken>main</ProfileToken>
</GetStreamUri>
I'm already managed to generate request as in the second example through extending default SOAP extension, but still i need to add all types, namespaces and etc... which i dont know how to parse... So may be there is some way to generate this requests according to specifications provided in WSDL document?
Sure thing there is. Have you checked out SUDS, yet? https://fedorahosted.org/suds/wiki/Documentation
Probably the most powerful SOAP library for python.
It works like
Just search for SUDS on Stackoverflow and you will find tons of examples and further help.