Groups > Asp .Net > Advanced ASP.NET Architecture > Re: Web Service Design Method




Web Service Design Method

Web Service Design Method
Thu, 3 Apr 2008 10:43:31 +0000
We currently encapsulate our request and respones from our services into an
object.

So if we have a method that accepts one string and returns one string the
contract for that method would be:

Public Class Operation1Request
    Public String1 As String
End Class

Public Class Operation1Response
    Public String2 as String
End Class

<WebMethod()> _
Public Function Operation1(byval operation1Request as Operation1Request) as
Operation1Response
     Dim op1Res as New Operation1Response
     op1Res.String2 = operation1Request.String1 & "hey hey hey"
     return op1Res
End Function

I have read on this design methodology in the past, and from what I remember, it
assists in interop (java to .net and etc.), and some other reasons I can't think
of.

Can anyone validate this design method for me?  Is there any other benefits?

Thanks
Post Reply
Re: Web Service Design Method
Thu, 3 Apr 2008 14:32:26 +0000
When something errors out in our services we send a standard SOAPException.

System.Web.Services.Protocols.SoapException, not Operation1Response.
Post Reply
Re: Web Service Design Method
Thu, 3 Apr 2008 16:40:24 +0000
Creating a response object is very helpful.  I would suggest capturing stack
track information, error info, etc. in the object to help ensure that consumers
of the web service get something at the very least even if something bombs they
get something back, versus them questioning if they even have connected.
Post Reply
about | contact