My company is currently looking into bringing a new piece of third party software in for online ordering. The software does not handle pricing so they are requesting the pricing information from a web service. Their software is passing an XML file as a parameter, and expecting an XML file as a response. I would think that returning an XML file would be pretty straight forward, but I cannot think of a way to receive an XML file as a parameter. Has anyone done this, or am I missing something really obvious?
+3
A:
Possibly obvious - an XML "file" can be represented by a String
.
Edit to Answer Comment
The string is the XML file, so all you need to do is deserialize it into the classes created from the XSD:
Dim xmlString As String = GetStringFromVendor()
Dim xmlClass As New CoolXMLClass
Dim serializer As New Xml.Serialization.XmlSerializer(GetType(CoolXMLClass))
xmlClass = serializer.Deserialize(New StringReader(xmlString))
Jason Berkan
2010-02-08 22:37:23
We did this in a data import service and, yes, we just took it as a string and then parsed it using .NET's XML functionality. It is really just as easy as it sounds!
Mark Brittingham
2010-02-08 22:43:12
sweet, I'll have to give that a try.
fizch
2010-02-09 17:24:40
I am finally getting around to this. Our software vendor provided us with an XSD file for the XML that they are sending us, and we have the classes created. How should I go about converting the string to the xml file and later the class defined in the xsd?
fizch
2010-03-19 19:55:11