33
44namespace Soap \WsdlReader \Parser \Definitions ;
55
6- use DOMElement ;
6+ use Dom \ Element ;
77use Soap \WsdlReader \Model \Definitions \Binding ;
88use Soap \WsdlReader \Model \Definitions \BindingOperations ;
99use Soap \WsdlReader \Model \Definitions \Bindings ;
1010use Soap \WsdlReader \Model \Definitions \QNamed ;
1111use Soap \WsdlReader \Parser \Strategy \StrategySelector ;
1212use Soap \Xml \Xpath \WsdlPreset ;
1313use VeeWee \Xml \Dom \Document ;
14- use function VeeWee \Xml \Dom \Locator \Element \locate_by_tag_name ;
14+ use function VeeWee \Xml \Dom \Locator \Element \locate_by_namespaced_tag_name ;
1515
1616final class BindingParser
1717{
18- public function __invoke (Document $ wsdl , DOMElement $ binding ): Binding
18+ public function __invoke (Document $ wsdl , Element $ binding ): Binding
1919 {
2020 $ xpath = $ wsdl ->xpath (new WsdlPreset ($ wsdl ));
2121
22- $ soapBinding = locate_by_tag_name ($ binding , 'binding ' )->expectFirst ('Unable to locate the SOAP binding in a WSDL binding element! ' );
22+ $ soapBinding = locate_by_namespaced_tag_name ($ binding, ' * ' , 'binding ' )->expectFirst ('Unable to locate the SOAP binding in a WSDL binding element! ' );
2323 $ addressBindingType = (new AddressBindingTypeParser ())($ wsdl , $ soapBinding );
2424 $ strategy = (new StrategySelector ())($ addressBindingType );
2525
2626 return new Binding (
27- name: $ binding ->getAttribute ('name ' ),
28- type: QNamed::parse ($ binding ->getAttribute ('type ' )),
27+ name: $ binding ->getAttribute ('name ' ) ?? '' ,
28+ type: QNamed::parse ($ binding ->getAttribute ('type ' ) ?? '' ),
2929 addressBindingType: $ addressBindingType ,
3030 implementation: $ strategy ->parseBindingImplementation ($ wsdl , $ soapBinding ),
3131 operations: new BindingOperations (
3232 ...$ xpath ->query ('./wsdl:operation ' , $ binding )
33- ->expectAllOfType (DOMElement ::class)
33+ ->expectAllOfType (Element ::class)
3434 ->map (
35- static fn (DOMElement $ operation ) => (new BindingOperationParser ())($ wsdl , $ operation , $ strategy )
35+ static fn (Element $ operation ) => (new BindingOperationParser ())($ wsdl , $ operation , $ strategy )
3636 )
3737 ),
3838 );
@@ -45,9 +45,9 @@ public static function tryParse(Document $wsdl): Bindings
4545
4646 return new Bindings (
4747 ...$ xpath ->query ('/wsdl:definitions/wsdl:binding ' )
48- ->expectAllOfType (DOMElement ::class)
48+ ->expectAllOfType (Element ::class)
4949 ->map (
50- static fn (DOMElement $ binding ): Binding => $ parse ($ wsdl , $ binding )
50+ static fn (Element $ binding ): Binding => $ parse ($ wsdl , $ binding )
5151 )
5252 );
5353 }
0 commit comments