The first call that takes place in my application is a Login()
request to the web service that returns a session ID that will be used for all future calls. However, after enough time, the Session ID may become invalid. So, my call looks like this:
UserService.Status request = serviceInstance.doSomething(id, out result)
// If the error is for an invalid sessionID, log in again
if (request.ErrorCode == 1) { login(); }
Which works fine, but the page will still load without any of the details from the Web Service until a refresh is performed. The simple solution here is to paste serviceInstance.doSomething()
into the conditional, but given there are 50+ Web Service methods, it would mean duplicating the same code 50+ times. Is there a clever way of getting around this and re-executing a request for any UserService.Status.Errorcode == 1
situation that arises?
In case it's relevant, the Status
object looks something like:
<s:complexType name="Status">
<s:attribute name="Status" type="tns:ReMAEStatusType" use="required" />
<s:attribute name="Source" type="s:string" />
<s:attribute name="Message" type="s:string" />
<s:attribute name="StackTrace" type="s:string" />
<s:attribute name="ErrorCode" type="s:int" />
</s:complexType>