88use Soap \Engine \Metadata \Model \MethodMeta ;
99use Soap \WsdlReader \Model \Definitions \BindingStyle ;
1010use function Psl \Vec \map ;
11+ use function VeeWee \Xml \Dom \Assert \assert_element ;
1112use function VeeWee \Xml \Dom \Locator \Element \children as locateChildElements ;
12- use function VeeWee \Xml \Dom \Xpath \Configurator \namespaces ;
1313
1414final class OperationReader
1515{
@@ -25,21 +25,16 @@ public function __construct(
2525 */
2626 public function __invoke (string $ xml ): ElementList
2727 {
28- $ operationName = $ this ->meta ->operationName ()->unwrap ();
29- $ namespace = $ this ->meta ->outputNamespace ()->or ($ this ->meta ->targetNamespace ())->unwrap ();
3028 $ bindingStyle = BindingStyle::tryFrom ($ this ->meta ->bindingStyle ()->unwrapOr (BindingStyle::DOCUMENT ->value ));
3129
3230 // The Response can contain out of multiple response parts.
3331 // Therefore, it is being wrapped by a central root element:
3432 $ body = (new SoapEnvelopeReader ())($ xml );
3533 $ bodyElement = $ body ->element ();
36- $ xpath = $ body ->document ()->xpath (namespaces (['tns ' => $ namespace ]));
3734
3835 $ elements = match ($ bindingStyle ) {
3936 BindingStyle::DOCUMENT => locateChildElements ($ bodyElement ),
40- BindingStyle::RPC => locateChildElements (
41- $ xpath ->querySingle ('./tns: ' .$ operationName , $ bodyElement )
42- )
37+ BindingStyle::RPC => locateChildElements (assert_element ($ bodyElement ->firstElementChild )),
4338 };
4439
4540 return new ElementList (...map ($ elements , Element::fromDOMElement (...)));
0 commit comments