Posting SOAP request from Windows Powershell

A previous post on this blog showed how posting a SOAP request from the command line on Linux could be done.

Following the post about Invoke-Web-Request, I’ll show how to achieve the same task using Windows Powershell v3 CTP 1.

The first step is to build a sample SOAP request and save it on a text file, maybe called “soap.txt”. For the sake of this example I saved it on a temporary folder “C:\Temp”

Afterwards, open a powershell command prompt window and type this in:

Invoke-WebRequest http://[your web service endpoint address] -Method Post -ContentType "text/xml" -InFile C:\Temp\soap.txt -OutFile c:\Temp\soapRes.txt

The command has the following parameters:

  • method: indicating the request should be sent using HTTP POST
  • content type: stating the request is an XML message
  • input file: the SOAP request text file
  • output file: the name and path for saving the SOAP response

After execution, the resulting SOAP response is saved on the temporary folder under the name “soapresult.txt”.

Cool!

Advertisements

Windows Powershell V3 includes command like wget/curl

The Windows Management Framework 3.0 – Community Technology Preview (CTP) has been released by Microsoft and with it comes Powershell V3.

Included on this release of powershell comes a command I’ve personally been missing for ages. A command to get or just test a given URL address. The is called:
Invoke-WebRequest

A simple example of the command usage would be the get this blog’s home page into a single text file:

Invoke-WebRequest https://rambletech.wordpress.com/ -OutFile c:\temp\blog.txt

Another example, more complex, would be to get this blogs RSS feed and parse it:

([xml](Invoke-WebRequest https://rambletech.wordpress.com/rss).content).rss.channel.item | Select Title, Link

To download the Windows Management Framework 3.0 CTP 1 visit this address from Microsoft.

Happy programming 🙂

Boot Windows 7 directly from Virtual Hard Disk image

An underrated feature from Windows 7 is its ability to boot directly from a VHD file without the need for additional virtualization software.

The advantage is evident: you can have different Windows 7 deployments on your machine without resort to virtualization software, thus using the full potential of your hardware.

Being a developer, a recurring challenge is to have a development environment setup that doesn’t permanently compromise the workstation’s performance. The compromise is consequence of sometimes having database and application servers, as well as different IDE all installed and running services at the same time.

Usual solution to avoid such compromise are:

  • having virtual machines, dedicated to each development scope, and using them individually without installing any development software on the host. However, virtualization can have a big cost on hardware performance.
  • Remote desktop to a hosted development environment instance. This limits the environment’s accessibility (usually to the workplace) and is not an option for small companies.

Given this options, the VHD boot architecture seems very attractive. the downside to this option is that its only available on the Ultimate and Enterprise versions of Windows.

To find a walk-through of common scenarios of native VHD boot, visit this technet’s page.

Judging by the way things progress, it’s will soon be possible to run Hyper-V on a Windows client OS system.

Windows Server 2008: “You do not have sufficient privileges to complete this installation for all users of the machine.”

On one of my current projects, migrating a Web application from Windows Server 2003 to 2008, the previous version of the code was migrated from .NET 2.0 to version 4.0. The binaries were assembled into executable setup files for automatic installation and deploy of the web app.

While trying to run the setup file the following error appeared: “You do not have sufficient privileges to complete this installation for all users of the machine.”

The current user logged on was a local administrator so all privileges were adequate. After a short googling, the root cause was identified: User Access Control. It’s also present on Windows Server 2008 and enforces notification before any changes are made to the system.

The solution:

  1. Go to Start > Control Panel
  2. Select User Accounts
  3. Select User Accounts (again!)
  4. Select Change User Account Control settings
  5. Change the security level to never notify
  6. Restart the machine

After a successful installation you can always revert the settings to the more secure ones.

LibreOffice spellcheck not working – try this

After installing LibreOffice 3.4.3, I gave a test run and scribbled something on the word processor. Immediately I noticed that the spellcheck was not working. My native language is not English, so I checked to see if the Language settings were correct. Open the “Options” window from the “Tools” menu. Selected “Language Settings > Languages”. Everything was correct:

I couldn’t find anything on the options manager that put spellcheck to work. Finally, inside the word processor, I selected “Tools > Languages > More Dictionaries Online”:

It opened a browser window on a OpenOffice Wiki page. After searching a while, I landed on the following URL: http://extensions.services.openoffice.org/en/dictionaries

I downloaded the extension corresponding to my desired language, a .OXT file, opened with the LibreOffice extension manager and installed it.

I restarted the Word processor and it just worked. HTH!

Offline Google Mail without using a desktop client

For some people, having offline access to their inbox is a must. Because of that, some of the goodness and productivity shortcuts made available on the Web mail clients is lost, replaced with standard applications like Thunderbird and Outlook.

For Gmail users, who use the Chrome Web browser, the use of a full desktop e-mail client is now optional.

Google has released  the Offline Google Mail application for the Chrome Web browser. Quoting the Web store’s description, Gmail Offline beta is a Gmail app built to support offline access, allowing mail to be read, responded to, searched and archived without network access. After first start-up, Gmail Offline will automatically synchronize messages and queued actions anytime Chrome is running and an Internet connection is available. More than just an offline app, the streamlined user interface, based off Gmail’s popular tablet interface, provides extremely fast response time with a pure, email focused experience.