Wednesday, January 09, 2008

Download Visual Studio 2008 (complete software or Virtual machine)

If you are a MSDN subscriber, you can download your VS 2008 copy from the MSDN subscription site - http://msdn2.microsoft.com/subscriptions

If you are a non-MSDN subscriber, you can download a 90-day free trial edition of Visual Studio 2008 Team Suite here -
90-Day Trial Downloads
Visual Studio 2008 Professional Edition (smaller in size)
Visual Studio Team System 2008 Team Suite
Visual Studio Team System 2008 Team Foundation Server
Visual Studio Team System 2008 Test Load Agent

If you want to use the free Visual Studio 2008 Express editions (which are much smaller and totally free), you can download them here.

If you want to just install the .NET Framework 3.5 runtime, you can download it here.

If you are looking for Virtual Machine (VPC) with Visual Studio 2008 Installed for You then check here -

Visual Studio Team System 2008 Team Suite with Visual Studio Team System 2008 Team Foundation Server
Visual Studio Team System 2008 Team Foundation Server with Team Explorer
To use these virtual machines, you must have either Virtual PC 2007 or Virtual Server 2005 R2 SP1.

If you want free MSDN library it is avaialble for download here - http://go.microsoft.com/?linkid=7947400

To help you jump start with new features with VS 2008 you can download free Visual Studio ebook here - http://go.microsoft.com/?linkid=8010142

Keep watching this blog if you are interested in exploring new features on VS 2008 apart from this ebook. Happy exploring! Cheers - Dipesh

Tuesday, January 08, 2008

Generate code from WSDL/XSD from Visual Studio 2005

In my search of doing my job faster in the development of web services i found this pretty helpful tool: WSCF - Web Services Contract First. This helps us generating .net code (C#, vb.net) from WSDL, XSD and so on. You can generate proxy classes for .net/java or any other client and also .net web service - server side code all from Visual Studio 2005.

You can find the latest version here- http://www.thinktecture.com/media/7478/wscf0.7.zip
You can find the walkthrough document here - http://www.thinktecture.com/resourcearchive/tools-and-software/wscf/wscf-walkthrough

Thanks - Dipesh

Friday, January 04, 2008

Improve web service performance

Mike has posted a nice article that helps one achieve faster web service performance by compressing SOAP. Read here - http://www.dotnetjunkies.com/Article/46630AE2-1C79-4D5F-827E-6C2857FF1D23.dcik

You may want to peek at Microsoft's article as well - http://msdn2.microsoft.com/en-us/library/s25h0swd.aspx

Hope that helps. - DJ

How to compress/uncompress string in .net before passing it over the network?

If you want to compress string before passing it over the network to save bandwidth or uncompress it back here is the code for the same. It usese freeware NZIPLIB library. You can download the source code and compiled assembly from this site. Download now!

using System;
using NZlib.GZip;
using NZlib.Compression;
using NZlib.Streams;
using System.IO;
using System.Net;
using System.Runtime.Serialization;
using System.Xml;
namespace zipper
{
public class MyClass
{
public static string Compress(string uncompressedString)
{
byte[] bytData = System.Text.Encoding.UTF8.GetBytes(uncompressedString);
MemoryStream ms = new MemoryStream();
Stream s = new DeflaterOutputStream(ms);
s.Write(bytData, 0, bytData.Length);
s.Close();
byte[] compressedData = (byte[])ms.ToArray();
return System.Convert.ToBase64String(compressedData, 0, _
compressedData.Length);
}

public static string DeCompress(string compressedString)
{
string uncompressedString="";
int totalLength = 0;
byte[] bytInput = System.Convert.FromBase64String(compressedString);;
byte[] writeData = new byte[4096];
Stream s2 = new InflaterInputStream(new MemoryStream(bytInput));
while (true)
{
int size = s2.Read(writeData, 0, writeData.Length);
if (size > 0)
{
totalLength += size;
uncompressedString+=System.Text.Encoding.UTF8.GetString(writeData, _
0, size);
}
else
{
break;
}
}
s2.Close();
return uncompressedString;
}
}
}

Wednesday, January 02, 2008

XSDObjectGen - nested schema (imports) error with XSD.exe tool

If you read my previous post http://archdipesh.blogspot.com/2008/01/xml-xsdexe-usage-tips.html you may be good if you are using a simple XSD file (no nesting). But if i have multiple XSD files and they are all nested then there is a problem! Using XSD.exe tool doesn't help and fails for nested schema files.

It seems XSD.exe doesn’t seem to recognize element when generating code file...and it spits out the error ... "Class generation failed, cannot recognize root element". If you are facing the same error remove imports element from the XSD just include the namespace and try specifying multiple XSD file names from the command line while executing xsd.exe tool.

OR ... sweet way would be to look at XSDObjectGen tool. This is pretty exhaustive and can handle imports/mutiple xsd files easily. (though one level down). This code can then be used as a class exposed by web services.
Download Sample Code generator from here - http://www.microsoft.com/downloads/details.aspx?familyid=89e6b1e5-f66c-4a4d-933b-46222bb01eb0&displaylang=en

Saves lot of time and pain for sure! HTH, Thanks - Dipesh

XML, XSD.exe usage tips

Here are few quick tips that can help you understand and start with XML basics...

Questions - (preferably in this sequence)
How do you generate XSD ?
You need to have a valid XML file for which you want to have a schema generated ( XSD)
If you have VS .net you can just open the xml file into VS.net and then under XML menu you should see "Create Schema" option that should generate an .xsd file for you!

How do you create classes from an XSD schema?
You can create .net (C#, VB, J#) source code from the xsd using XSD tool (command line) along with MS .net framework.
http://samples.gotdotnet.com/quickstart/howto/doc/xmlserialization/xsdtocls.aspx

How do you convert (deserialize) XML into an object that you can read through .net code?
AND
How do you write out an XML file (serialize) from an object through .net code?

http://samples.gotdotnet.com/quickstart/howto/doc/xmlserialization/rwobjfromxml.aspx

Thats simple ...is it? Thanks - Dipesh

How do i authenticate web service requests before invoking web methods ?

How do i pass user name, password when calling web services ? or
How do i authenticate the web service request before invoking web methods ?

There are several ways to do this and one of the most easiest way is to pass user name, password as input parameters to web method called. but na, that is not a good way to implement as this information is at the periphery of the core business functionality of the web service exposed. Hence keeping this out makes more sense.

Another way to control anonymous access can be achieved through IIS (web server) settings. Just uncheck the anonymous access or limit the IPs that can hit your web services or validate it against your windows account group... but again you may want to implement partial anonymous access! Few web methods can be accessed by everyone, few have restricted access.

In that case, better way to do this is to pass this information into SOAP header (SOAP web services communicate through SOAP messages - which include SOAP envelope (inc. namespace and root element), SOAP Header (this is optional) and SOAP body (contains web method, input parameters and response result)

Working with SOAP Headers in order to have a Web service accept a SOAP header we need to perform the following three tasks:
1> Define a SOAP header class in the Web service project

public class AuthenticationHeader : SoapHeader
{
public string Username;
public string Password;
}

2> Add a public member variable of the SOAP header class created in step (1) to the Web service class

[WebService(Namespace=
http://www.comp.com/yournamespace )]
public class MyWebService : System.Web.Services.WebService
{
public AuthenticationHeader AuthHeader;
... The Web service's methods would be defined down here ...
}

3> Add the SoapHeader attribute to the Web method(s) that need to be able to programmatically access the value of the header

Once we perform these three steps at the Web service's end, our next task is to configure the client so that it can invoke a Web service method and pass along data for the appropriate SOAP header(s). The first step, as we've discussed in earlier installments of this article series, is to create a proxy class on the client. This will auto-generate the SOAP header class defined in the Web service project and will add a public property to the proxy class through which an instance of the SOAP header can be affixed to outgoing messages.

To actually pass along a populated SOAP header when calling a Web method the client needs to first create an instance of the proxy's SOAP header class, populate its values, and then assign this header class instance to the appropriate proxy class property. Finally, calling one of the Web service's methods will invoke the method, passing along the SOAP header.

[WebMethod(), SoapHeader("AuthHeader")]
public string GetMessage()
{
// Only allow valid user/password to access this secret message...
if (AuthHeader.Username == "user" && AuthHeader.Password == "password")
return "This is the secret message!!!";
else
return "YOU ARE NOT AUTHORIZED TO SEE THIS MESSAGE!";
}

In order to send a SOAP header to the Web service method, the client should do the following:
1> Create an instance of the proxy class,
2> Create an instance of the SOAP header class and populate its values,
3> Affix the SOAP header to the proxy class by assigning the SOAP header class instance created in step (2) to the proxy class's AuthHeaderValue property, and, finally
4> Call the Web service method

The following code illustrates these four steps. The GetMessage() Web method is invoked from the client passing along a username/password pair of scott and password.

// step 1, create the proxy class
localhost.MyWebService proxy = new localhost.MyWebService();
// step 2, create and populate the header class
localhost.AuthenticationHeader authInfo = new localhost.AuthenticationHeader();
authInfo.Username = "user";
authInfo.Password = "password";
// step 3, affix the SOAP header to the proxy
proxy.AuthHeaderValue = authInfo;
// step 4, call the method
string result = proxy.GetMessage();
The value returned from GetMessage() will contain the appropriate message, based on the username/password sent via the SOAP header.

Conclusion - If you want to know more or learn real sweet about the whole web services or SOAP basics and details visit
Scott Mitchell's article on http://aspnet.4guysfromrolla.com/articles/123103-1.aspx. He has written 11 part series about .net web services. Hope that helps! Thanks - Dipesh

XML Serialization: what can be XML serialized and what cannot be ?

Few points that you would like to know about XML serialization that may be also important if you are planning to face an interview soon :P)

Realize that XML serialization:
1> XML serialization can only be applied to classes that contain a public default (parameterless) constructor. If you create a class in the Web service that does not have a public default constructor, the Web service will still compile, but when attempting to generate the proxy class on the client's end you'll receive an error message.

2> Read-only class properties are NOT serialized. That is, if a property in the class has only a get accessor, and not a set accessor as well, the property will not be serialized.

3> ONLY public properties and fields are serialized. Private properties are not serialized.

4> To serialize a strongly-typed collection of objects, have the class derived from System.Collections.CollectionBase adding an Add() method and an indexer.
Alternatively you can send an array of the specified type.

On the last point, consider the case where you want a Web service method to accept a set of custom class instances. For example, imagine you wanted to build a Web method that accepted a number of instances of type CreditCardInfo. One option is to have the method accept an array of type CreditCardInfo, like so:

[WebMethod()]
public void FooBar(CreditCardInfo [] collectionOfCCInfos)
{
...
}
Another option is to create a strongly-typed collection class derived from System.Collections.CollectionBase. You'd then pass in an instance of this strongly-typed collection class. For example, you'd first create the class:

public class CreditCardInfoCollection : System.Collections.CollectionBase
{
public void Add(CreditCardInfo cc)
{
this.InnerList.Add(cc);
}

public CreditCardInfo this[int index]
{
get { return (CreditCardInfo) this.InnerList[index]; }
set { this.InnerList[index] = value; }
}
}
And then you'd have the Web service method accept an input of this strongly-typed collection class:
[WebMethod()]
public void FooBar(CreditCardInfoCollection collectionOfCCInfos)
{
...
}

See this article for more details on web services and XML related basics...
http://aspnet.4guysfromrolla.com/articles/121703-1.aspx


btw, Happy New Year 2008 :)
Happy programming - DJ

Friday, December 28, 2007

Creating service with Windows Communication Foundation(WCF) - video

Recently i have started delving into WCF as my project demands and so you may find some posts related to WCF as i learn a little and i plan to share with you. TO begin with this video was very helpful to begin with for me to learn the basics of WCF.

http://weblogs.asp.net/dwahlin/archive/2007/02/03/video-creating-a-service-with-windows-communication-service-wcf.aspx

Also, visit Dan Wahlin's blog to see more illustrations, samples and video tutorials here - http://weblogs.asp.net/dwahlin/archive/tags/WCF/default.aspx

Happy learning WCF!
- DJ

CRM 4.0 SDK

With the release of CRM 4.0 offically, microsoft has planned to release the SDK for the same soon in couple of weeks. Check the first week of new year Jan 2008 here - http://msdn2.microsoft.com/en-us/dynamics/crm/bb456482.aspx for CRM 4.0 SDK download.
Happy learning and Happy New Year! Cheers - DJ

Monday, December 17, 2007

CRM 4.0 (Titan) Overview

Senior Program Manager Phil Richardson provides a nice overview of CRM 4.0 on Channel 9 Forums.

View here - http://channel9.msdn.com/showpost.aspx?postid=356796
Happy learning - Dipesh

CRM 4.0 Data Import

New CRM 4.0 Data Import -

Microsoft offers multiple options to import data into your CRM implementation. It used to have in CRM 3.0 as well but with the Release of Titan there are multiple options to explore as listed:

Bulk Import Wizard - The Bulk Import Wizard has been improved in Microsoft Dynamics CRM 4.0. The list of entities to import has been extended with almost all system entities as well as custom entities. Also, the mappings created between the source data and the CRM system can now be saved and reused in subsequent import activities. Another new feature is the ability to see the list of imported records after the import has succeeded. Based on this list actions can be executed like Quick Campaigns and even deleting the records if necessary. The last major improvement is the ability to enrich data which is already in the system.

Data Migration Framework (3.0)/ Manager (4.0) - The second tool which Microsoft offers is the Data Migration Framework. This tool can be used to import data if any of the following scenarios do apply:
A> Migrate data from multiple sources
B> There are records which are related to others within the same or another entity
C> Notes and / or attachments need to be migrated
D> Data needs to be cleansed before importing into the CRM system


There are several third party tools that can do the job as well if this out of box functionality provided by MS does not fit your bill.

CRM Extensions / c360: ImportManager -
http://www.c360.com/ImportManager.aspx
Scribe TOOL (my favourite, you should look into this if you need both ways data conversion - into CRM and from CRM to external interfaces!) -
http://www.scribesoftware.com/microsoft-dynamics-crm.asp

For additional information visit Ronald's blog - he is the man :) Cheers - Dipesh

Understanding what is best for you ..differences between VPC and Vmware

What you need - VPC or VmWare ?

No matter what your needs, it is very likely that either VMware or Virtual PC/Server can do the job. The key to choosing the right product is understanding your needs. What is it that you want to do with virtualization? Do you want to have a test network on your desktop PC? Do you want to do software development? How many servers will you run concurrently? What operating systems will be run in the virtual systems? The answers to these questions will help you choose the right virtualization product!

Choosing the right product -
Once you take a look at your needs, you will be able to better choose the product you need. For example, if you just want to run a test on Windows XP workstation or 2003 server on your local desktop, then you should choose a desktop virtualization product. Examples of these are - VMware Workstation(300$ odd) and MS Virtual PC(free). Both of those applications are designed to be run on a local desktop.

On the other hand, if you need to run more than 1 concurrent servers that required at least 1GB of RAM each, you are no longer talking about a desktop product. You require an enterprise virtualization server product! Not only because of the amount of RAM required but because we said that we would run “multiple servers”. You don’t want to run them on desktop virtualization products.

For further information or understanding their pros and cons refer - http://www.petri.co.il/virtual_vmware_virtualpc_compared.htm
To download Vmware visit - http://www.vmware.com/
To download microsoft VPC 2007 visit - http://www.microsoft.com/downloads/details.aspx?FamilyId=04D26402-3199-48A3-AFA2-2DC0B40A73B6

Thanks - Dipesh

Monday, November 05, 2007

Browse CRM entities through CRM browser...

This was one is simple... did you know that you can find out what CRM entities exists on CRM box through IE!
It should be something like - http:///sdk/lists.aspx
…/SDK/lists.aspx
(where … is the root address to your crm web app)


Cheers - Dipesh

Microsoft Commits to November Release Date for Visual Studio 2008 and the .NET Framework 3.5

Microsoft Commits to November Release Date for Visual Studio 2008 -

Today, during the keynote address at Microsoft TechEd Developers 2007, S. “Soma” Somasegar, corporate vice president of the Developer Division at Microsoft Corp., announced that Microsoft will release Visual Studio 2008 and the .NET Framework 3.5 by the end of November 2007.... more
http://www.microsoft.com/presspass/press/2007/nov07/11-05TechEdDevelopersPR.mspx

Cheers - Dipesh

Wednesday, October 03, 2007

Source code for .net framework 3.5 libraries and debugging into it using VS 2008

Now you can download and browse the source code of the .NET Framework libraries (3.5), and easily debug them as well using VS 2008.

Source code (with source file comments included) for the .NET Base Class Libraries include as of now -System, System.IO, System.Collections, System.Configuration, System.Threading, System.Net, System.Security, System.Runtime, System.Text.... etc.
ASP.NET (System.Web), Windows Forms (System.Windows.Forms), ADO.NET (System.Data), XML (System.Xml), and WPF (System.Windows). more will be added in coming months by Microsoft.

You'll be able to download the .NET Framework source libraries via a standalone install (allowing you to use any text editor to browse it locally).

To learn more about our source release plans and how the above debugger integration works, please check out this Podcast that Scott Hanselman and Shawn Burke recently recorded. Shawn (who drove the source project on my team) is also going to be publishing a cool Channel9 video later this week that shows using the VS 2008 integrated debugging support with it.
More on Scott gu's blog .... Cheers - Dipesh

Wednesday, September 19, 2007

CRM import export tool for Roles...

If you are looking for CRM import export tool for Roles for CRM 3.0 here it is -

https://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=E55885A7-85A3-48C7-ABEE-B78F0E3D75AA

Credits to Mitch Fuller for bringing this to attention.
Cheers - DJ

Tuesday, September 18, 2007

Crm code 0x80040217 "The specified object was not found"

I have been faced lot many times by this generic .net error from CRM web service. Everytime it let me spend some time in figuring what this error was about ... and i learnt that this type of errors usually occur because of the mismatch/change of CRM metadata or data (GUID) for that record not matching. This can happen anytime when you are trying to do Insert, Update or Delete against CRM.

Easy Solution - Try catching Soap Exception instead of Generic .net Exception and see InnerXML message and it shows CRM code: 0x80040217 with description like: "Missing field/attribute" or it just says plain "Platform".
  1. If you are doing an insert check that all fields that you are using in the query/fetchXML are not misspelled.
  2. If you are doing an Update or delete check the above and ensure GUID you are using does exist in CRM database.

That should be the catch! Write to me if that does not solve your problem. Thanks - Dipesh

Yahoo mashup

Yahoo mashup at developer yahoo.com -
http://developer.yahoo.com/maps/applications.html

Learn simple "how to use" Yahoo mashups in .net - http://developer.yahoo.com/dotnet/

HOWTO Articles -
Get comfortable using .NET with Yahoo! Web Services
HOWTO: Make Yahoo! Web Service REST calls with C# and VB.NET
HOWTO: Using Returned XML with C# and VB.NET
HOWTO: Cache API Calls Using C# and VB.NET
HOWTO: Access Yahoo! Web Services Using XAML (my favourite)
HOWTO: Browser-Based Authentication Using C# and VB.NET

Regards - Dipesh Joshi

Zimbra and its AJAX-based collaboration suite...

Yahoo picks up Zimbra and its AJAX-based collaboration suite to compete with Google, Microsoft and IBM: http://www.eweek.com/article2/0,1895,2184226,00.asp?kc=EWKNLNAV09182007STR3) – it’s a pretty interesting messaging & collaboration environment (heavy use of AJAX).

Zimbra offers an AJAX (Asynchronous JavaScript and XML) client that bundles e-mail, contacts, shared calendar, search and VOIP (voice over IP) that can be used both on and offline, will help it expand its presence in universities, businesses and through ISPs. http://www.zimbra.com/demos/zimbra_overview.html

Regards - Dipesh

Monday, September 17, 2007

Reflector that allows you to disassemble entire Silverlight sites...

Check this Reflector plug-in that lets you disassemble entire Silverlight sites with ease. Check out those cool Silverlight sites http://www.tafiti.com/ and diagnoize it!

http://www.codeplex.com/reflectoraddins/Wiki/View.aspx?title=SilverlightBrowser&referringTitle=Home

Happy learning and copying! :) Cheers - Dipesh

Download Silverlight 1.1 here...

Download Silverlight 1.0 here -
http://msdn2.microsoft.com/en-us/silverlight/bb187452.aspx
Install this to enhance browsers on Windows and Macintosh (for Internet Explorer, Firefox and Safari).

Download Silverlight 1.1 Alpha here -
Silverlight 1.1 Alpha September Refresh
Install this developer-only version to enhance browsers on Windows and Macintosh (for Firefox and Internet Explorer).

Download more here on MSDN

Thanks - Dipesh

Wednesday, September 12, 2007

Hanselmean wicked code links - NGenerics

NGenerics - "A class library providing generic data structures and algorithms not implemented in the standard .NET framework." This is cool code because it's not only adding new data structures, but also extending existing ones. They've added an IVisitor interface to add the Visitor pattern to create the VisitableHashTable amongst others.

More ... [1] - http://www.hanselman.com/blog/TheWeeklySourceCode5.aspx
Cheers - Dipesh