Solved

Passing XML Serialized Object between domains

Posted on 2014-02-26
5
372 Views
Last Modified: 2014-02-27
I am attempting to set up a "data sharing" scenario between my company and another company we work with. I want this data sharing to be automated with as little human interaction as possible. Both companies use .net programming platforms. I am trying to use XMLSerializer to convert the array of objects to xml form and I have this working. I am stumped by how to set up the actual exchange of the xml. I am currently writing the xml to a file and have verified the file contains the correct data.

Can someone help me with how best to go about sending the xml to our partner company in a way that allows them to load it into their system as easily and quickly as possible?

We are the recipient of data in a similar setup and our receiving code looks as follows:

List<TournyApprovedTeam> TournyTeams;
using (StringReader reader = new StringReader(HttpUtility.HtmlDecode Request.Form["XmlTeams"].ToString())))
{
                XmlSerializer serializer = new XmlSerializer(typeof(List<TournyApprovedTeam>), new XmlRootAttribute("TournyApprovedTeams"));
                TournyTeams = (List<TournyApprovedTeam>)serializer.Deserialize(reader);
 }

I need to know how this is being sent to us because I need to use the same type of code ...
0
Comment
Question by:davProg67
  • 3
  • 2
5 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39889013
Have you considered creating a web service at either end? The code you show above appears to belong to a web page (as indicated by the Request.Form bit). If you like, you could repeat that, but a web service would be more computer-friendly. You could use WCF or REST to build your service. WCF is a bit more involved, but tends to work out-of-the-box. What version of Visual Studio are you working with?
0
 

Author Comment

by:davProg67
ID: 39889073
I am working with 2010. I have no experience with web services or wcf but would love to learn it. Can you help?
0
 

Author Comment

by:davProg67
ID: 39889095
I need a working solution quickly as I am under heavy pressure for this. Any help is appreciated and I am open to all possibilities and am relying on the experts! I have researched this a lot and am just at an analysis paralysis state ...
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39889120
They are not topics that are conducive to be laid out in a comment, but there are numerous tutorials on the web for such. For plain WCF, you can start with:

http://msdn.microsoft.com/en-us/library/bb386386.aspx
http://msdn.microsoft.com/en-us/library/bb412178(v=vs.110).aspx
http://www.codeproject.com/Articles/406096/A-beginners-tutorial-for-understanding-Windows

For REST-based services, you can use a variation on WCF:

http://msdn.microsoft.com/en-us/magazine/dd315413.aspx
http://www.codeproject.com/Articles/571813/A-Beginners-Tutorial-on-Creating-WCF-REST-Services
http://msdn.microsoft.com/en-us/library/dd203052.aspx

...or you can use the newer Web API framework (that you must install separately in 2010):

http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api
http://www.asp.net/web-api/overview/getting-started-with-aspnet-web-api/tutorial-your-first-web-api

If you go the Web API route, it is installed in VS 2012 by default, so you'll have a headstart on projects you create if you update VS versions. Web API is built around the MVC concept, so you'll also be able to jump into MVC projects should the need arise.
0
 

Author Closing Comment

by:davProg67
ID: 39892643
kaufmed provided exactly what I needed in his links. I got things working using a plain wcf web service. Thanks kaufmed, you rock!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question