Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 2.0
 OneWay Property
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
.NET Framework Class Library
SoapDocumentMethodAttribute.OneWay Property

Gets or sets whether an XML Web service client waits for the Web server to finish processing an XML Web service method.

Namespace: System.Web.Services.Protocols
Assembly: System.Web.Services (in system.web.services.dll)

Visual Basic (Declaration)
Public Property OneWay As Boolean
Visual Basic (Usage)
Dim instance As SoapDocumentMethodAttribute
Dim value As Boolean

value = instance.OneWay

instance.OneWay = value
C#
public bool OneWay { get; set; }
C++
public:
property bool OneWay {
    bool get ();
    void set (bool value);
}
J#
/** @property */
public boolean get_OneWay ()

/** @property */
public void set_OneWay (boolean value)
JScript
public function get OneWay () : boolean

public function set OneWay (value : boolean)

Property Value

true if the XML Web service client does not wait for the Web server to completely process an XML Web service method. The default value is false.

When an XML Web service method has the OneWay property set to true, the XML Web service client does not have to wait for the Web server to finish processing the XML Web service method. As soon as the Web server has deserialized the SoapServerMessage, but before invoking the XML Web service method, the server returns an HTTP 202 status code. A HTTP 202 status code indicates to the client that the Web server has started processing the message. Therefore, an XML Web service client receives no acknowledgment that the Web server successfully processed the message.

One-way methods cannot have a return value or any out parameters.

If you are using the .NET Framework version 1.0 XML Web service methods that have either the SoapRpcMethodAttribute or SoapDocumentMethodAttribute attribute applied to them with the OneWay property of set to true, do not have access to their HttpContext using the static Current property. To access the HttpContext, derive the class implementing the XML Web service method from WebService and access the Context property.

The following code example is an XML Web service method that does not require the client to wait for the XML Web service method to complete. Therefore, the sample sets the OneWay property to true.

Visual Basic
<%@ WebService Language="VB" Class="Stats" %>
 
Imports System.Web.Services
Imports System.Web.Services.Protocols

Public Class Stats
    Inherits WebService
        
    <SoapDocumentMethod(OneWay := True), _
    WebMethod(Description := "Starts nightly statistics batch process.")> _
    Public Sub _
        StartStatsCrunch()
        
        ' Begin nightly statistics crunching process.
        ' A one-way method cannot have return values.
    End Sub
End Class
C#
<%@ WebService Language="C#" Class="Stats" %>
 
 using System.Web.Services;
 using System.Web.Services.Protocols;
 
 public class Stats: WebService {
 
      [ SoapDocumentMethod(OneWay=true) ]
      [ WebMethod(Description="Starts nightly statistics batch process.") ]
      public void StartStatsCrunch() {
         // Begin nightly statistics crunching process.
         // A one-way method cannot have return values.
      }      
 
 }

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker