Making WCF service request using Postman


You don’t need another WCF client to test WCF services if you already have fantastic Postman installed on your machine. But requesting WCF service using Postman needs little more than just providing a Service Url and a Xml body to the SOAP request. One issue developers always stumble upon first time when using Postman to call a Wcf service is this cryptic error message: The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher..

Following is an example ActionNotSupported fault response raised by the Wcf Service:

 1 2 3 4 5 6 7 8 9101112131415
<s:Envelope xmlns:s="">
    <faultcode xmlns:a="">
    <faultstring xml:lang="en-US">
      The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the
      EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and
      receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver
      have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
ActionNotSupported Soap Fault Code raised by Wcf Service

Inspecting the exception fault string more carefully, you will surely realize that the exception has something to do with Action “. Postman is apparently not sending any Action contract with the SOAP request, and Wcf service is treating it as empty Action. With the empty received Action, service trying to match it with its own Action contract which result as mismatch. And this is what is causing the exception.

To resolve the issue, you need to explicitly provide a SOAPAction to the header with your SOAP request to the service. You can get the SOAPAction of the web method from the WSDL document of your Wcf service. Just navigate to the WSDL Uri, which usually your Wcf service Url appended with “?wsdl”, and look for soap:operation node of the web method you want to call. Copy the value of soapAction attribute which will be something like<Your Service Name>/<Method Name> and use this value as SOAPAction of your service call.

Get the SOAPAction value from WSDL document of your Wcf Service

Adding SOAPAction header in Postman is simple. You have to goto Headers tab of the Postman for the Wcf service, add a New key, provide Key as “SOAPAction” and the Value whatever you copied in above step.

Configure SOAPAction

With the SOAPAction configured for your Wcf service, hit Send button in Postman to make service call and voila! You should receive proper SOAP response from the service. Save the Service request in the Postman so that you don’t have to do the same SOAPAction configuration again for the service.

Wcf service call using Postman

My automatized workflow to setup Postman to call Wcf service is following:

  1. Make GET call of the service Url with appended “?wsdl”.
  2. Copy the value of soapAction attribute of your SOAP method.
  3. Change Http method to POST and remove “?wsdl”
  4. Provide header with key “SOAPAction” and value copied soapAction attribute.
  5. Set “Content-Type” header as “text/xml”
  6. Provide SOAP Envelop in Body
  7. Hit Send (and Save for the future task).

Tags: soap, tool, postman

How to go back to previous directory in DOS command prompt?


If you shuffle a lot between Linux/Mac and Windows OS, you surely miss many Linux shell commands in Windows Command Prompt and you definitely wish if you can replicate or have some kind of workaround of those commands in Windows to make life bit easier. One of those commands is navigating back to the previous directory. In Linux, you can just type: cd - and voila, you go back to your previous directory. No need to check paths of previously entered directories. That’s one handy command. As usually happen with most productive shell commands, there is no equivalent command parameter in DOS.

I was looking for some kind of workaround to achieve same in DOS but when I couldn’t find any solution online so I decided to devise and build my own solution. It started with a very basic DOS batch file which just simulates Linux cd – command but slowly and gradually it grows over the period of time as I added more and more features.

So how does it work? To implement this solution, you will need two batch files: ccd.bat and dos_init.cmd. ccd.bat will have actual batch commands which take care of redirecting command to appropriate branch and keeping the history of visited directories whereas dos_init.cmd will create DOSKEY aliases for cd command. You should create both files in one of your PATH directories (for example C:\Windows) so that DOS will able to locate these in Command Windows.

 1 2 3 4 5 6 7 8 910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
@echo off
if '%*'=='' goto show_current_directory
if '%*'=='~' goto home_directory
if '%*'=='-d' goto my_documents_directory
if '%*'=='-p' goto program_files_directory
if '%*'=='-w' goto windows_directory
if '%*'=='--' goto previous_directory
if '%*'=='-' goto toggle_directory
goto change_directory

    goto batch_end

    call:GotoDirectory %HOMEPATH%
    goto batch_end

    call:GotoDirectory %HOMEPATH%\Documents
    goto batch_end

    call:GotoDirectory "%PROGRAMFILES%"
    goto batch_end

    call:GotoDirectory %WINDIR%
    goto batch_end

    set current_dir=%cd%
    goto batch_end

    set current_dir=%cd%
    cd %previous_dir%
    set previous_dir=%current_dir%
    goto batch_end

    call:GotoDirectory %*
    goto batch_end

    pushd .
    set previous_dir=%cd%
    cd %~1


@echo off
doskey cd=ccd $*
doskey cd..=ccd ..
doskey cd--=ccd --
doskey cd-=ccd -
doskey cd\=ccd

You always require running dos_init.cmd before using ccd.bat so that assign aliases are available for ccd batch file. To automate that, you can simply add an entry in Windows Registry which will automatically run dos_init.cmd command every time you open Command Windows.

[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]

Following are steps to create above Registry entry. Be careful when editing the registry and make sure you know what you’re doing.

  1. Open Windows Registry.
  2. Go to registry path: [HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
  3. Create a registry entry with key as “AutoRun” and value as complete path of your dos_init.cmd

And that’s all we need.

Let’s go through the usage of this batch file:

Type cd- to toggle between last and current directory.
Type cd-- to go back to previous directories.
Few more examples to changing directory to system folders using this solution.

I hope you will find this hack useful. So how you want to further enhance this batch file? Please do share your changes and improvements here so that others can also benefit.

Tags: dos, utility, tool, window

Stop flickering between pages in IE


If you hate that slight flicker in IE browser between page transitions then you will find this snippet useful. When the user navigates from one page to another, there is a slight white out before next page renders on IE. On other browsers like FireFox or Chrome has a relatively smoother handle for such transition. If your web application has the significant number of post backs then this becomes more annoying to users.

To reduce this flicker in IE, simply add below META tags in the HEAD section of your page.

<META http-equiv="Page-Enter" content="blendTrans(Duration=0.05)" />
<META http-equiv="Page-Exit" content="blendTrans(Duration=0.05)" />

By reducing the duration of fading content from the previous page and revealing new content from next page, user experience relatively smooth transition between pages. The good thing about above implementation is that above META tags will not have any impact on other browsers.

Tags: browser, usability, html

Getting list of modified objects in SQL Server

SQL Server

Sometimes it always helps to get the list of all modified tables or stored procedures before check-in the code or wrapping up the development for the build. Some developers usually keep this kind list in a file and they update this file every time they modify any table or stored procedure in their development environment. Following are some handy SQL snippets which can provide you list of the tables, or stored procedure modified in the specified duration.

-- tables modified today
SELECT [name],create_date,modify_date
FROM sys.objects
WHERE modify_date>DATEADD(day,-1,GETDATE())
AND type='U'

-- stored procedures modified today
SELECT [name],create_date,modify_date
FROM sys.objects
WHERE modify_date>DATEADD(day,-1,GETDATE())
AND type='P'

You can further tweak above query to specify a more specific duration, for example, objects modified in last 7 days.

-- tables modified in last 7 days
SELECT [name],create_date,modify_date
FROM sys.objects
WHERE modify_date>DATEADD(day,-7,GETDATE())
AND type='U'

Tags: sql, sqlserver, tsql

iPhone - Scroll Bottom Bookmarklet


You can easily scroll to the top of the webpage by just tapping on the top bar ( the bar which has icons like signal status, carrier name, time etc.) of iPhone but how about scrolling to the bottom of the page? If you are browsing very long web page then sometimes it becomes a bit annoying to scroll through the whole page to get the bottom of the page. But here is a small Javascript hack, through which allow you to scroll to the bottom of the page with just one tab. You just require adding this Javascript code as a bookmarklet (or sometimes it also called Favelet):

Javascript Code:

javascript:(function(){scroll(0, document.body.scrollHeight);})();

Link: Scroll Bottom

To add Scroll Bottom bookmarklet, just drag above link to Safari Bookmarks Bar and then sync to your iPhone through iTunes.

Following are some relative articles for bookmarks and syncing to the iPhone:

Syncing iPhone and iPod touch with your computer
iPhone: Using Bookmarks
17 powerful bookmarklets for your iPhone

Tags: bookmarklet, iphone, javascript

ASP.NET State Management: ASP.NET State Management: View State


Milan Negovan has written an article to provide an in-depth perspective on ViewState mechanism. In his article, he suggested some of the do’s and dont’s of using ViewState, for example, how simply disabling view state of the whole page can greatly enhance the performance of the page, if you just need to display a DataGrid on the page with no PostBack.

ASP.NET State Management: View State

I have seen many occasions that developers left EnableViewState true even if they just want to display a basic report page containing a grid control. This leads to the page to generate huge rendered payload for the ViewState.

Tags: viewstate,