Showing posts with label Development. Show all posts
Showing posts with label Development. Show all posts

Wednesday, August 05, 2009

Thursday, July 02, 2009

Silverlight 2.0 – Silverlight Apps calling asmx web services

A while back I worked on a Silverlight application that was hosted in SharePoint. The Silverlight application was to call a web service written by a third party vendor in .NET 2.0.

Problem
As what we all normally would do in a Silverlight app is to call this web service. However, I got the following error when my application tries to call the asmx web service:

“An error occurred while trying to make a request to URI 'http://localhost:1000/webservice.asmx'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. Please see the inner exception for more details.”

SLAccessError

Solution

After some research, I found a recipe to get it going again:

  1. Create a new file within the web service application (at the root of the requesting domain), called clientaccesspolicy.xml with the following contents:


    <?xml version="1.0" encoding="utf-8"?>
    <access-policy>
    <cross-domain-access>
    <policy>
    <allow-from http-request-headers="*">
    <domain uri="*"/>
    </allow-from>
    <grant-to>
    <resource path="/" include-subpaths="true"/>
    </grant-to>
    </policy>
    </cross-domain-access>
    </access-policy>



  2. Create another file within the web service application(at the root of the requesting domain), called crossdomain.xml with the following contents:

    <?xml version="1.0" encoding="utf-8"?>
    <cross-domain-access>
    <allow-http-request-headers-from domain="*" headers="*"/>
    </cross-domain-access>

After adding these policy files, my app started working. Hope this helps.

References

http://timheuer.com/blog/archive/2008/04/06/silverlight-cross-domain-policy-file-snippet-intellisense.aspx

http://timheuer.com/blog/archive/2008/06/10/silverlight-services-cross-domain-404-not-found.aspx

Tuesday, June 23, 2009

Windows Presentation Foundation 4 in VS 2010

I don't usually blog about things other than SharePoint or CRM... but this is just really cool – not new as we’ve all seen this on the surface, but new as it can work on Windows 7! In the video, the speaker has used a Codeplex project “MultiTouchVista” (http://www.codeplex.com/MultiTouchVista) in conjunction with a “Windows 7 Multi-touch driver” to enable user input for multi-touching on normal mice.

Having asking Google more… there’s apparently much Developer resources on multi-touch: http://code.msdn.microsoft.com/WindowsTouch

Now… I wonder if anybody out there has written a track pad multi-touch driver? I don’t want to plug-in more than 2 mice into my Dell XPS!

Friday, July 18, 2008

Microsoft SharePoint 2007 - WSS and MOSS VPCs

I just discovered Microsoft provides VPC's for SharePoint evaluation. If you are a little lazy and don't already have a VPC, these maybe a good starting point:

Microsoft Office SharePoint Server 2007 VHD (24 July 2007):
http://www.microsoft.com/downloads/details.aspx?FamilyID=67f93dcb-ada8-4db5-a47b-df17e14b2c74&DisplayLang=en


Windows SharePoint Services 3.0 SP1 Developer Evaluation VPC Image (3 July 2008):
http://www.microsoft.com/Downloads/details.aspx?familyid=1BEEAC6F-2EA1-4769-9948-74A74BD604FA&displaylang=en

Tuesday, July 01, 2008

Microsoft SharePoint 2007 and Microsoft CRM 4.0 - Custom Field Types for MS CRM 4.0

I came across a great article by Karine Bosch and Patrick Tisseghem about creating custom field types in SharePoint that exposes CRM 4.0 data via BDC. The first article includes a link to download the sample.

Here are the links:
Overview - http://www.u2u.info/Blogs/Patrick/Lists/Posts/Post.aspx?ID=1789
Detailed How To - http://www.u2u.be/Res/Article.aspx?ART=CRMSharePointCustomField

The highlight here is the ability for the user to search for a CRM record (whilst checking details on the record) to attach to a SharePoint list item.

Microsoft SharePoint 2007 - Sample Event Handler to set Permissions

I recently had to dig up something I learnt in the past so, here it is - a good example posted by Ishai Sagi to show a great example for:
  • Getting a list item in the event handler
  • Impersonating another user totally (without using RunWithElevatedPrivilages)
  • Changing permissions for an item
  • Creating a new permission role in a web site
  • Checking if a role exists or not

http://www.sharepoint-tips.com/2007/03/sample-event-handler-to-set-permissions.html

Sunday, May 11, 2008

Microsoft Visual Studio - Web development quickie tip: Quick GAC deployment

I've been across this one so many times before, so I'm adding this entry to remind myself how to automatically deploy compiled libraries to the GAC and recycle the application pool after a successful compilation in Visual Studio 2005/2008:

Add this on the post build events of the Class Library project for quick GAC deployment
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil" -i "$(TargetPath)" | C:\Recycle.vbs

Then create a VB Script file using Notepad in location
C:\Recycle.vbs:
strAppPoolName = "DefaultAppPool"
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:{authenticationLevel=pktPrivacy}\\" _
& strComputer & "\root\microsoftiisv2")

Set colItems = objWMIService.ExecQuery _
("Select * From IIsApplicationPool Where Name = " & _
"'W3SVC/AppPools/" &strAppPoolName & "'")

For Each objItem in colItems
objItem.Recycle
Next

Wscript.echo "Recycle Completed"

Change the value of the variable "strAppPoolName" to the name of the application pool that needs recycling.