WSDL how do I describe a tag that has both an attribute and a string value?
You can describe such a structure:
<element name="One" minOccurs="1" maxOccurs="1">
<complexType>
<sequence>
<element name="Two" type="string" minOccurs="1" maxOccurs="unbounded" />
</sequence>
</complexType>
</element>
And this will turn into this xml
:
<One>
<Two>строка</Two>
<Two>ещё строка</Two>
</One>
Can we describe such a structure:
<element name="One" minOccurs="1" maxOccurs="1">
<complexType>
<sequence>
<element name="Two" minOccurs="1" maxOccurs="unbounded">
<complexType>
<attribute name="MyAttr" type="string" />
</complexType>
</element>
</sequence>
</complexType>
</element>
And this will turn into this xml
:
<One>
<Two MyAttr="строка" />
<Two MyAttr="ещё строка" />
</One>
But how do I describe in wsdl
a structure that will turn into:
<One>
<Two MyAttr="строка 1">строка 2</Two>
<Two MyAttr="строка 3">строка 4</Two>
</One>
???
P.S. And what data structure will I need to feed to the soap server?
0
1 answers
Try it out:
<element name="One">
<complexType>
<sequence>
<element name="Two" minOccurs="1" maxOccurs="unbounded">
<complexType>
<simpleContent>
<extension base="string">
<attribute name="MyAttr" type="string" />
</extension>
</simpleContent>
</complexType>
</element>
</sequence>
</complexType>
</element>
The data structure should be: class One, containing a collection of classes Two.
1
Author: Alexander Petrov, 2020-10-07 15:03:58