Solved

Passing XML Serialized Object between domains

Posted on 2014-02-26
5
364 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 74

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 74

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
File Upload Control on a ASP.NET Overlay Page 1 20
dynamic menu in asp.net c# 11 26
Problem to page 4 21
Adjust the position 3 7
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This video discusses moving either the default database or any database to a new volume.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now