Last modified by Artur on 2025/09/10 11:19

From version 1.4
edited by Helena
on 2025/05/27 13:52
Change comment: There is no comment for this version
To version 1.3
edited by Helena
on 2025/05/27 13:50
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -16,11 +16,10 @@
16 16  
17 17  Building such a Web Service using the .NET framework is done by exposing a method (i.e. the getGenericData in the example) with an XML document argument (lets name it “Query”). **The difference that appears in Microsoft .Net implementations is that there is a need for an extra XML container around the [[SDMX>>doc:sdmx:Glossary.Statistical data and metadata exchange.WebHome]] GenericDataQuery.** This is the expected behavior since the framework is let to publish automatically the Web Service as a remote procedure call, thus wraps each parameter into an extra element. The .NET request is illustrated below:
18 18  
19 +[[image:1747854039499-443.png]]
19 19  
20 -[[image:1748343077495-340.png]]
21 +[[image:1747854067769-691.png]]
21 21  
22 -[[image:1748343095198-522.png]]
23 -
24 24  Furthermore this extra element is also inserted in the automatically generated WSDL from the framework. Therefore this particularity requires custom clients for the .NET Web Services that is not an interoperable solution.
25 25  
26 26  == 11.2 Solution ==
... ... @@ -31,9 +31,8 @@
31 31  
32 32  Web methods use XmlSerializer in the .NET Framework to invoke methods and build the response.
33 33  
33 +[[image:1747836776717-914.jpeg]]
34 34  
35 -[[image:1748343115246-390.png]]
36 -
37 37  The XML is passed to the XmlSerializer to de-serialize it into the instances of classes in managed [[code>>doc:sdmx:Glossary.Code.WebHome]] that (% style="color:#e74c3c" %)map(%%) to the input parameters for the Web method. Likewise, the output parameters and return values of the Web method are serialized into XML in order to create the body of the SOAP response message.
38 38  
39 39  In case the developer wants more control over the serialization and de-serialization process a solution is represented by the usage of **XmlElement** parameters. This offers the opportunity of validating the XML against a schema before de-serializing it, avoiding de-serialization in the first place, analyzing the XML to determine how you want to de-serialize it, or using the many powerful XML APIs that are available to deal with the XML directly. This also gives the developer the control to handle errors in a particular way instead of using the faults that the XmlSerializer might generate under the covers.
... ... @@ -42,14 +42,12 @@
42 42  
43 43  To understand how the **XmlAnyElement** [[attribute>>doc:sdmx:Glossary.Attribute.WebHome]] works we present the following two web methods:
44 44  
43 +[[image:1747854096778-844.png]]
45 45  
46 -[[image:1748343136642-797.png]]
47 -
48 48  In this method the **input** parameter is decorated with the **XmlAnyElement** parameter. This is a hint that this parameter will be de-serialized from an **xsd:any** element. Since the [[attribute>>doc:sdmx:Glossary.Attribute.WebHome]] is not passed any parameters, it means that the entire XML element for this parameter in the SOAP message will be in the Infoset that is represented by this **XmlElement** parameter.
49 49  
47 +[[image:1747854127303-270.png]]
50 50  
51 -[[image:1748343153949-683.png]]
52 -
53 53  The difference between the two is that for the first method, **SubmitXml**, the XmlSerializer will expect an element named **input** to be an immediate child of the **SubmitXml** element in the SOAP body. The second method, **SubmitXmlAny**, will not care what the name of the child of the **SubmitXmlAny** element is. It will plug whatever XML is included into the input parameter. The message style from ASP.NET Help for the two methods is shown below. First we look at the message for the method without the **XmlAnyElement** [[attribute>>doc:sdmx:Glossary.Attribute.WebHome]].
54 54  
55 55  [[image:1747854163928-581.png]]
1748343077495-340.png
Author
... ... @@ -1,1 +1,0 @@
1 -xwiki:XWiki.helena
Size
... ... @@ -1,1 +1,0 @@
1 -3.0 KB
Content
1748343095198-522.png
Author
... ... @@ -1,1 +1,0 @@
1 -xwiki:XWiki.helena
Size
... ... @@ -1,1 +1,0 @@
1 -21.5 KB
Content
1748343115246-390.png
Author
... ... @@ -1,1 +1,0 @@
1 -xwiki:XWiki.helena
Size
... ... @@ -1,1 +1,0 @@
1 -44.9 KB
Content
1748343136642-797.png
Author
... ... @@ -1,1 +1,0 @@
1 -xwiki:XWiki.helena
Size
... ... @@ -1,1 +1,0 @@
1 -10.5 KB
Content
1748343153949-683.png
Author
... ... @@ -1,1 +1,0 @@
1 -xwiki:XWiki.helena
Size
... ... @@ -1,1 +1,0 @@
1 -12.1 KB
Content