In addition to supporting HTTP-GET and HTTP-POST, ASP+ Web Services can be invoked using the industry standard SOAP protocol. SOAP defines an XML grammar for identifying the method name and wrapping, with schema, the method parameters. It also defines an XML grammar for returning results.
SOAP provides the richest extensibility mechanism of the three protocols supported by ASP+ in the current release. In addition to supporting all standard datatypes and value classes (like HTTP-GET and HTTP-POST support), SOAP invocations also support scenarios where classes, structs, and datasets can be passed as arguments to methods on a web service. It also supports byref argument parameters. By default it is the protocol used by the classes generated by our client-proxy tool. Note that the payloads transmitted are considerably larger and more complicated that the simple HTTP-GET and HTTP-POST formats.
Class and struct marshalling, both as arguments and as return types, is accomplished by XML serializing all public fields and properties of the target class over the wire. It is important to note that this serialization is an externalized process, meaning that only public fields and properties are marshaled. Objects that utilize private field members will transfer with perhaps inaccurate results if they are not also represented with a corresponding get/set property. For example, the following class correctly transfers over the wire:
public class Order { public int OrderID; public Double SalePrice; }
This alternate version, which encapsulates all field values with public get/set property accessors, also correctly transfers over the wire:
public class Order { private int m_OrderID; private Double m_SalePrice; public int OrderID { get { return m_OrderID; } set { m_OrderID = value; } } public double SalePrice { get { return m_SalePrice; } set { m_SalePrice = value; } } }
However, the following class will not transfer correctly over the wire. Since its internal Value field is updated via methods, and the field is not publicly accessible via a property accessor:
public class Number { private int m_Value; public int GetCurrentValue() { return m_Value; } public void Increment() { m_OrderID++; } public void Decrement() { m_OrderID--; } }
ASP+ Web Service developers should explicitly design their classes with marshalling and XML schema specifically in mind. Utilize the transmitted classes more as XML structs than as fully functional business objects.