-1

I have an appcode with many classes that contain the business logic and Data access layer. I am trying to port over classes to a web service but I have to create an asmx for each class. Are there ways around this ? Please help

Nano_Bott
  • 1
  • 2
  • you should separate the logic meaning if you are wanting to return data, then the WebService should only be used for that, and if you need to do validations based on the business logic prior to Invoking a web service method then that should be done for example `ClientSide` have you looked at any of the simple Web Service Examples / Video Tutorials on line..? `YouTube has tons of them` especially using `LinqToSql` if you have existing code also can you show your code what you have so far just snippets not the entire project – MethodMan Mar 03 '15 at 21:48
  • how does one reference a base class to a whole class in a asmx page ? – Nano_Bott Mar 03 '15 at 23:27

1 Answers1

0

You could use a single ASPX page and pass along a Request["mode"] variable from the client that will switch which business object you serialize back(hopefully in JSON). This will break your WSDL though.

Ryan
  • 97
  • 4
  • `[Web Service]` can return both Json as well as XML or DataTables, etc.. web services is not an `aspx` page by the way.. – MethodMan Mar 03 '15 at 21:46
  • I am aware that aspx is not a "traditional" web service, rather it is a web form. If s/he is looking for an alternative to creating a [web service] that is not codified in a WSDL then this approach can work. POST to the ASPX get a JSON object in return. The issue is you must then communicate the correct parameters to the end user for what to pass to the form. YAML is a step in that direction to ease that but is just another markup. Again, this is an alternative way to handle the request/response pattern of a web service. – Ryan Mar 03 '15 at 22:00
  • I understand what you are saying @Ryan but you are focusing solely on JSON as a means of returning data when other datatypes can be returned and used just as easy.. also it's rather hard to recommend something when the OP has not shown any code so that's like jumping the gun before the stater pistol has been fired.. – MethodMan Mar 03 '15 at 22:15
  • OP wanted a way to trim down the number of ASMX files. I offered a solution that will work. With everything there is a downside. – Ryan Mar 04 '15 at 21:12