asp.net - What is right way to code input parameters with complex types for a C# .net 2.0 WebService? -


I am currently building a new version of the webservice which my company already provides in the existing webservice. Has an input parameter of. In that string an entire XML document has been passed, we then validate that string against XSD (XSD given to the consumer). This looks like this:

  [WebMethod] Public Child Upload (string xml) {if (ValidateXML (xml)) {// something}}  
< P> I am building the next version of this service. I was under the impression that passing a XML doctor as a string is not the right way to do this. I was thinking that my service would look something like this:

  [WebMethod] Public Child Upload (int context id, string reference name, // etc ...) {// do something} < / Code> 

I have this issue that in reality there are large input parameters and some of these are complex types. For example, the upload method needs to be taken in a complex object called allocation, this object In fact, many integers, decimal values, strings, and others Till is composed of objects. Should I create a webservice like this:

  [WebMethod] Public Child Upload (int context id, string reference name, allocation reference index) {// do something}  

Or is there a different way to do this?

Note: This allocation object is a hierarchy in XSD that was provided for the old service.

Could it be that the XML service was taken only to counter this problem in the original service?

Note: This is a C # 2.0 webservice.

I probably used XSD to create an XML serialjetable object for "xsd.exe" tool Will i You can then deal with objects instead of string parameters. It also gives you the ability to change the signature of WebServity.

If you change the XSD to add other parameters, then you just have to recreate the class using the XSD.exe tool again. Use the partial classes here to separate your auto-generated class with your business logic. This way you can redefine the class definition if XSD changes many times by you but your business Can not touch logic.

If you were using 3.5, you should also use XML from LINQ to quickly analyze your XML parameters.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -