<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>A Cup of Silverlight, RIA &amp; Interoperability : Cross Domain</title><link>http://blogs.msdn.com/silverlight_plus_java/archive/tags/Cross+Domain/default.aspx</link><description>Tags: Cross Domain</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>How-To : Silverlight accessing Java SOAP services (Part 1 – Cross Domain : IIS + Tomcat)</title><link>http://blogs.msdn.com/silverlight_plus_java/archive/2008/08/04/how-to-silverlight-accessing-java-soap-services-part-1-cross-domain-iis-tomcat.aspx</link><pubDate>Mon, 04 Aug 2008 18:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8831283</guid><dc:creator>Steve SFARTZ</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/silverlight_plus_java/comments/8831283.aspx</comments><wfw:commentRss>http://blogs.msdn.com/silverlight_plus_java/commentrss.aspx?PostID=8831283</wfw:commentRss><description>&lt;P mce_keep="true"&gt;The How-To series demo Silverlight accessing Web Services in various configuration. In this post, we will demonstrate a SOAP service consumed by a Silverlight client application. This scenario can be categorized as a &lt;A class="" href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/28/scenario-d2d-developer-env.aspx" mce_href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/28/scenario-d2d-developer-env.aspx"&gt;D2D scenario&lt;/A&gt; with a cross domain policy.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Both the Silverlight and SOAP service are available as an attachment to this post. Since Metro libraries are too large, you will need to copy all jar files from metro\lib\ folder into WebContent\WEB-INF\lib project folder. Steps are described below&lt;/EM&gt;.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Technical environment&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;SOAP services are built with JAX-WS and JAX-B APIs and hosted in Tomcat. &lt;/LI&gt;
&lt;LI&gt;The Silverlight application is hosted under the Visual Studio embedded Web Server code name “Catalina” (which delivers a subset of the IIS capabilities)&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_25.png"&gt;&lt;IMG title=image style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=417 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb.png" width=524 border=0&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Requirement &lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;For this How-To, we use the &lt;A href="https://metro.dev.java.net/discover/" target=_blank mce_href="https://metro.dev.java.net/discover/"&gt;Metro framework&lt;/A&gt; which contains both &lt;A href="https://jax-ws.dev.java.net/" target=_blank mce_href="https://jax-ws.dev.java.net/"&gt;JAX-WS&lt;/A&gt; and &lt;A href="https://jaxb.dev.java.net/introduction.html" target=_blank mce_href="https://jaxb.dev.java.net/introduction.html"&gt;JAX-B&lt;/A&gt; APIs which will be used to develop SOAP Services in JAVA. &lt;/P&gt;
&lt;P&gt;&lt;U&gt;Configuring Tomcat&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;Download the jar file from &lt;A title=https://metro.dev.java.net/1.2/ href="https://metro.dev.java.net/1.2/" target=_blank mce_href="https://metro.dev.java.net/1.2/"&gt;https://metro.dev.java.net/1.2/&lt;/A&gt; and launch it. A “metro” folder has been created at the jar location. metro\lib folder contains all the needed libraries for the Java SOAP service development and Tomcat configuration. Here is a good link that describes how to configure your Tomcat server &lt;A class="" href="http://blogs.sun.com/arungupta/entry/metro_on_tomcat_6_x" target=_blank mce_href="http://blogs.sun.com/arungupta/entry/metro_on_tomcat_6_x"&gt;http://blogs.sun.com/arungupta/entry/metro_on_tomcat_6_x&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Implementing the SOAP / RPC service&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;In Eclipse, create a new Dynamic Web Project called “&lt;STRONG&gt;&lt;EM&gt;SOAP-SumService&lt;/EM&gt;&lt;/STRONG&gt;” &lt;/LI&gt;
&lt;LI&gt;copy all jar files from metro\lib\ folder into WebContent\WEB-INF\lib project folder. &lt;/LI&gt;
&lt;LI&gt;Create a package called “service” and add a new Java class called “&lt;EM&gt;&lt;STRONG&gt;ServiceSumImpl&lt;/STRONG&gt;&lt;/EM&gt;” to this package. &lt;/LI&gt;
&lt;LI&gt;Add a xml file to WebContent\WEB-INF called “sun-jaxws.xml”.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Your project structure now looks like this :&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_6.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_6.png"&gt;&lt;IMG title=image style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=343 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_2.png" width=232 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_2.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;U&gt;Implementation of the Web Service endpoint&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;In ServiceSumImpl.java, import the following libraries :&lt;/P&gt;
&lt;DIV class=csharpcode&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_8.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_8.png"&gt;&lt;IMG title=image style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=37 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_3.png" width=266 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_3.png"&gt;&lt;/A&gt; &lt;/DIV&gt;
&lt;P&gt;Declare the class as a Web Service endpoint with the following annotations, for more informations about annotations refer to this &lt;A class="" href="http://edocs.bea.com/wls/docs91/webserv/annotations.html#1042436" target=_blank mce_href="http://edocs.bea.com/wls/docs91/webserv/annotations.html#1042436"&gt;site&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_10.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_10.png"&gt;&lt;IMG title=image style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=128 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_4.png" width=423 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_4.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;The only method that our service exposes is getSum. It returns the sum of two integers. But we want this method to be known over the service as “SumTwoInt”. Within the annotations we can configure all these parameters. &lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_12.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_12.png"&gt;&lt;IMG title=image style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=108 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_5.png" width=393 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_5.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Now build the project to generate the bytecode as the WSGen tool need it.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;U&gt;Generation of the required artifacts for the Web Service deployment and invocation&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;For this step, Metro provides a generation tool called “wsgen”.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Open a Windows Command Prompt : Start-&amp;gt;Run and type “cmd” &lt;/LI&gt;
&lt;LI&gt;set a METRO as a path variable to metro\bin folder (in our case it is C:\metro\bin path)&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_14.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_14.png"&gt;&lt;IMG title=image style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=54 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_6.png" width=240 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_6.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Go to your build project folder (by default in Eclipse: &lt;EM&gt;ProjectName\build\classes&lt;/EM&gt;). In our example it is the &lt;EM&gt;SOAP-SumService\build\classes&lt;/EM&gt; folder &lt;BR&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_16.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_16.png"&gt;&lt;IMG title=image style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=18 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_7.png" width=555 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_7.png"&gt;&lt;/A&gt;&amp;nbsp; &lt;BR&gt;&lt;BR&gt;Type the following command line to generates the artifacts in the project “src” folder. &lt;BR&gt;&lt;BR&gt;&lt;EM&gt;%METRO%\wsgen –cp . service.ServiceSumImpl –s ../../src&lt;/EM&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Refresh the Project Explorer and observes that two java files have been generated&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_18.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_18.png"&gt;&lt;IMG title=image height=286 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_8.png" width=340 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_8.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;They represent the message that will be shared in the Web Service process&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Configuring the Web Service Deployment&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;To configure the deployment, we need to instantiate a Servlet that will handles JAX-WS Web Services requests.&lt;/P&gt;
&lt;P&gt;In web.xml, add a Servlet element. We use a pre-existing Web Service Servlet :&lt;/P&gt;
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;servlet&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;servlet-name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;jaxservlet&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;servlet-name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;servlet-class&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;        com.sun.xml.ws.transport.http.servlet.WSServlet&lt;/PRE&gt;&lt;PRE class=alt&gt;    &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;servlet-class&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;load-on-startup&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;1&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;load-on-startup&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;servlet&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	MARGIN: 0em; WIDTH: 100%; BACKGROUND-COLOR: #f4f4f4
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;This servlet will handle every requests on /services/* URI, so let’s map to it with its name:&lt;/P&gt;
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;servlet-mapping&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;servlet-name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;jaxservlet&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;servlet-name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;url-pattern&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;/services/*&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;url-pattern&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;servlet-mapping&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	MARGIN: 0em; WIDTH: 100%; BACKGROUND-COLOR: #f4f4f4
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;To provide the right context, we need a listener (which also already exists):&lt;/P&gt;
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;listener&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;listener-class&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;        com.sun.xml.ws.transport.http.servlet.WSServletContextListener&lt;/PRE&gt;&lt;PRE&gt;    &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;listener-class&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;listener&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	MARGIN: 0em; WIDTH: 100%; BACKGROUND-COLOR: #f4f4f4
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;Finally, we need to expose the endpoint ServiceSumImpl within an URI, for example /services/sum. &lt;/P&gt;
&lt;P&gt;Edit the sun-jaxws.xml file and add the following elements :&lt;/P&gt;
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;&amp;lt;?&lt;/SPAN&gt;&lt;SPAN class=html&gt;xml&lt;/SPAN&gt; &lt;SPAN class=attr&gt;version&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="1.0"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;encoding&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="UTF-8"&lt;/SPAN&gt;?&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;endpoints&lt;/SPAN&gt; &lt;SPAN class=attr&gt;xmlns&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="http://java.sun.com/xml/ns/jax-ws/ri/runtime"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;version&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="2.0"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;endpoint&lt;/SPAN&gt; &lt;/PRE&gt;&lt;PRE&gt;        &lt;SPAN class=attr&gt;name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="sum"&lt;/SPAN&gt; &lt;/PRE&gt;&lt;PRE class=alt&gt;        &lt;SPAN class=attr&gt;implementation&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="service.ServiceSumImpl"&lt;/SPAN&gt; &lt;/PRE&gt;&lt;PRE&gt;        &lt;SPAN class=attr&gt;url-pattern&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="/services/sum"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;endpoints&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	MARGIN: 0em; WIDTH: 100%; BACKGROUND-COLOR: #f4f4f4
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;UL&gt;
&lt;LI&gt;Save all files, then Run the project on the Tomcat Server &lt;BR&gt;Right click on the project node : Run As –&amp;gt; Run on Server&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;The service is now hosted on Tomcat at &lt;A title=http://localhost:8080/SOAP-SumService/services/sum?wsdl href="http://localhost:8080/SOAP-SumService/services/sum?wsdl" mce_href="http://localhost:8080/SOAP-SumService/services/sum?wsdl"&gt;http://localhost:8080/SOAP-SumService/services/sum?wsdl&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_22.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_22.png"&gt;&lt;IMG title=image style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=267 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_10.png" width=378 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_10.png"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Enabling Cross Domain Access&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since the SOAP service and the Silverlight application reside on different hosts, we need to overpass the &lt;A href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/31/Cross-Domain-_3A00_-Trouble-while-accessing-Web-Services.aspx" mce_href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/31/Cross-Domain-_3A00_-Trouble-while-accessing-Web-Services.aspx"&gt;Cross Domain Issue&lt;/A&gt;. Create at the root of the SOAP service host, a clientaccesspolicy.xml file with the following content :&lt;/P&gt;
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;&amp;lt;?&lt;/SPAN&gt;&lt;SPAN class=html&gt;xml&lt;/SPAN&gt; &lt;SPAN class=attr&gt;version&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="1.0"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;encoding&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="UTF-8"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;standalone&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="no"&lt;/SPAN&gt;?&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;access-policy&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;cross-domain-access&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;        &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;policy&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;            &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;allow-from&lt;/SPAN&gt; &lt;SPAN class=attr&gt;http-request-headers&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="*"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;                &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;domain&lt;/SPAN&gt; &lt;SPAN class=attr&gt;uri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="*"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;            &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;allow-from&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;            &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;grant-to&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;                &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;resource&lt;/SPAN&gt; &lt;SPAN class=attr&gt;include-subpaths&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="true"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;path&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="/"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;            &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;grant-to&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;        &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;policy&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;    &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;cross-domain-access&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;access-policy&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	MARGIN: 0em; WIDTH: 100%; BACKGROUND-COLOR: #f4f4f4
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Consuming a SOAP service with Silverlight&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Now that the Web Service is exposed, we are going to generate the client proxy to consume the Web Service with Silverlight.&lt;/P&gt;
&lt;P&gt;Open Visual Studio 2008 and create a new Silverlight Project called SOAP-Sum and paste the following XAML code in Page.xaml to obtain a simple interface that will manipulate the web service.&lt;/P&gt;
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;UserControl&lt;/SPAN&gt; &lt;SPAN class=attr&gt;x:Class&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="SOAP_Sum.Page"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;    &lt;SPAN class=attr&gt;xmlns&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/SPAN&gt; &lt;/PRE&gt;&lt;PRE class=alt&gt;    &lt;SPAN class=attr&gt;xmlns:x&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;/SPAN&gt; &lt;/PRE&gt;&lt;PRE&gt;    &lt;SPAN class=attr&gt;Width&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="400"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Height&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="300"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;Canvas&lt;/SPAN&gt; &lt;SPAN class=attr&gt;x:Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="LayoutRoot"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Background&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="White"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;        &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;TextBox&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Text&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="0"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;x:Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="_int1"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Width&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="50"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Height&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="20"&lt;/SPAN&gt; &lt;/PRE&gt;&lt;PRE class=alt&gt;                          &lt;SPAN class=attr&gt;Canvas&lt;/SPAN&gt;.&lt;SPAN class=attr&gt;Top&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="10"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Canvas&lt;/SPAN&gt;.&lt;SPAN class=attr&gt;Left&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="30"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;TextChanged&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="_TextChanged"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;        &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;TextBlock&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Canvas&lt;/SPAN&gt;.&lt;SPAN class=attr&gt;Top&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="10"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Canvas&lt;/SPAN&gt;.&lt;SPAN class=attr&gt;Left&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="95"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Text&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="+"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;        &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;TextBox&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Text&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="0"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;x:Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="_int2"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Width&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="50"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Height&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="20"&lt;/SPAN&gt; &lt;/PRE&gt;&lt;PRE&gt;                          &lt;SPAN class=attr&gt;Canvas&lt;/SPAN&gt;.&lt;SPAN class=attr&gt;Top&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="10"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Canvas&lt;/SPAN&gt;.&lt;SPAN class=attr&gt;Left&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="120"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;TextChanged&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="_TextChanged"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;        &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;TextBlock&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Canvas&lt;/SPAN&gt;.&lt;SPAN class=attr&gt;Top&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="10"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Canvas&lt;/SPAN&gt;.&lt;SPAN class=attr&gt;Left&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="175"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Text&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="="&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;        &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;TextBlock&lt;/SPAN&gt; &lt;SPAN class=attr&gt;x:Name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="_result"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Canvas&lt;/SPAN&gt;.&lt;SPAN class=attr&gt;Top&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="10"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Canvas&lt;/SPAN&gt;.&lt;SPAN class=attr&gt;Left&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="190"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;Text&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;=""&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;    &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;Canvas&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;UserControl&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	MARGIN: 0em; WIDTH: 100%; BACKGROUND-COLOR: #f4f4f4
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;UL&gt;
&lt;LI&gt;Add a Service Reference &lt;BR&gt;Right click on References then chose Add a Service Reference&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_24.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_24.png"&gt;&lt;IMG title=image style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=67 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_11.png" width=240 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_11.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;In Address field, type the Sum service address then click Go (it should be &lt;A title=http://localhost:8080/SOAP-SumService/services/sum?wsdl href="http://localhost:8080/SOAP-SumService/services/sum?wsdl" mce_href="http://localhost:8080/SOAP-SumService/services/sum?wsdl"&gt;http://localhost:8080/SOAP-SumService/services/sum?wsdl&lt;/A&gt;). &lt;BR&gt;&lt;BR&gt;We actually have the Sum service named ServiceSum and one operation exposed as SumTwoInt, this is exactly what we did parameter in “Implementation of the Web Service endpoint” (see above)&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_28.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_28.png"&gt;&lt;IMG title=image style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=200 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_13.png" width=240 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_13.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;In Namespace field, type ServiceSum : this is how the service will be accessible through the Silverlight project. Click OK. In the Solution Explorer you see the ServiceSum reference in Service References.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_32.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_32.png"&gt;&lt;IMG title=image style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=34 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_15.png" width=149 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_E0EA/image_thumb_15.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;&lt;U&gt;Implementation of the client proxy&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;In Page.xaml.cs, add an import to SOAP-Sum.ServiceSum reference library.&lt;/P&gt;
&lt;DIV class=csharpcode&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   1:  &lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;using&lt;/SPAN&gt; SOAP_Sum.ServiceSum;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;Now we need to handle the TextChanged event in _TextChanged method :&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Instantiate a client proxy 
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;ServiceSumClient client = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; ServiceSumClient();&lt;/PRE&gt;&lt;/DIV&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	MARGIN: 0em; WIDTH: 100%; BACKGROUND-COLOR: #f4f4f4
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;
&lt;/LI&gt;
&lt;LI&gt;Add an event handler corresponding to the operation we are going to use so we can get the result 
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;client.SumTwoIntCompleted += &lt;/PRE&gt;&lt;PRE&gt;   &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; EventHandler&amp;lt;SumTwoIntCompletedEventArgs&amp;gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;      (&lt;/PRE&gt;&lt;PRE&gt;         client_SumTwoIntCompleted&lt;/PRE&gt;&lt;PRE class=alt&gt;      );&lt;/PRE&gt;&lt;/DIV&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	MARGIN: 0em; WIDTH: 100%; BACKGROUND-COLOR: #f4f4f4
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;
&lt;/LI&gt;
&lt;LI&gt;Use Async operation to send our two integers. &lt;BR&gt;Operations are made asynchronous so Silverlight UI won’t freeze 
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;client.SumTwoIntAsync(a,b);&lt;/PRE&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;The whole method looks like this :&lt;/P&gt;
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   1:  &lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; _TextChanged(&lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt; sender, TextChangedEventArgs e)&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   2:  &lt;/SPAN&gt;{&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   3:  &lt;/SPAN&gt;    &lt;SPAN class=rem&gt;// check if fields contain some text&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   4:  &lt;/SPAN&gt;    &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (_int1.Text == &lt;SPAN class=str&gt;""&lt;/SPAN&gt; || _int2.Text == &lt;SPAN class=str&gt;""&lt;/SPAN&gt;) &lt;SPAN class=kwrd&gt;return&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   5:  &lt;/SPAN&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   6:  &lt;/SPAN&gt;    &lt;SPAN class=kwrd&gt;int&lt;/SPAN&gt; a = &lt;SPAN class=kwrd&gt;int&lt;/SPAN&gt;.Parse(_int1.Text);&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   7:  &lt;/SPAN&gt;    &lt;SPAN class=kwrd&gt;int&lt;/SPAN&gt; b = &lt;SPAN class=kwrd&gt;int&lt;/SPAN&gt;.Parse(_int2.Text);&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   8:  &lt;/SPAN&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   9:  &lt;/SPAN&gt;    &lt;SPAN class=rem&gt;// generate a client proxy to the Web Service&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  10:  &lt;/SPAN&gt;    ServiceSumClient client = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; ServiceSumClient();&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  11:  &lt;/SPAN&gt;    client.SumTwoIntCompleted += &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; EventHandler&amp;lt;SumTwoIntCompletedEventArgs&amp;gt;(client_SumTwoIntCompleted);&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  12:  &lt;/SPAN&gt;    client.SumTwoIntAsync(a,b);&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  13:  &lt;/SPAN&gt;}&lt;/PRE&gt;&lt;/DIV&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	MARGIN: 0em; WIDTH: 100%; BACKGROUND-COLOR: #f4f4f4
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;Then we can process the result in the event handler&lt;/P&gt;
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; client_SumTwoIntCompleted(&lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt; sender, SumTwoIntCompletedEventArgs e)&lt;/PRE&gt;&lt;PRE&gt;{&lt;/PRE&gt;&lt;PRE class=alt&gt;    _result.Text = e.Result.ToString();&lt;/PRE&gt;&lt;PRE&gt;}&lt;/PRE&gt;&lt;/DIV&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	MARGIN: 0em; WIDTH: 100%; BACKGROUND-COLOR: #f4f4f4
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P mce_keep="true"&gt;Run the project and type some integers in the text boxes : Silverlight is consuming a JAX-WS SOAP service.&lt;/P&gt;
&lt;P&gt;- &lt;A class="" href="http://www.linkedin.com/in/ronnykwon" target=_blank mce_href="http://www.linkedin.com/in/ronnykwon"&gt;Ronny Kwon&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8831283" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/silverlight_plus_java/attachment/8831283.ashx" length="589450" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/SOAP_2F00_RPC/default.aspx">SOAP/RPC</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/Implementation/default.aspx">Implementation</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/How-to/default.aspx">How-to</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/Cross+Domain/default.aspx">Cross Domain</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/D2D/default.aspx">D2D</category></item><item><title>B2C scenario : Customer Environement</title><link>http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/31/b2c-scenario-customer-environment.aspx</link><pubDate>Thu, 31 Jul 2008 17:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8793404</guid><dc:creator>Steve SFARTZ</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/silverlight_plus_java/comments/8793404.aspx</comments><wfw:commentRss>http://blogs.msdn.com/silverlight_plus_java/commentrss.aspx?PostID=8793404</wfw:commentRss><description>&lt;P mce_keep="true"&gt;The B2C scenario corresponds to &lt;STRONG&gt;Web applications accessed by customers&lt;/STRONG&gt;, traditionnaly built with some dynamic HTML/AJAX technology running on the server side, that &lt;STRONG&gt;have been elected to leverage the Silverlight capabilities&lt;/STRONG&gt; (enriched user experience, vector based contents, scaling, rich media…).To comply with the scope of this blog, we’ll concentrate on RIA scenarios, where the customer accesses private data from a Silverlight Client.&lt;/P&gt;
&lt;P&gt;As listed in &lt;A href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/28/silverlight-scenarios-for-rich-internet-applications.aspx" mce_href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/28/silverlight-scenarios-for-rich-internet-applications.aspx"&gt;Silverlight scenarios for Rich Internet Applications&lt;/A&gt;, the following constraints apply to the Customer Environment scenario :&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Infrastructure security is mandatory : it includes &lt;STRONG&gt;a DMZ&lt;/STRONG&gt; to protect the Web Server and access to the Web Services &lt;STRONG&gt;and optional SSL/HTTPS communications &lt;/STRONG&gt;depending on the confidentiality of the data accessed. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Protocol adaptation is required if&lt;/STRONG&gt; the application is interfaced with pre-existing Web Services that cannot be immediatly consumed by Silverlight. This extract work is performed by a mediation layer, materialized in the schema below by the &lt;STRONG&gt;Services Gateway. Moreover&lt;/STRONG&gt;, the Services Gateway in the Customer scenario &lt;STRONG&gt;can enforce the alignement of the incoming messages&lt;/STRONG&gt; with the entreprise governance policies. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Authentication &amp;amp; authorization is required&lt;/STRONG&gt; for Line of Business Applications to secure read and write access to Entreprise Data. &lt;STRONG&gt;Form based&lt;/STRONG&gt; authentication would be the preferred way in this scenario. If you need Claim based authentication, take a look at the &lt;A href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/31/b2b-scenario-partner-env.aspx" mce_href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/31/b2b-scenario-partner-env.aspx"&gt;B2B&lt;/A&gt; scenario. &lt;/LI&gt;
&lt;LI&gt;A cross domain security file is required to access the Services Gateway&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/B2BscenarioPartnerEnv_A878/image_4.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/B2BscenarioPartnerEnv_A878/image_4.png"&gt;&lt;IMG title=image height=239 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/B2BscenarioPartnerEnv_A878/image_thumb_1.png" width=347 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/B2BscenarioPartnerEnv_A878/image_thumb_1.png"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/ScenarioD2DDeveloperEnv_E51C/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/ScenarioD2DDeveloperEnv_E51C/image_2.png"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;We plan to document this scenario by extending the “B2E with mediation” scenario, with Form Based Authentication &amp;amp; Authorization constraints. If you have technical requirements not list here, there’s good chance the B2C scenario can be enriched from the B2B scenario.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8793404" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/XML_2F00_REST/default.aspx">XML/REST</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/SOAP_2F00_RPC/default.aspx">SOAP/RPC</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/Architecture/default.aspx">Architecture</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/Interoperability/default.aspx">Interoperability</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/Cross+Domain/default.aspx">Cross Domain</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/B2C/default.aspx">B2C</category></item><item><title>Cross Domain : Trouble while accessing Web Services</title><link>http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/31/Cross-Domain-_3A00_-Trouble-while-accessing-Web-Services.aspx</link><pubDate>Thu, 31 Jul 2008 14:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8793229</guid><dc:creator>Steve SFARTZ</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/silverlight_plus_java/comments/8793229.aspx</comments><wfw:commentRss>http://blogs.msdn.com/silverlight_plus_java/commentrss.aspx?PostID=8793229</wfw:commentRss><description>&lt;P&gt;When Silverlight attempts to access a Web Service, if the SOO is different from the Web Service host, you have to deal with a cross domain issue. This issue can occur in various scenarios as described in &lt;A href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/28/silverlight-scenarios-for-rich-internet-applications.aspx" mce_href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/28/silverlight-scenarios-for-rich-internet-applications.aspx"&gt;Silverlight scenarios for Rich Internet Applications&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The issue can be treated as follow :&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1.&amp;nbsp; I am encountering a ProtocolException&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/Dealingwithcrossdomainissue_C41C/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/Dealingwithcrossdomainissue_C41C/image_2.png"&gt;&lt;IMG title=image style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=242 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/Dealingwithcrossdomainissue_C41C/image_thumb.png" width=430 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/Dealingwithcrossdomainissue_C41C/image_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;U&gt;Reason &lt;BR&gt;&lt;BR&gt;&lt;/U&gt;Silverlight is attempting to access a Web Service which is across its own domain boundaries. For security reasons, a policy file must exist at the root of the Web Service host. It allows this cross-domain access : it’s either clientaccesspolicy.xml or crossdomain.xml files which were not found by Silverlight. &lt;BR&gt;&lt;BR&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/Dealingwithcrossdomainissue_C41C/image_4.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/Dealingwithcrossdomainissue_C41C/image_4.png"&gt;&lt;IMG title=image style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=55 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/Dealingwithcrossdomainissue_C41C/image_thumb_1.png" width=552 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/Dealingwithcrossdomainissue_C41C/image_thumb_1.png"&gt;&lt;/A&gt;&amp;nbsp; &lt;BR&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;2.&amp;nbsp; Even if the clientaccesspolicy.xml is found, my Silverlight application access the service&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;U&gt;Reason&lt;/U&gt; &lt;BR&gt;&lt;BR&gt;Indeed, the clientaccesspolicy.xml file&amp;nbsp;is here but&amp;nbsp;is not accepted by the Silverlight application : there is some missing information.&amp;nbsp;&lt;BR&gt;&lt;BR&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/Dealingwithcrossdomainissue_C41C/image_8.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/Dealingwithcrossdomainissue_C41C/image_8.png"&gt;&lt;IMG title=image style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height=90 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/Dealingwithcrossdomainissue_C41C/image_thumb_3.png" width=556 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/Dealingwithcrossdomainissue_C41C/image_thumb_3.png"&gt;&lt;/A&gt; &lt;BR&gt;&lt;BR&gt;There has been some modifications since Silverlight 2 beta 2 : Ensure that ‘&lt;EM&gt;http-request-headers&lt;/EM&gt;’ attribute is correctly set in ‘&lt;EM&gt;allow-from&lt;/EM&gt;’ element in the clientaccesspolicy.xml file. See below for a basic and working policy file :&lt;/LI&gt;&lt;/UL&gt;
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;&amp;lt;?&lt;/SPAN&gt;&lt;SPAN class=html&gt;xml&lt;/SPAN&gt; &lt;SPAN class=attr&gt;version&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="1.0"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;encoding&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="UTF-8"&lt;/SPAN&gt;?&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;access-policy&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;cross-domain-access&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;        &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;policy&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;            &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;allow-from&lt;/SPAN&gt; &lt;SPAN class=attr&gt;http-request-headers&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="*"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;                &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;domain&lt;/SPAN&gt; &lt;SPAN class=attr&gt;uri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="*"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;            &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;allow-from&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;            &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;grant-to&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;                &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;resource&lt;/SPAN&gt; &lt;SPAN class=attr&gt;include-subpaths&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="true"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;path&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="/"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;            &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;grant-to&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;        &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;policy&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;    &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;cross-domain-access&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;access-policy&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	MARGIN: 0em; WIDTH: 100%; BACKGROUND-COLOR: #f4f4f4
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;More information can be found at &lt;/P&gt;
&lt;P&gt;&lt;A title=http://msdn.microsoft.com/en-us/library/cc197955(VS.95).aspx href="http://msdn.microsoft.com/en-us/library/cc197955(VS.95).aspx" mce_href="http://msdn.microsoft.com/en-us/library/cc197955(VS.95).aspx"&gt;http://msdn.microsoft.com/en-us/library/cc197955(VS.95).aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;- &lt;A class="" href="http://www.linkedin.com/in/ronnykwon" target=_blank mce_href="http://www.linkedin.com/in/ronnykwon"&gt;Ronny Kwon&lt;/A&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8793229" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/Cross+Domain/default.aspx">Cross Domain</category></item><item><title>B2B scenario : Partner Environment</title><link>http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/31/b2b-scenario-partner-env.aspx</link><pubDate>Thu, 31 Jul 2008 13:10:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8793123</guid><dc:creator>Steve SFARTZ</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/silverlight_plus_java/comments/8793123.aspx</comments><wfw:commentRss>http://blogs.msdn.com/silverlight_plus_java/commentrss.aspx?PostID=8793123</wfw:commentRss><description>&lt;P&gt;The B2B scenario corresponds to Enterprise Web Services exposed to a partner through a Rich Client application, traditionnaly built with some dynamic HTML/AJAX technology running on the server side, that &lt;STRONG&gt;have been elected to leverage the Silverlight capabilities&lt;/STRONG&gt; (enriched user experience, vector based contents, scaling, rich media…).&lt;/P&gt;
&lt;P&gt;As listed in &lt;A href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/28/silverlight-scenarios-for-rich-internet-applications.aspx" mce_href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/28/silverlight-scenarios-for-rich-internet-applications.aspx"&gt;Silverlight scenarios for Rich Internet Applications&lt;/A&gt;, the following constraints apply to the Partner Environment scenario :&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Infrastructure security is mandatory : it includes &lt;STRONG&gt;a DMZ&lt;/STRONG&gt; to protect the Web Server and access to the Web Services &lt;STRONG&gt;and SSL/HTTPS communications &lt;/STRONG&gt;to protect the confidential data owned by your enterprise and shared with your partner. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Protocol adaptation is required if&lt;/STRONG&gt; the application is interfaced with pre-existing Web Services that cannot be immediatly consumed by Silverlight. This extract work is performed by a mediation layer, materialized in the schema below by the &lt;STRONG&gt;Services Gateway. Moreover&lt;/STRONG&gt;, the Services Gateway in the Customer scenario &lt;STRONG&gt;can enforce the alignement of the incoming messages&lt;/STRONG&gt; with the entreprise governance policies. &lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Authentication &amp;amp; authorization is required&lt;/STRONG&gt; to secure read and write access to Entreprise Data. &lt;STRONG&gt;Claim based&lt;/STRONG&gt; authentication would be the preferred way in this scenario. If you want wish to use Form based authentication, have a look at the &lt;A href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/31/b2c-scenario-customer-environment.aspx" mce_href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/31/b2c-scenario-customer-environment.aspx"&gt;B2C&lt;/A&gt; scenario. &lt;/LI&gt;
&lt;LI&gt;A cross domain security file is required to access the Services Gateway if not host on the Site of Origin.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/B2BscenarioPartnerEnv_A878/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/B2BscenarioPartnerEnv_A878/image_2.png"&gt;&lt;IMG title=image style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=263 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/B2BscenarioPartnerEnv_A878/image_thumb.png" width=383 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/B2BscenarioPartnerEnv_A878/image_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/ScenarioD2DDeveloperEnv_E51C/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/ScenarioD2DDeveloperEnv_E51C/image_2.png"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;We plan to document this scenario by extending the “B2E with mediation” scenario with a Services Gateway (such as &lt;A href="http://www.codeplex.com/servicesengine" mce_href="http://www.codeplex.com/servicesengine"&gt;Managed Services Engine&lt;/A&gt;)&amp;nbsp; and SSL/HTTPS.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8793123" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/XML_2F00_REST/default.aspx">XML/REST</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/SOAP_2F00_RPC/default.aspx">SOAP/RPC</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/Architecture/default.aspx">Architecture</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/Interoperability/default.aspx">Interoperability</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/Cross+Domain/default.aspx">Cross Domain</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/B2B/default.aspx">B2B</category></item><item><title>B2E scenario : Intranet Environment</title><link>http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/31/b2e-scenario-intranet-environment.aspx</link><pubDate>Thu, 31 Jul 2008 12:10:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8793070</guid><dc:creator>Steve SFARTZ</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/silverlight_plus_java/comments/8793070.aspx</comments><wfw:commentRss>http://blogs.msdn.com/silverlight_plus_java/commentrss.aspx?PostID=8793070</wfw:commentRss><description>&lt;P&gt;The B2E scenario corresponds to &lt;STRONG&gt;internal Web applications&lt;/STRONG&gt;, traditionnaly built with some dynamic HTML/AJAX technology running on the server side, that &lt;STRONG&gt;have been elected to leverage the Silverlight capabilities&lt;/STRONG&gt; (enriched user experience, vector based contents, scaling, rich media…).&lt;/P&gt;
&lt;P&gt;As listed in &lt;A href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/28/silverlight-scenarios-for-rich-internet-applications.aspx" mce_href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/28/silverlight-scenarios-for-rich-internet-applications.aspx"&gt;Silverlight scenarios for Rich Internet Applications&lt;/A&gt;, the following constraints apply to the Intranet Environment scenario :&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Infrastructure security is optional as we are in a IT governed environment,&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Protocol adaptation is required if the application is interfaced with pre-existing Web Services&lt;/STRONG&gt; that cannot be immediatly consumed by Silverlight. This extract work is performed by a mediation layer, materialized in the schema below by the &lt;STRONG&gt;Services Gateway&lt;/STRONG&gt; .&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Authentication &amp;amp; authorization is required&lt;/STRONG&gt; for Line of Business Applications to secure read and write access to Entreprise Data. &lt;STRONG&gt;Windows integrated authentication&lt;/STRONG&gt; would be the preferred way for an intranet scenario. If you want wish to use Form or Claim based authentication, take a look at the &lt;A class="" href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/31/b2b-scenario-partner-env.aspx" mce_href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/31/b2b-scenario-partner-env.aspx"&gt;B2B&lt;/A&gt; and &lt;A class="" href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/31/b2c-scenario-customer-environment.aspx" mce_href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/31/b2c-scenario-customer-environment.aspx"&gt;B2C&lt;/A&gt; scenarios.&lt;/LI&gt;
&lt;LI&gt;A cross domain security file is needed&amp;nbsp;if the Services Gateway&amp;nbsp;is implemented or&amp;nbsp;if the Site Of Origin does not host the Web Services (as in interoperability scenarios where the Site of Origin and the Web Services rely on two different technologies).&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/B2EScenarioIntranetEnvironment_9397/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/B2EScenarioIntranetEnvironment_9397/image_2.png"&gt;&lt;IMG title=image style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=202 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/B2EScenarioIntranetEnvironment_9397/image_thumb.png" width=278 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/B2EScenarioIntranetEnvironment_9397/image_thumb.png"&gt;&lt;/A&gt; &lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/B2EScenarioIntranetEnvironment_9397/image_4.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/B2EScenarioIntranetEnvironment_9397/image_4.png"&gt;&lt;IMG title=image style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=203 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/B2EScenarioIntranetEnvironment_9397/image_thumb_1.png" width=283 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/B2EScenarioIntranetEnvironment_9397/image_thumb_1.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/ScenarioD2DDeveloperEnv_E51C/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/ScenarioD2DDeveloperEnv_E51C/image_2.png"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;We plan to experiment SOAP/RPC and XML/REST configuration in Full Windows, Full Java and Mixt environment. &lt;/P&gt;
&lt;P&gt;We’ll also demonstrate how Web Services invoked from Silverlight can leverage the Authentication &amp;amp; Authentication facilities provided by IIS/ASP.NET through interoperabiliy.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8793070" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/XML_2F00_REST/default.aspx">XML/REST</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/SOAP_2F00_RPC/default.aspx">SOAP/RPC</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/Architecture/default.aspx">Architecture</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/Interoperability/default.aspx">Interoperability</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/Cross+Domain/default.aspx">Cross Domain</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/B2E/default.aspx">B2E</category></item><item><title>How-To : Silverlight accessing Java REST services (Part 1 - Cross Domain : IIS + Tomcat)</title><link>http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/30/How_2D00_To-_3A00_-Silverlight-accessing-Java-REST-services-_2800_Part-1-_2D00_-Cross-Domain-_3A00_-IIS-_2B00_-Tomcat_2900_.aspx</link><pubDate>Wed, 30 Jul 2008 15:42:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8789161</guid><dc:creator>Steve SFARTZ</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/silverlight_plus_java/comments/8789161.aspx</comments><wfw:commentRss>http://blogs.msdn.com/silverlight_plus_java/commentrss.aspx?PostID=8789161</wfw:commentRss><description>&lt;P mce_keep="true"&gt;The &lt;A class="" href="http://www.linkedin.com/in/ronnykwon" target=_blank mce_href="http://www.linkedin.com/in/ronnykwon"&gt;HowTo&lt;/A&gt; serie demoes Silverlight accessing Web Services in various configurations. In this post, we will demonstrate a REST service consumed by HTTP GET and POST requests issued from a Silverlight client application. This scenario can be categorized as a &lt;A href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/28/scenario-d2d-developer-env.aspx" mce_href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/28/scenario-d2d-developer-env.aspx"&gt;D2D scenario&lt;/A&gt; with a cross domain policy. &lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;EM&gt;The Silverlight example described below is available as an attachment to this post.&lt;/EM&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Technical environment&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;REST services are built with Restlet and hosted in Tomcat&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;The Silverlight application is hosted under the Visual Studio embedded Web Server code name "Catalina" (which delivers a subset of the IIS capabilities)&lt;/DIV&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/MixJavaand.NETEnvironment_DFA6/image_2.png"&gt;&lt;IMG title=image style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=387 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/MixJavaand.NETEnvironment_DFA6/image_thumb.png" width=505 border=0&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Because the Site of Origin and the Web Services reside in different hosts, a Cross Domain policy is required at the Services host’s root (/clientaccesspolicy.xml"&amp;gt;http://&amp;lt;serviceshostname:port&amp;gt;/clientaccesspolicy.xml)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Implementation of the REST service&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;To get an overview of the Restlet framework, complete the tutorials : &lt;A class="" href="http://www.restlet.org/documentation/1.0/firstSteps" target=_blank mce_href="http://www.restlet.org/documentation/1.0/firstSteps "&gt;First Steps&lt;/A&gt; and &lt;A class="" href="http://www.restlet.org/documentation/1.0/firstResource" target=_blank mce_href="http://www.restlet.org/documentation/1.0/firstResource"&gt;First Resource&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Service development with Restlet can be summarized as follow : &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The Application class is the entry point to the Restlet service. It&amp;nbsp; binds a URI to a specific Resource. &lt;/LI&gt;
&lt;LI&gt;The Resource class describes how the service behaves on a specific URI invokation. &lt;/LI&gt;&lt;/UL&gt;
&lt;P mce_keep="true"&gt;After completing the tutorials above, deploy the firstResource service as a &lt;A class="" href="http://www.restlet.org/documentation/1.0/firstSteps#part03" target=_blank mce_href="http://www.restlet.org/documentation/1.0/firstSteps#part03"&gt;Servlet hosted by Tomcat&lt;/A&gt;.&lt;/P&gt;
&lt;P mce_keep="true"&gt;Invoke the Restlet service with the URI &lt;A href="http://localhost:8080/Restlet-servletfirstResource/items"&gt;http://localhost:8080/Restlet-servletfirstResource/items&lt;/A&gt;. Assuming that Tomcat is running on port 8080 and that your Restlet project name is Restlet-servletfirstResource, you get the following response :&lt;/P&gt;
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;  &lt;FONT color=#000000&gt;&lt;SPAN class=kwrd&gt;&amp;lt;?&lt;/SPAN&gt;&lt;SPAN class=html&gt;xml&lt;/SPAN&gt; &lt;SPAN class=attr&gt;version&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="1.0"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;encoding&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="UTF-8"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;standalone&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="no"&lt;/SPAN&gt; ?&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt; &lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;  &lt;FONT color=#000000&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;items&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;     &lt;FONT color=#000000&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;item&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;        &lt;FONT color=#000000&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;item1&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt; &lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;        &lt;FONT color=#000000&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;description&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;description of item1&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;description&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt; &lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE&gt;     &lt;FONT color=#000000&gt;&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;item&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;   &lt;FONT color=#000000&gt;&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;items&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Enabling Cross Domain Access&lt;/STRONG&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Since the REST service and the Silverlight application are hosted in different hosts, we need to overpass the &lt;A href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/31/Cross-Domain-_3A00_-Trouble-while-accessing-Web-Services.aspx" target=_blank&gt;Cross Domain Issue&lt;/A&gt;. Create at the root of the REST service host, a clientaccesspolicy.xml file with the following content :&lt;/P&gt;
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;&amp;lt;?&lt;/SPAN&gt;&lt;SPAN class=html&gt;xml&lt;/SPAN&gt; &lt;SPAN class=attr&gt;version&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="1.0"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;encoding&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="UTF-8"&lt;/SPAN&gt;?&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;access-policy&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;    &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;cross-domain-access&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;        &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;policy&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;            &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;allow-from&lt;/SPAN&gt; &lt;SPAN class=attr&gt;http-request-headers&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="*"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;                &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;domain&lt;/SPAN&gt; &lt;SPAN class=attr&gt;uri&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="*"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;            &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;allow-from&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;            &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;grant-to&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;                &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;resource&lt;/SPAN&gt; &lt;SPAN class=attr&gt;include-subpaths&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="true"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;path&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="/"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;            &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;grant-to&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;        &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;policy&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;    &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;cross-domain-access&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;access-policy&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	MARGIN: 0em; WIDTH: 100%; BACKGROUND-COLOR: #f4f4f4
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;STRONG&gt;Consuming a REST service with Silverlight (GET method)&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We chose the WebClient API to request the REST service, and LINQ to process the XML response. &lt;A class="" href="http://msdn.microsoft.com/en-us/library/cc188996(VS.95).aspx" target=_blank mce_href="http://msdn.microsoft.com/en-us/library/cc188996(VS.95).aspx"&gt;XmlReader&lt;/A&gt; is another parsing option, and &lt;A class="" href="http://www.linkedin.com/in/ronnykwon" target=_blank mce_href="http://www.linkedin.com/in/ronnykwon"&gt;Serialization&lt;/A&gt; (Xml or DataContract) is another one.&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Invocation of the REST service&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;First of all, in your UserControl, declare a MyItem class that will map the XML response elements.&lt;/P&gt;
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   1:  &lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;class&lt;/SPAN&gt; MyItem&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   2:  &lt;/SPAN&gt;{&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   3:  &lt;/SPAN&gt;    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; myName { get; set; }&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   4:  &lt;/SPAN&gt;    &lt;SPAN class=kwrd&gt;public&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt; myDescription { get; set; }&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   5:  &lt;/SPAN&gt;}&lt;/PRE&gt;&lt;/DIV&gt;
&lt;DIV class=csharpcode&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	MARGIN: 0em; WIDTH: 100%; BACKGROUND-COLOR: #f4f4f4
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   1:  &lt;/SPAN&gt;&lt;SPAN class=rem&gt;// List of Items&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   2:  &lt;/SPAN&gt;IEnumerable&amp;lt;MyItem&amp;gt; Items = &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	MARGIN: 0em; WIDTH: 100%; BACKGROUND-COLOR: #f4f4f4
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;Now, let's send a HTTP GET method request to /items URI so we can retrieve every items&lt;/P&gt;
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   1:  &lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; getAction()&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   2:  &lt;/SPAN&gt;{&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   3:  &lt;/SPAN&gt;    WebClient webclient = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; WebClient();&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   4:  &lt;/SPAN&gt;    webclient.DownloadStringCompleted += &lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   5:  &lt;/SPAN&gt;      &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; DownloadStringCompletedEventHandler(client_DownloadStringCompleted);&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   6:  &lt;/SPAN&gt;    webclient.DownloadStringAsync(&lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Uri(&lt;SPAN class=str&gt;"http://localhost:8080/Restlet-servletfirstResource/items"&lt;/SPAN&gt;));&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   7:  &lt;/SPAN&gt;}&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&lt;U&gt;Processing the XML results&lt;/U&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;Let’s process the results using LINQ support for XML :&lt;/P&gt;
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   1:  &lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; client_DownloadStringCompleted(&lt;SPAN class=kwrd&gt;object&lt;/SPAN&gt; sender, DownloadStringCompletedEventArgs e)&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   2:  &lt;/SPAN&gt;{&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   3:  &lt;/SPAN&gt;    &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (e.Error == &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   4:  &lt;/SPAN&gt;    {&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   5:  &lt;/SPAN&gt;        XDocument xmlItems = XDocument.Parse(e.Result);&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   6:  &lt;/SPAN&gt;        &lt;SPAN class=rem&gt;// use LINQ to XML to parse the response&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   7:  &lt;/SPAN&gt;        Items = from child &lt;SPAN class=kwrd&gt;in&lt;/SPAN&gt; xmlItems.Element(&lt;SPAN class=str&gt;"items"&lt;/SPAN&gt;).Descendants().ToList()&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   8:  &lt;/SPAN&gt;                &lt;SPAN class=rem&gt;// restrict the selection to item children&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   9:  &lt;/SPAN&gt;                &lt;SPAN class=kwrd&gt;where&lt;/SPAN&gt; child.Name.LocalName==&lt;SPAN class=str&gt;"item"&lt;/SPAN&gt;    &lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  10:  &lt;/SPAN&gt;                select &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; MyItem&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  11:  &lt;/SPAN&gt;                    {&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  12:  &lt;/SPAN&gt;                        myName = (&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;)child.Element(&lt;SPAN class=str&gt;"name"&lt;/SPAN&gt;),&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  13:  &lt;/SPAN&gt;                        myDescription = (&lt;SPAN class=kwrd&gt;string&lt;/SPAN&gt;) child.Element(&lt;SPAN class=str&gt;"description"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  14:  &lt;/SPAN&gt;                    };&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;  15:  &lt;/SPAN&gt;    } &lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  16:  &lt;/SPAN&gt;}&lt;/PRE&gt;&lt;/DIV&gt;
&lt;STYLE type=text/css&gt;.csharpcode {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	MARGIN: 0em; WIDTH: 100%; BACKGROUND-COLOR: #f4f4f4
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;STYLE type=text/css&gt;.csharpcode {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	FONT-SIZE: small; COLOR: black; FONT-FAMILY: consolas, "Courier New", courier, monospace; BACKGROUND-COLOR: #ffffff
}
.csharpcode PRE {
	MARGIN: 0em
}
.csharpcode .rem {
	COLOR: #008000
}
.csharpcode .kwrd {
	COLOR: #0000ff
}
.csharpcode .str {
	COLOR: #006080
}
.csharpcode .op {
	COLOR: #0000c0
}
.csharpcode .preproc {
	COLOR: #cc6633
}
.csharpcode .asp {
	BACKGROUND-COLOR: #ffff00
}
.csharpcode .html {
	COLOR: #800000
}
.csharpcode .attr {
	COLOR: #ff0000
}
.csharpcode .alt {
	MARGIN: 0em; WIDTH: 100%; BACKGROUND-COLOR: #f4f4f4
}
.csharpcode .lnum {
	COLOR: #606060
}
&lt;/STYLE&gt;

&lt;P&gt;&lt;STRONG&gt;Sending Data to a REST service with Silverlight&amp;nbsp; (POST method)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Use the WebClient to send a HTTP POST request to the /items URI, by adding two parameters : name = "Foo"&amp;nbsp; and description = "Bar" :&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   1:  &lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; postWebClient()&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   2:  &lt;/SPAN&gt;{&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   3:  &lt;/SPAN&gt;    WebClient webclient = &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; WebClient();&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   4:  &lt;/SPAN&gt;    webclient.UploadStringAsync(&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   7:  &lt;/SPAN&gt;      &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Uri(&lt;SPAN class=str&gt;"http://localhost:8080/Restlet-servletfirstResource/items"&lt;/SPAN&gt;),&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;   8:  &lt;/SPAN&gt;      &lt;SPAN class=str&gt;"name=Foo&amp;amp;description=Bar"&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;&lt;SPAN class=lnum&gt;   9:  &lt;/SPAN&gt;    );&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN class=lnum&gt;  10:  &lt;/SPAN&gt;}&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Warning : Notice that if you try to hit the same URI several time with the HTTP GET method, the results do not get refreshed but remain the same. Further explanations about this &lt;/EM&gt;&lt;A class="" href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/30/Limitations-when-accessing-REST-services-from-Silverlight.aspx#CacheIssue" mce_href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/30/Limitations-when-accessing-REST-services-from-Silverlight.aspx#CacheIssue"&gt;&lt;EM&gt;caching issue&lt;/EM&gt;&lt;/A&gt;&lt;EM&gt; are available here.&lt;/EM&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- &lt;A class="" href="http://www.linkedin.com/in/ronnykwon" target=_blank mce_href="http://www.linkedin.com/in/ronnykwon"&gt;Ronny Kwon&lt;/A&gt; &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8789161" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/silverlight_plus_java/attachment/8789161.ashx" length="822159" type="application/x-zip-compressed" /><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/XML_2F00_REST/default.aspx">XML/REST</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/Implementation/default.aspx">Implementation</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/How-to/default.aspx">How-to</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/Cross+Domain/default.aspx">Cross Domain</category><category domain="http://blogs.msdn.com/silverlight_plus_java/archive/tags/D2D/default.aspx">D2D</category></item></channel></rss>