File tree Expand file tree Collapse file tree 2 files changed +7
-11
lines changed
examples/encoders/simpleType Expand file tree Collapse file tree 2 files changed +7
-11
lines changed Original file line number Diff line number Diff line change 66use Soap \Encoding \Encoder \SimpleType \ScalarTypeEncoder ;
77use Soap \Encoding \Encoder \XmlEncoder ;
88use Soap \Encoding \EncoderRegistry ;
9- use Soap \Engine \Metadata \Model \TypeMeta ;
109use Soap \WsdlReader \Model \Definitions \BindingUse ;
1110use VeeWee \Reflecta \Iso \Iso ;
1211
@@ -41,17 +40,10 @@ public function iso(Context $context): Iso
4140 /**
4241 * This method allows to change the context on the wrapping elementEncoder.
4342 * By forcing the bindingUse to `ENCODED`, we can make sure the xsi:type attribute is added.
44- * We also make sure the type is not qualified so that the xsi:type prefix xmlns is imported as well.
4543 */
4644 public function enhanceElementContext (Context $ context ): Context
4745 {
48- return $ context
49- ->withBindingUse (BindingUse::ENCODED )
50- ->withType (
51- $ context ->type ->withMeta (
52- static fn (TypeMeta $ meta ): TypeMeta => $ meta ->withIsQualified (false )
53- )
54- );
46+ return $ context ->withBindingUse (BindingUse::ENCODED );
5547 }
5648 }
5749 );
Original file line number Diff line number Diff line change @@ -47,10 +47,14 @@ private function buildXsiType(XMLWriter $writer): Generator
4747 return ;
4848 }
4949
50+ $ context = $ this ->context ;
51+ $ type = $ context ->type ;
52+
5053 yield from (new XsiAttributeBuilder (
5154 $ this ->context ,
52- XsiTypeDetector::detectFromValue ($ this ->context , $ this ->value ),
53- includeXsiTargetNamespace: !$ this ->context ->type ->getMeta ()->isQualified ()->unwrapOr (false )
55+ XsiTypeDetector::detectFromValue ($ context , $ this ->value ),
56+ includeXsiTargetNamespace: $ type ->getXmlTargetNamespace () !== $ type ->getXmlNamespace ()
57+ || !$ type ->getMeta ()->isQualified ()->unwrapOr (false )
5458 ))($ writer );
5559 }
5660
You can’t perform that action at this time.
0 commit comments