?
Solved

Passing XML Serialized Object between domains

Posted on 2014-02-26
5
Medium Priority
?
397 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 2000 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

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!
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

862 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