WebService usage decision

Discussion in 'ASP .Net Web Services' started by hima, Nov 14, 2005.

  1. hima

    hima Guest

    Hi,
    I need to make a decision if company gonna use WebServices in out new project.

    As I understand WebService uses serialization when passing parameters
    from/to client. This meens that there is a lot of xml tags. Can somebody tell
    me, does WebService sends this xml as is, or it does some kind of
    trimming/restoring when communicating?

    Does WebService use sessions, or it opens/closes every time client calls
    web-method? If it does can it be used to store some data associoated with the
    client's session?
     
    hima, Nov 14, 2005
    #1
    1. Advertising

  2. hima

    Peter Kelcey Guest

    Hima,

    By default, ASP.NET web services do not use the httpsessionstate
    object. However, you can enable support of the session by using the
    "EnableSession" attribute on your web method.

    Example:
    <WebMethod(EnableSession:=True)> _
    Public Function HelloWorld2() As String
    Return "HelloWorld"
    End Function

    Here's an excerpt from MSDN on what you may need to do on the client
    side in order to support the use of the session.

    An XML Web service client is uniquely identified by an HTTP cookie
    returned by an XML Web service. In order for an XML Web service to
    maintain session state for a client, the client must persist the
    cookie. Clients can receive the HTTP cookie by creating a new instance
    of CookieContainer and assigning that to the CookieContainer property
    of the proxy class before calling the XML Web service method. If you
    need to maintain session state beyond when the proxy class instance
    goes out of scope, the client must persist the HTTP cookie between
    calls to the XML Web service. For instance, a Web Forms client can
    persist the HTTP cookie by saving the CookieContainer in its own
    session state. Because not all XML Web services use session state and
    thus clients are not always required to use the CookieContainer
    property of a client proxy, the documentation for the XML Web service
    should state whether session state is used.



    With regards to the XML, it is sent as is. A SOAP request to a method
    called "GetStockPrice" that takes a single parameter called "Price"
    would look like this.

    <?xml version="1.0"?>
    <soap:Envelope
    xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
    soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
    <soap:Body xmlns:m="http://www.stock.org/stock">
    <m:GetStockPrice>
    <m:StockName>IBM</m:StockName>
    </m:GetStockPrice>
    </soap:Body>
    </soap:Envelope>

    Hope that helps

    Peter Kelcey
     
    Peter Kelcey, Nov 14, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ouadid abdelkarim
    Replies:
    0
    Views:
    2,011
    ouadid abdelkarim
    Jul 10, 2003
  2. Jim Adams

    Q&A Decision Tree in ASP.Net

    Jim Adams, Apr 27, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    742
    Jeff Bennett
    May 16, 2004
  3. Scooby Doo

    newbie -how do you defend your decision?

    Scooby Doo, Jul 19, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    355
    Kevin Spencer
    Jul 20, 2004
  4. clintonG
    Replies:
    1
    Views:
    287
    Steve C. Orr [MVP, MCSD]
    Aug 12, 2004
  5. greg
    Replies:
    6
    Views:
    462
    Dietmar Kuehl
    Jul 17, 2003
Loading...

Share This Page