Showing posts with label web service. Show all posts
Showing posts with label web service. Show all posts

Thursday, May 9, 2013

My first windows phone 8 app - SG News Cloud services

I had a small window of time while waiting for my new job and managed to squeeze an application for windows phone 8. I would like to share my experience and decisions along the way.

Why are you creating applications for windows phone 8 when the smartphone OS is low?
 Well, i am not an expert in iOS/android development, although i have led a full team in delivering mobile solutions, but i didn't had opportunity to write full native applications. With less than 1 week of time, i've decided to leverage on my .NET experience to write an application

What advice do you have for me to be an indie developer hoping to get some passive income?
First of all, if you are an indie developer, plan out your budget & time. Even if you have the best application idea, but if it would requires $500,000 of upfront investment (which you find out in the midst of developing), then you are just wasting your own time. Software licenses, equipment, etc were all consider before i started.

When i decided to make a windows phone app, i've read up on what are the software prerequisites. So for windows phone 8, obviously you would need the Windows Phone 8 SDK, and here are the requirements as well as the link. I would also need a cheap windows phone 8 device (i bought a Lumia 620 for SG$350), as well as the developer account (SG$135).

Can you just tell me how much you spent in total before getting everything up?
SG$135 + SG$350 = SG$485

But that's not all, put into consideration the Windows 8 OS that you need in order to use the SDK. Luckily i gotten my windows 8 key from MSDN subscription.

So you mean i have to subscribe for MSDN in order to get everything running? You know how much it costs?

Frankly, i don't know how much it costs, but i managed to get an MSDN account from BizSpark, a short overview, it's a Microsoft initiative to help 'start-ups'. They provide free Azure & MSDN accounts to kick start your 'business'.

Enough of Q&A, if you have more, do comment on this post. Let me give a short breakdown of the architecture.

Even though i was given a free azure account, after some evaluation, i went ahead with Google App Engine (GAE). Reasons?

  1. Azure was too much fluff and complicated for me to get a simple thing done. Here's a quick wiki look up of what they are offering.
  2. .NET framework is powerful, but too bloated in my case, which might incur high utility costs.

So after deciding on GAE, i was at crossroads once again, Python, Java or Go? I've avoid Azure due to bloat, so no Java. Go is young for my liking, so i went with Python. 

Was it a challenge? 

To my surprise, No. I have zero knowledge on Python but it only took 2 days for everything to start working. Google did a great job in providing python toolkit which offers very useful features, e.g. authentication, authorization, api to Memcached, NoSQL, and many more.

So i hacked up a REST webservice and simple Content Management System (CMS) using GAE, webapp2 and JINJA templates. Tested everything a few rounds and didn't had to bother much about the cloud server anymore. Oh and not to mention GAE gives 1gb of bandwidth daily as opposed to Azure's complicated free tier

I will update with the windows phone 8 application development in my next post :) in the meantime, if you have a windows phone, do take a look SG News

Tuesday, October 12, 2010

WSE 3.0 & inversed murphy's law

I know that murphy's law exist and in short, it's a law that states that whatever might go wrong, will go wrong.

But I was forced to do OT to implement WSE 3.0, a technology that went out of support(?) since 2005? I started the implementation with a I'm-gonna-OT-till-client-gets-pissed attitude. But at the last min after struggling for 2hrs with an exception, "The security token cannot be authenticated or authorized."

I managed to rectify it... A stroke of genius came when I try to use command prompt to run notepad as the user specified in the security contract.. Command prompt returned me: user account is being locked out.


True enough everything went OK after I unlocked the account via "local users and group" -__-

The command:
"runas /user: notepad.exe"

For once.. Murphy's law worked for me instead of against me.

Wednesday, July 28, 2010

WSE 3.0 extreme latency

We had a legacy .NET web-service that uses WSE 3.0. We are the service provider and we have an intermediate authentication server as well as the consumer. We had intermittent mysterious socket time out exceptions.

A thorough network snoop was conducted across 4 network teams (we span across 2 intranet and 2 WAN domains). Everything was healthy with <10ms latency between hops.

It was puzzling and a stroke of genius came by and we decided to check the inputtrace.webinfo and outputtrace.webinfo (default logging configs). Nothing special about it except for the size. Monthly scheduled jobs archival results in file size in excess of 600mb. Some team members had argued that logging mechanism should be asynchronous and should not have any influence on the response SOAP. There's no harm trying to flush out the logs and archive and do a re-test. Sure enough everything was back to < 0.5s

Our corrective action was to increase the frequency of the archival from monthly to weekly.

Friday, April 9, 2010

IIS logs 400 0 64

From my previous post, i've described how to consume a .NET webservice using netbeans. However, due to the JDK version on my colleague's solaris server, they are not able to import several libraries in order to do so.

Thus, they had use socket programming to send out the SOAP request. Everything was doing fine and well on development server, SIT server, and our local machines.

The wierd thing happens when the swing-over to UAT. When the function was called to send the SOAP request and in the while loop that waits for server response, it kept waiting... waiting... waiting... After several attempts to find faults in the java, web service and JDK versions. There was still no good explanation nor solutions. I went onto the web service machine and dug up the IIS Logs and found a couple of lines that showed the request reaching the web service machine but with an error code 400 0 64. After some research, i found out that the error code represents Bad request. Another vague error message -_-.

I almost wanted to give up, until i went into the HTTPERR folder and open up the logs and saw something that caught my attention. There was a request coming into the server via port 9090, but the response was sent to a random port number.

Bingo! In my client's environment, firewalls will block all the traffic going into the servers unless the need arises and we have to write in service requests to open up the port.

1 more problem resolved and hope this post will help anyone that hit this error.

Monday, April 5, 2010

Consume .NET webservice with only WSDL file

Objective: Consume .NET web service
Problem: I only have WSDL file (Server is blocked from my dev server)

In the past, a web service consumption was only: Right click on project, click on "Add web reference" and enter URL. But it's different this time as the production server had firewalls that blocked unauthorized/unnecessary access. I know it's possible to generate class files from the WSDL file, but how?

Time saver:.NET Framework Tools

After you generate the .cs file, CSC compile it into a dll and put the dll into your project and you will be able to invoke web methods immediately. For my case, i have to bring it to the production server to try access it, and it did worked perfectly :)

Friday, April 2, 2010

Consuming .NET webservice using Java (netbeans 6.8) in 2 mins

I'm not a very Java person, but i was tasked to assist a team of Java developers using Solaris server. (A .Net developer's nightmare) I'm a GUI person and didn't like the command line concept, well it's powerful and have very little overhead but i need time to learn before jumping into it.

I told the team that i'm a .NET person, not a java guy. They told me leave the console/terminal/ftp to them, just help them to consume a .NET web service. Good.

I asked them from the WSDL file and went to research how java can consume a web service.

Luckily, there was a lot of resource out there documenting how to consume web service in netbeans.

First, create a New Project in NetBeans, give it a meaningful name.
Second, add a file and select "Web service" tab.
third, browse the wsdl file and click "Finish".

Now NetBeans will auto generate all the dependent files.

Expand the tree under your webservices and you will be able to see the web methods with red dots.

Drag and drop them into your methods and all the objects will be automatically instantiated and invoked with default values.

Using your java DAO(Data Access Objects) or equivalent and assign them the correct values and hit then run button.

There you go, java consumption of .NET web service in under 2 mins.