« XML Documentation implementation lags behind JavaDoc, data is there, tools are not. | Main | Threading Reference, Process, AppDomain, Monitor, WaitHandles, lock, delegate BeginInvoke, ThreadPool »

Web Services: Things learned & re-learned

Things learned & re-learned:

1.       Only the public fields of types returned by WebMethods get serialized (at least by default).

2.       Multi-dimensional arrays aren’t supported in types returned by WebMethods.

3.       To have state persist across web service requests, WebMethod(EnableSession=true) and save/access the state objects in the Session[] collection.

4.       Add the XmlInclude attribute to a web method that returns derived types. Requires namespace System.Xml.Serialization.

5.       IIS has the ability to use SQL or an in-memory session store mode. A bit of configuration is required for SQL J

6.       Turn off GET & POST protocols:

<webservices>
    <protocols>
        <remove name="HttpPost" />
        <remove name="HttpGet" />
    </protocols>
</webservices>

7.       Set web service namespace:

[WebServiceAttribute(Namespace = NamespaceConsts.AYS15Oct2002)]

8.       Set webmethod’s soap namespaces:

    [SoapDocumentMethodAttribute(

         NamespaceConsts.AYS15Oct2002 + "GetDisplayValue",

         RequestNamespace=NamespaceConsts.AYS15Oct2002,

         ResponseNamespace=NamespaceConsts.AYS15Oct2002 )]

9.       WebMethod signatures. If the method returns void and has multiple out parameters then the client stub incorrectly returns one of the out parameters. Avoid this by returning something other than void from the method.

10.    If a web service is denied file write access, a heavy handed solution is to edit machine.config to replace username=”machine” with username=”SYSTEM” in the processModel section.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)