<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hans Rasmussen &#187; Webservice</title>
	<atom:link href="http://www.hansrasmussen.com/tag/webservice/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hansrasmussen.com</link>
	<description>info@hansrasmussen.com, +46 (0)723 207008</description>
	<lastBuildDate>Wed, 01 Feb 2012 11:59:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Consuming a JSON service with C#</title>
		<link>http://www.hansrasmussen.com/2012/02/consuming-a-json-service-with-csharp/</link>
		<comments>http://www.hansrasmussen.com/2012/02/consuming-a-json-service-with-csharp/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 11:58:16 +0000</pubDate>
		<dc:creator>Hans Rasmussen</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[serialization]]></category>
		<category><![CDATA[Webservice]]></category>

		<guid isPermaLink="false">http://www.hansrasmussen.com/?p=803</guid>
		<description><![CDATA[If you like to consume a JSON web service in C# this example might be handy. You need to know the url (web address) of the web service You need to understand what the web service will return You need to know what kind of security the web service accepts (My example uses Basic Authentication) [...]]]></description>
			<content:encoded><![CDATA[<p>If you like to consume a JSON web service in C# this example might be handy.</p>
<p>You need to know the url (web address) of the web service<br />
You need to understand what the web service will return<br />
You need to know what kind of security the web service accepts (My example uses Basic Authentication)<br />
You need to understand under which context you are consuming the service (My example uses a Proxy server to communicate)</p>
<p>I found a site that automatically generates a class based on the result of the JSON web service at <a href="http://json2csharp.com/">http://json2csharp.com/</a>. This site can generate an class either by you specifying the url to the web service or providing the JSON result from the service you wish to consume.</p>
<p>Lets just assume in the example that my service will return {&#8220;variable1&#8243;:1,&#8221;variable2&#8243;:&#8221;a return string&#8221;}</p>
<p>By definition this means one variable with an int and one with a string.</p>
<p>JSON2CSHARP will return a usable class for me to use in my code;</p>
<p>public class RootObject<br />
{<br />
    public int variable1 { get; set; }<br />
    public string variable2 { get; set; }<br />
}</p>
<p>Lets go ahead and add some more code to consume this now when we have a nice helper class to contain my result.</p>
<p>string url = &#8220;<a href="http://yourserver/service?someparams=somevalue">http://yourserver/service?someparams=somevalue</a>&#8220;;</p>
<p>HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(url);<br />
string username = &#8220;username&#8221;;<br />
string password = &#8220;********&#8221;;</p>
<p>// Use the CredentialCache so we can attach the authentication to the request<br />
CredentialCache mycache = new CredentialCache();</p>
<p>// We want to use Basic Authentication<br />
mycache.Add(new Uri(url), &#8220;Basic&#8221;, new NetworkCredential(username, password));<br />
wr.Credentials = mycache;<br />
wr.Headers.Add(&#8220;Authorization&#8221;, &#8220;Basic &#8221; + Convert.ToBase64String(new ASCIIEncoding().GetBytes(username + &#8220;:&#8221; + password)));</p>
<p>// Proxy (if you do not need it &#8211; ommit it)<br />
wr.Proxy = new WebProxy(<a href="http://proxyserver:8080">http://proxyserver:8080</a>);</p>
<p>// Get the response from the web service<br />
HttpWebResponse response = (HttpWebResponse)wr.GetResponse();<br />
Stream r_stream = response.GetResponseStream();</p>
<p>//convert it<br />
StreamReader response_stream = new StreamReader(r_stream, System.Text.Encoding.GetEncoding(&#8220;utf-8&#8243;));</p>
<p>string jSon = response_stream.ReadToEnd();</p>
<p>//clean up your stream<br />
response_stream.Close();</p>
<p>System.Web.Script.Serialization.JavaScriptSerializer jsSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();<br />
 RootObject result = jsSerializer.Deserialize&lt;RootObject&gt;(jSon);</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hansrasmussen.com/2012/02/consuming-a-json-service-with-csharp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CRM Authentication</title>
		<link>http://www.hansrasmussen.com/2010/02/crm-authentication/</link>
		<comments>http://www.hansrasmussen.com/2010/02/crm-authentication/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 23:47:49 +0000</pubDate>
		<dc:creator>Hans Rasmussen</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[CRM]]></category>
		<category><![CDATA[Webservice]]></category>

		<guid isPermaLink="false">http://www.hansrasmussen.com/2010/02/crm-authentication/</guid>
		<description><![CDATA[One good way of Authenticating against CRM Webservice is not tell CRM which internally defined system user account you wish to authenticate against. I found this good article from Microsoft about how to lookup the system user account based on the GUID that it receives in CRM after you have told CRM that you wish [...]]]></description>
			<content:encoded><![CDATA[<p>One good way of Authenticating against CRM Webservice is not tell CRM which internally defined system user account you wish to authenticate against. I found this good article from Microsoft about how to lookup the system user account based on the GUID that it receives in CRM after you have told CRM that you wish to create a user for this account.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/cc151052.aspx">http://msdn.microsoft.com/en-us/library/cc151052.aspx</a></p>
<p>//extract from the link above</p>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">using<span style="font-size: x-small;"> System;</span></span></span></div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"> </span></span></div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"></span></span></div>
<p><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"></p>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">using<span style="font-size: x-small;"> System.Web.Services.Protocols;</span></span></span></div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"> </span></span></div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"></span></span></div>
<p></span></span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"></p>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">using<span style="font-size: x-small;"> System.Text;</span></span></span></div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"> </span></span></div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"></span></span></div>
<p></span></span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"></p>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">using<span style="font-size: x-small;"> System.Net;</span></span></span></div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"> </span></span></div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"></span></span></div>
<p></span></span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"></p>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">using<span style="font-size: x-small;"> System.Xml;</span></span></span></div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">namespace</span></span><span style="font-size: x-small;"> Microsoft.Crm.Sdk.Reference</span></span></span></div>
<div><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"></span></span></div>
<p></span></span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"></p>
<div><span style="font-size: x-small;">{</span></div>
<div><span style="font-size: x-small;"><span style="color: #008000; font-size: x-small;"><span style="color: #008000; font-size: x-small;">// Microsoft Dynamics CRM namespaces</span></span></span></div>
<div><span style="font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">using</span></span><span style="font-size: x-small;"> CrmSdk;</span></span></div>
<p></span></span><span style="font-size: x-small;"></p>
<div><span style="font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">using</span></span></span></div>
<div><span style="font-size: x-small;"> </span></div>
<div><span style="font-size: x-small;"></span></div>
<p></span><span style="font-size: x-small;"></p>
<div><span style="font-size: x-small;">CrmSdk.Discovery;</span></div>
<div><span style="font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">public</span></span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">class</span></span><span style="font-size: x-small;"> </span><span style="color: #2b91af; font-size: x-small;"><span style="color: #2b91af; font-size: x-small;">Impersonation</span></span></span></div>
<div><span style="font-size: x-small;"> </span></div>
<div><span style="font-size: x-small;"> </span></div>
<p><span style="font-size: x-small;"> </p>
<p></span></p>
<div><span style="font-size: x-small;">{</span></div>
<div><span style="font-size: x-small;">[<span style="color: #2b91af; font-size: x-small;"><span style="color: #2b91af; font-size: x-small;">STAThread</span></span><span style="font-size: x-small;">]</span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">public</span></span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">static</span></span><span style="font-size: x-small;"> </span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">void</span></span><span style="font-size: x-small;"> Main(</span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">string</span></span><span style="font-size: x-small;">[] args)</span></span></div>
<div><span style="font-size: x-small;"></span></div>
<p></span><span style="font-size: x-small;"></p>
<div><span style="font-size: x-small;">{</span></div>
<div><span style="font-size: x-small;"><span style="color: #2b91af; font-size: x-small;"><span style="color: #2b91af; font-size: x-small;">CrmAuthenticationToken</span></span><span style="font-size: x-small;"> token = </span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">new</span></span><span style="font-size: x-small;"> </span><span style="color: #2b91af; font-size: x-small;"><span style="color: #2b91af; font-size: x-small;">CrmAuthenticationToken</span></span></span></div>
<div><span style="font-size: x-small;"></span></div>
<p></span><span style="font-size: x-small;"></p>
<div><span style="font-size: x-small;">();</span></div>
<div><span style="font-size: x-small;">token.AuthenticationType = 0; <span style="color: #008000; font-size: x-small;"><span style="color: #008000; font-size: x-small;">// Use Active Directory authentication.</span></span></span></div>
<div><span style="font-size: x-small;"><span style="font-size: x-small;">token.OrganizationName = </span><span style="color: #a31515; font-size: x-small;"><span style="color: #a31515; font-size: x-small;">&#8220;AdventureWorksCycle&#8221;</span></span><span style="font-size: x-small;">;</span></span></div>
<div><span style="font-size: x-small;"> </span></div>
<p><span style="font-size: x-small;"> </p>
<p></span></p>
<div><span style="font-size: x-small;"><span style="color: #008000; font-size: x-small;"><span style="color: #008000; font-size: x-small;">// Use the global user ID of the system user that is to be impersonated.</span></span></span></div>
<div><span style="font-size: x-small;"><span style="font-size: x-small;">token.CallerId = </span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">new</span></span><span style="font-size: x-small;"> </span><span style="color: #2b91af; font-size: x-small;"><span style="color: #2b91af; font-size: x-small;">Guid</span></span><span style="font-size: x-small;">(</span><span style="color: #a31515; font-size: x-small;"><span style="color: #a31515; font-size: x-small;">&#8220;94092D6F-B367-DC11-9C93-0003FFDFCE28&#8243;</span></span><span style="font-size: x-small;">);</span></span></div>
<div><span style="font-size: x-small;"></span></div>
<p></span><span style="font-size: x-small;"></p>
<div><span style="font-size: x-small;">CrmService crmService = <span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">new</span></span><span style="font-size: x-small;"> CrmService();crmService.Url = </span></span></div>
<div><span style="font-size: x-small;"><span style="color: #a31515; font-size: x-small;"><span style="color: #a31515; font-size: x-small;">&#8220;http://localhost/MSCRMServices/2007/CrmService.asmx&#8221;</span></span><span style="font-size: x-small;">;</span></span></div>
<div><span style="font-size: x-small;"></span></div>
<p></span><span style="font-size: x-small;"></p>
<div><span style="font-size: x-small;">crmService.CrmAuthenticationTokenValue = token;</span></div>
<div><span style="font-size: x-small;">crmService.Credentials = System.Net.<span style="color: #2b91af; font-size: x-small;"><span style="color: #2b91af; font-size: x-small;">CredentialCache</span></span><span style="font-size: x-small;">.DefaultCredentials;</span></span></div>
<div><span style="font-size: x-small;"></span></div>
<p></span><span style="font-size: x-small;"></p>
<div><span style="font-size: x-small;"><span style="color: #008000; font-size: x-small;"><span style="color: #008000; font-size: x-small;">// Create a new account owned by the impersonated user.</span></span></span></div>
<div><span style="font-size: x-small;"><span style="font-size: x-small;">account account = </span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">new</span></span><span style="font-size: x-small;"> account();</span></span></div>
<div><span style="font-size: x-small;"></span></div>
<p></span><span style="font-size: x-small;"></p>
<div><span style="font-size: x-small;">account.name = <span style="color: #a31515; font-size: x-small;"><span style="color: #a31515; font-size: x-small;">&#8220;Fabrikam&#8221;</span></span><span style="font-size: x-small;">;</span></span></div>
<div><span style="font-size: x-small;"><span style="color: #2b91af; font-size: x-small;"><span style="color: #2b91af; font-size: x-small;">Guid</span></span><span style="font-size: x-small;"> accountid = crmService.Create(account);</span></span></div>
<div><span style="font-size: x-small;"></span></div>
<p></span><span style="font-size: x-small;"></p>
<div><span style="font-size: x-small;">}</span></div>
<div><span style="font-size: x-small;">}</span></div>
<div><span style="font-size: x-small;">}</span></div>
<p></span><span style="font-size: x-small;">// my own code comes here</p>
<p></span></p>
<p>The other way is of course to authenticate youself by providing this information to CRM Web service.</p>
<div><span style="font-size: x-small;"><span style="color: #2b91af; font-size: x-small;"><span style="color: #2b91af; font-size: x-small;">CrmService</span></span><span style="font-size: x-small;"> service = </span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">null</span></span><span style="font-size: x-small;">;</span></span></div>
<div><span style="font-size: x-small;"> </span></div>
<div><span style="font-size: x-small;"></span></div>
<p><span style="font-size: x-small;"></p>
<div><span style="font-size: x-small;">service = <span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">new</span></span><span style="font-size: x-small;"> </span><span style="color: #2b91af; font-size: x-small;"><span style="color: #2b91af; font-size: x-small;">CrmService</span></span><span style="font-size: x-small;">();</span></span></div>
<div><span style="font-size: x-small;"> </span></div>
<div><span style="font-size: x-small;"></span></div>
<p></span><span style="font-size: x-small;"></p>
<div><span style="font-size: x-small;">service.Url = <span style="color: #a31515; font-size: x-small;"><span style="color: #a31515; font-size: x-small;">&#8220;http://crm/MSCrmServices/2007/CrmService.asmx&#8221;</span></span><span style="font-size: x-small;">;</span></span></div>
<div><span style="font-size: x-small;"> </span></div>
<div><span style="font-size: x-small;"></span></div>
<p></span><span style="font-size: x-small;"></p>
<div><span style="font-size: x-small;"><span style="color: #2b91af; font-size: x-small;"><span style="color: #2b91af; font-size: x-small;">CrmAuthenticationToken</span></span><span style="font-size: x-small;"> token = </span><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">new</span></span><span style="font-size: x-small;"> </span><span style="color: #2b91af; font-size: x-small;"><span style="color: #2b91af; font-size: x-small;">CrmAuthenticationToken</span></span><span style="font-size: x-small;">();</span></span></div>
<div><span style="font-size: x-small;"> </span></div>
<div><span style="font-size: x-small;"></span></div>
<p></span><span style="font-size: x-small;"></p>
<div><span style="font-size: x-small;">token.AuthenticationType = 0;</span></div>
<div><span style="font-size: x-small;">token.OrganizationName = <span style="color: #a31515; font-size: x-small;"><span style="color: #a31515; font-size: x-small;">&#8220;putyourorganizationnamehere&#8221;</span></span><span style="font-size: x-small;">;</span></span></div>
<div><span style="font-size: x-small;"></span></div>
<p></span><span style="font-size: x-small;"></p>
<div><span style="font-size: x-small;">System.Net.<span style="color: #2b91af; font-size: x-small;"><span style="color: #2b91af; font-size: x-small;">ICredentials</span></span><span style="font-size: x-small;"> myCredentials;myCredentials = </span></span></div>
<div><span style="font-size: x-small;"><span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">new</span></span><span style="font-size: x-small;"> </span><span style="color: #2b91af; font-size: x-small;"><span style="color: #2b91af; font-size: x-small;">NetworkCredential</span></span><span style="font-size: x-small;">(</span><span style="color: #a31515; font-size: x-small;"><span style="color: #a31515; font-size: x-small;">&#8220;useraccount&#8221;</span></span><span style="font-size: x-small;">, </span><span style="color: #a31515; font-size: x-small;"><span style="color: #a31515; font-size: x-small;">&#8220;password****&#8221;</span></span><span style="font-size: x-small;">, </span><span style="color: #a31515; font-size: x-small;"><span style="color: #a31515; font-size: x-small;">&#8220;domain&#8221;</span></span><span style="font-size: x-small;">);</span></span></div>
<div><span style="font-size: x-small;"></span></div>
<p></span><span style="font-size: x-small;"></p>
<div><span style="font-size: x-small;">service.Credentials = myCredentials;</span></div>
<div><span style="font-size: x-small;">service.PreAuthenticate = <span style="color: #0000ff; font-size: x-small;"><span style="color: #0000ff; font-size: x-small;">true</span></span><span style="font-size: x-small;">;</span></span></div>
<div><span style="font-size: x-small;"></span></div>
<p></span><span style="font-size: x-small;"></p>
<div><span style="font-size: x-small;">service.CrmAuthenticationTokenValue = token;</span></div>
<div><span style="font-size: x-small;">// do your stuff on service object (same as the above example)</span></div>
<div><span style="font-size: x-small;">// Create a new account owned by the impersonated user.</span></div>
<p></span><span style="font-size: x-small;">account account = new account();</p>
<p>account.name = &#8220;Fabrikam&#8221;;</p>
<p>Guid accountid = crmService.Create(account);</p>
<p></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hansrasmussen.com/2010/02/crm-authentication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebService Behaviour</title>
		<link>http://www.hansrasmussen.com/2010/02/webservice-behaviour/</link>
		<comments>http://www.hansrasmussen.com/2010/02/webservice-behaviour/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 23:24:46 +0000</pubDate>
		<dc:creator>Hans Rasmussen</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[Webservice]]></category>

		<guid isPermaLink="false">http://www.hansrasmussen.com/?p=28</guid>
		<description><![CDATA[WebService Behaviour enables you to interact with a webservice from within Internet Explorer. Instead of making a fancy example I like to forward a link to a working MS Example. http://msdn.microsoft.com/en-us/library/ms531033(VS.85).aspx Don&#8217;t forget that the webservice.htc file needs to be downloaded aswell.]]></description>
			<content:encoded><![CDATA[<p>WebService Behaviour enables you to interact with a webservice from within Internet Explorer. Instead of making a fancy example I like to forward a link to a working MS Example.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms531033(VS.85).aspx">http://msdn.microsoft.com/en-us/library/ms531033(VS.85).aspx</a></p>
<p>Don&#8217;t forget that the webservice.htc file needs to be downloaded aswell.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hansrasmussen.com/2010/02/webservice-behaviour/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Customize web service proxy generated objects</title>
		<link>http://www.hansrasmussen.com/2010/02/customize-web-service-proxy-generated-objects/</link>
		<comments>http://www.hansrasmussen.com/2010/02/customize-web-service-proxy-generated-objects/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 23:23:30 +0000</pubDate>
		<dc:creator>Hans Rasmussen</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Webservice]]></category>

		<guid isPermaLink="false">http://www.hansrasmussen.com/?p=26</guid>
		<description><![CDATA[Let&#8217;s say we create a web service method that returns a custom class that you are using throughout the webservice and you also consume the class of the same type in your application/web application. What you will find is that when a web service proxy is generated the class is substituted with a newly created [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say we create a web service method that returns a custom class that you are using throughout the webservice and you also consume the class of the same type in your application/web application.</p>
<p>What you will find is that when a web service proxy is generated the class is substituted with a newly created class that mimics the public properties of your class but it is really not the same class. This means you can not typecast between them.</p>
<p>Solution 1 would be to hijack the Reference.cs, make sure you are using the namespace where you class resides and finally remove the class specification from the file. The disadvantage is that each time a web reference is refreshed, these changes are lost.</p>
<p>Solution 2 would make sure that your changes are kept, because you can specifiy that certain classes should not be replaced by a new proxy version.</p>
<p><a href="http://www.microsoft.com/belux/msdn/nl/community/columns/jdruyts/wsproxy.mspx">http://www.microsoft.com/belux/msdn/nl/community/columns/jdruyts/wsproxy.mspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hansrasmussen.com/2010/02/customize-web-service-proxy-generated-objects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CRM Web reference vs CRM SDK</title>
		<link>http://www.hansrasmussen.com/2010/02/crm-web-reference-vs-crm-sdk/</link>
		<comments>http://www.hansrasmussen.com/2010/02/crm-web-reference-vs-crm-sdk/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 23:21:11 +0000</pubDate>
		<dc:creator>Hans Rasmussen</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[CRM]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Webservice]]></category>

		<guid isPermaLink="false">http://www.hansrasmussen.com/?p=24</guid>
		<description><![CDATA[While working in a project where we integrate with CRM, I noticed how important it is not to mix the ways you can integrate with. Either you create a reference to the CRM Web service in your Visual Studio project and the proxy classes are generated. Or you can reference microsoft.crm.sdk.dll and microsoft.crm.sdktypeproxy.dll that exists&#38;nbsp;in [...]]]></description>
			<content:encoded><![CDATA[<p>While working in a project where we integrate with CRM, I noticed how important it is not to mix the ways you can integrate with.</p>
<p>Either you create a reference to the CRM Web service in your Visual Studio project and the proxy classes are generated.</p>
<p>Or you can reference microsoft.crm.sdk.dll and microsoft.crm.sdktypeproxy.dll that exists&amp;nbsp;in the CRM SDK.</p>
<p>You will soon notice that if you create a Request object, or maybe a BusinessEntity, DynamicEntity they are not compatible with eachother, and furthermore they might not even have the same methods and properties.</p>
<p>My recommendation is to use the CRM SDK only and never create a Web reference from within Visual Studio. The CRM SDK objects have more friendly properties and methods.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hansrasmussen.com/2010/02/crm-web-reference-vs-crm-sdk/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

