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. Advertisements

  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. Advertisements

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,200
    ouadid abdelkarim
    Jul 10, 2003
  2. metfan
    Replies:
    2
    Views:
    5,087
    Robert Olofsson
    Oct 21, 2003
  3. greg
    Replies:
    6
    Views:
    671
    Dietmar Kuehl
    Jul 17, 2003
  4. Colin J. Williams

    Webchecker Usage - a problem with local usage

    Colin J. Williams, Feb 25, 2004, in forum: Python
    Replies:
    1
    Views:
    739
    Colin J. Williams
    Feb 26, 2004
  5. hvt
    Replies:
    0
    Views:
    1,407
  6. hvt
    Replies:
    0
    Views:
    1,767
  7. Krist
    Replies:
    8
    Views:
    9,692
    Arne Vajhøj
    Feb 10, 2010
  8. MrsEntity
    Replies:
    20
    Views:
    773
Loading...