# What is your recommended method of sending out intricate information over an internet solution?

It is 2008, and also I'm still torn on this set. So I'm creating an internet method that requires an intricate type entered it and also returned from it. Both alternatives I'm dabbling are :

1. Pass and also return real organisation things with both information and also actions. When wsdl.exe is run, it will instantly create proxy courses which contain simply the information section, and also these will certainly be instantly transformed to and also from my actual organisation things on the web server side. On the customer side, they will just reach make use of the foolish proxy type, and also they will certainly need to map them right into some actual organisation things as they please. A large downside below is that if I "own" both the web server and also customer side, and also I intend to make use of the very same set of actual organisation things, I can face particular frustrations with name problems, etc (Since the actual things and also the proxies are called the very same.)

2. Neglect attempting to pass "real" organisation things. Rather, simply create straightforward DataTransfer things which I will certainly map to and fro to my actual organisation things by hand. They still get replicated to new proxy things by wsdl.exe anyhow, yet at the very least I'm not fooling myself right into assuming that web services can natively take care of things with organisation reasoning in them.

Incidentally - Does any person recognize just how to inform wsdl.exe to not make a duplicate of the object? Should not we have the ability to simply inform it, "Hey, utilize this existing type right over below. Do not replicate it!"

Anyway, I've kinda decided on # 2 in the meantime, yet I'm interested what you all assume. I sense there are way far better means to do this as a whole, and also I might not also be entirely exact on all my factors, so please allow me recognize what your experiences have actually been.

Update : I simply figured out that VS 2008 has an alternative to recycle existing types when including a "Service Reference", as opposed to developing all new the same key in the proxy documents. Pleasant.

0
2019-12-02 03:04:20
Source Share

I would certainly do a crossbreed. I would certainly make use of an object similar to this

public class TransferObject
{
public string Type { get; set; }
public byte[] Data { get; set; }
}


after that i have a wonderful little energy that serializes an object after that presses it.

public static class CompressedSerializer
{
/// <summary>
/// Decompresses the specified compressed data.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="compressedData">The compressed data.</param>
/// <returns></returns>
public static T Decompress<T>(byte[] compressedData) where T : class
{
T result = null;
using (MemoryStream memory = new MemoryStream())
{
memory.Write(compressedData, 0, compressedData.Length);
memory.Position = 0L;

using (GZipStream zip= new GZipStream(memory, CompressionMode.Decompress, true))
{
zip.Flush();
var formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
result = formatter.Deserialize(zip) as T;
}
}

return result;
}

/// <summary>
/// Compresses the specified data.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="data">The data.</param>
/// <returns></returns>
public static byte[] Compress<T>(T data)
{
byte[] result = null;
using (MemoryStream memory = new MemoryStream())
{
using (GZipStream zip= new GZipStream(memory, CompressionMode.Compress, true))
{
var formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
formatter.Serialize(zip, data);
}

result = memory.ToArray();
}

return result;
}
}


Then you would certainly simply pass the transfer object that would certainly have the type name. So you can do something similar to this

[WebMethod]
{
Type originType = Type.GetType(data.Type);
object item = CompressedSerializer.Decompress<object>(data.Data);
}


now the pressed serializer makes use of generics to make it highly keyed in, yet you can make a method conveniently to absorb a Type challenge deserialize making use of originType over, all relies on your execution.

hope this offers you some suggestions. Oh, and also to address your various other inquiry, wsdl.exe does not sustain recycling kinds, WCF does however.

0
2019-12-03 04:41:33
Source

Darren created : I would certainly do a crossbreed. I would certainly make use of an object similar to this ...

Interesting suggestion ... passing a serialized variation of the object as opposed to the (wsdl - ed) object itself. In such a way, I like its style, yet in an additional means, it appears to beat the objective of revealing your internet solution to possible 3rd parties or companions or whatever. Just how would certainly they recognize what to pass? Would certainly they need to count totally on documents? It additionally sheds several of the "heterogeneous client" facet, given that the serialization is very.Net details. I do not suggest to be essential, I'm simply asking yourself if what you are recommending is additionally suggested for these sorts of usage instances. I do not see anything incorrect with utilizing it in a shut setting though.

I need to check into WCF ... I've been preventing it, yet possibly it is time.

0
2019-12-03 04:39:35
Source

oh, without a doubt, i just do this when i'm the customer of the webservice or if you have some type of controller that they ask for an object from and afterwards you take care of the serialization and also sending out as opposed to them straight eating the internet solution. Yet actually, if they are straight eating the webservice, after that they would not require or always have the setting up that would certainly have the key in it to begin with, and also need to be making use of the things that wsdl creates.

And also of course, what i presented is very.NET details due to the fact that i do not such as to make use of anything else. The only various other time i eat webservices outside of.net remained in javascript, today i just make use of json feedbacks as opposed to xml webservice feedbacks

0
2019-12-03 00:22:25
Source