Pages

Monday, January 19, 2009

Dealing with Obj C webservices and .NET - Part I

Spent about 10 hours getting the web services working.
Now, I can pass simple strings and get complex objects from .net web server.

Debugging Techniques I used:

[WebMethod]
public Requestor LoadRequestorById(int requestorId)
{
//logs in the inforation
//stores request
base.Context.Request.SaveAs(base.Context.Request.PhysicalApplicationPath + "RequestLogs\\LoadRequestorById.xml", true);
//logs the information
TestMobilePortal.Insert("LoadRequestorById (" + requestorId + ")");

Requestor requestor = new Requestor();
requestor.Id = requestorId;
return requestor.LoadById();
}

This is one of my web service method. First, I stores the request in RequestLogs folder using:

base.Context.Request.SaveAs(base.Context.Request.PhysicalApplicationPath + "RequestLogs\\LoadRequestorById.xml", true);

This provides me all the html request that was posted to the server by my iPhone application.


Then, I store the method name and parameters passed in database:

TestMobilePortal.Insert("LoadRequestorById (" + requestorId + ")");

After that, I perform my task. Using these techniques, I can know what requests are coming. They helped me tracking down bugs.

No comments:

Post a Comment