<?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 : How-to</title><link>http://blogs.msdn.com/silverlight_plus_java/archive/tags/How-to/default.aspx</link><description>Tags: How-to</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 2 – No Cross Domain : Tomcat/Eclipse)</title><link>http://blogs.msdn.com/silverlight_plus_java/archive/2008/08/14/how-to-silverlight-accessing-java-soap-services-part-2-no-cross-domain-tomcat-eclipse.aspx</link><pubDate>Thu, 14 Aug 2008 16:52:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8903377</guid><dc:creator>Steve SFARTZ</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/silverlight_plus_java/comments/8903377.aspx</comments><wfw:commentRss>http://blogs.msdn.com/silverlight_plus_java/commentrss.aspx?PostID=8903377</wfw:commentRss><description>&lt;P mce_keep="true"&gt;The &lt;A href="http://blogs.msdn.com/silverlight_plus_java/archive/tags/How-to/default.aspx" mce_href="http://blogs.msdn.com/silverlight_plus_java/archive/tags/How-to/default.aspx"&gt;HowTo&lt;/A&gt; series demo Silverlight accessing Web Services in various configuration. In this post, we will demonstrate you a SOAP service consumed by a Silverlight client application where the Site of Origin hosts the Web Services. This scenario is 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; &lt;STRONG&gt;without cross-domain policy&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;The SOAP service Eclipse project and the Silverlight Eclipse project are available as an attachment to this post.&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 the JAX-WS and JAX-B Api and hosted in Tomcat&lt;/LI&gt;
&lt;LI&gt;The Silverlight application is also hosted in Tomcat&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_DF27/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_DF27/image_2.png"&gt;&lt;IMG title=image style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=378 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_DF27/image_thumb.png" width=480 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_DF27/image_thumb.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Because the Site of Origin and the Web Service reside in the same host, no Cross Domain policy is required.&lt;/P&gt;
&lt;H4&gt;Hosting the Web Service in Tomcat&lt;/H4&gt;
&lt;P&gt;In case you haven’t done the &lt;A href="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" mce_href="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"&gt;How-To : Silverlight accessing Java SOAP services (Part 1 – Cross Domain : IIS + Tomcat)&lt;/A&gt;, you can directly import the SOAP-Sum service Eclipse project into your Eclipse Workspace.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Export it as a WAR in %TOMCAT_INSTALL%/webapps folder&lt;/LI&gt;
&lt;LI&gt;go to &lt;A href="http://localhost:8080/SOAP-SumService/services/sum" mce_href="http://localhost:8080/SOAP-SumService/services/sum"&gt;http://localhost:8080/SOAP-SumService/services/sum&lt;/A&gt; (assuming that Tomcat is running on port 8080) to access the service.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_DF27/image_4.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_DF27/image_4.png"&gt;&lt;IMG title=image style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=215 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_DF27/image_thumb_1.png" width=325 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_DF27/image_thumb_1.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;H4&gt;Hosting the Silverlight Application using a Servlet&lt;/H4&gt;
&lt;P&gt;In the &lt;A href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/08/06/how_2D00_to-silverlight-accessing-java-rest-services-part-2-no-cross-domain-tomcat.aspx" mce_href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/08/06/how_2D00_to-silverlight-accessing-java-rest-services-part-2-no-cross-domain-tomcat.aspx"&gt;REST way&lt;/A&gt;, we showed you how to host a Silverlight Application using a JSP. Now we are going to host a Silverlight application using a Servlet&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;In Eclipse, create a new dynamic web project named &lt;STRONG&gt;Silverlight-SOAP-SumService_NOSSL&lt;/STRONG&gt;&lt;/LI&gt;
&lt;LI&gt;In &lt;STRONG&gt;WebContent&lt;/STRONG&gt; folder, add a folder named &lt;STRONG&gt;ClientBin&lt;/STRONG&gt; and copy in the latter, the xap file in the attachment. The Silverlight Application is already configured to access the SOAP service at &lt;A 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;/LI&gt;
&lt;LI&gt;Add a Servlet named SilverlightServlet to a package ‘&lt;STRONG&gt;servlet&lt;/STRONG&gt;’ and add the following code :&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Instance of Silverlight plugin :&lt;/P&gt;
&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;private&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; responseHandler(HttpServletResponse response) throws IOException{&lt;/PRE&gt;&lt;PRE&gt;    PrintWriter pw = response.getWriter();&lt;/PRE&gt;&lt;PRE class=alt&gt;    pw.println(&lt;SPAN class=str&gt;""&lt;/SPAN&gt; +&lt;/PRE&gt;&lt;PRE&gt;            &lt;SPAN class=str&gt;"&amp;lt;div id=\"silverlightControlHost\"&amp;gt;"&lt;/SPAN&gt; +&lt;/PRE&gt;&lt;PRE class=alt&gt;            &lt;SPAN class=str&gt;"    &amp;lt;object data=\"data:application/x-silverlight,\""&lt;/SPAN&gt; +&lt;/PRE&gt;&lt;PRE&gt;            &lt;SPAN class=str&gt;"             type=\"application/x-silverlight-2-b2\""&lt;/SPAN&gt; +&lt;/PRE&gt;&lt;PRE class=alt&gt;            &lt;SPAN class=str&gt;"             width=\"100%\" height=\"100%\"&amp;gt;"&lt;/SPAN&gt; +&lt;/PRE&gt;&lt;PRE&gt;            &lt;SPAN class=str&gt;"       &amp;lt;param name=\"source\" value=\"ClientBin/SOAP-Sum.xap\"/&amp;gt;"&lt;/SPAN&gt; +&lt;/PRE&gt;&lt;PRE class=alt&gt;            &lt;SPAN class=str&gt;"       &amp;lt;param name=\"background\" value=\"white\" /&amp;gt;"&lt;/SPAN&gt; +&lt;/PRE&gt;&lt;PRE&gt;            &lt;SPAN class=str&gt;"       &amp;lt;a href=\"http://go.microsoft.com/fwlink/?LinkID=115261\""&lt;/SPAN&gt; +&lt;/PRE&gt;&lt;PRE class=alt&gt;            &lt;SPAN class=str&gt;"          style=\'text-decoration: none;\'&amp;gt;'&lt;/SPAN&gt; +&lt;/PRE&gt;&lt;PRE&gt;            &lt;SPAN class=str&gt;"         &amp;lt;img src=\"http://go.microsoft.com/fwlink/?LinkId=108181\""&lt;/SPAN&gt;+&lt;/PRE&gt;&lt;PRE class=alt&gt;            &lt;SPAN class=str&gt;"              alt=\"Get Microsoft Silverlight\""&lt;/SPAN&gt; +&lt;/PRE&gt;&lt;PRE&gt;            &lt;SPAN class=str&gt;"              style=\'border-style: none\'/&amp;gt;'&lt;/SPAN&gt; +&lt;/PRE&gt;&lt;PRE class=alt&gt;            &lt;SPAN class=str&gt;"        &amp;lt;/a&amp;gt;"&lt;/SPAN&gt; +&lt;/PRE&gt;&lt;PRE&gt;            &lt;SPAN class=str&gt;"    &amp;lt;/object&amp;gt;"&lt;/SPAN&gt; +&lt;/PRE&gt;&lt;PRE class=alt&gt;            &lt;SPAN class=str&gt;"    &amp;lt;iframe style='visibility:hidden;height:0;width:0;border:0px'&amp;gt;'&lt;/SPAN&gt; +&lt;/PRE&gt;&lt;PRE&gt;            &lt;SPAN class=str&gt;"&amp;lt;/iframe&amp;gt;"&lt;/SPAN&gt; +&lt;/PRE&gt;&lt;PRE class=alt&gt;            &lt;SPAN class=str&gt;"&amp;lt;/div&amp;gt;"&lt;/SPAN&gt;);&lt;/PRE&gt;&lt;PRE&gt;    pw.close();&lt;/PRE&gt;&lt;PRE class=alt&gt;}&lt;/PRE&gt;&lt;/DIV&gt;
&lt;STYLE type=text/css&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.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 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;

&lt;DIV class=csharpcode&gt;&lt;PRE class=alt&gt;&lt;SPAN class=kwrd&gt;protected&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;void&lt;/SPAN&gt; doGet(HttpServletRequest request, HttpServletResponse response)&lt;/PRE&gt;&lt;PRE&gt;  throws ServletException, IOException {&lt;/PRE&gt;&lt;PRE class=alt&gt;    responseHandler(response);&lt;/PRE&gt;&lt;PRE&gt;    super.doGet(request, response);&lt;/PRE&gt;&lt;PRE class=alt&gt;}&lt;/PRE&gt;&lt;/DIV&gt;
&lt;STYLE type=text/css&gt;
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.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 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }&lt;/STYLE&gt;

&lt;UL&gt;
&lt;LI&gt;
&lt;DIV mce_keep="true"&gt;Export the project as a WAR file in %TOMCAT_INSTALL%/webapps folder.&lt;/DIV&gt;&lt;/LI&gt;
&lt;LI&gt;Go to &lt;A title=http://localhost:8080/Silverlight-SOAP-SumService_NOSSL/SilverlightServlet href="http://localhost:8080/Silverlight-SOAP-SumService_NOSSL/SilverlightServlet" mce_href="http://localhost:8080/Silverlight-SOAP-SumService_NOSSL/SilverlightServlet"&gt;http://localhost:8080/Silverlight-SOAP-SumService_NOSSL/SilverlightServlet&lt;/A&gt; (because In the web.xml file located in WebContent/WEB-INF directory, the servlet is configured to handle every requests made on /SilverlightServlet/*)&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;Silverlight will access the SOAP-Sum service without cross-domain&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_DF27/image_6.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_DF27/image_6.png"&gt;&lt;IMG title=image style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=304 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_DF27/image_thumb_2.png" width=459 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaSOAPservice_DF27/image_thumb_2.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P mce_keep="true"&gt;- &lt;A 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=8903377" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/silverlight_plus_java/attachment/8903377.ashx" length="25967" 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/D2D/default.aspx">D2D</category></item><item><title>How-To : Silverlight accessing Java REST services (Part 2 – No Cross Domain : Tomcat/Eclipse)</title><link>http://blogs.msdn.com/silverlight_plus_java/archive/2008/08/06/how_2D00_to-silverlight-accessing-java-rest-services-part-2-no-cross-domain-tomcat.aspx</link><pubDate>Wed, 06 Aug 2008 11:43:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8791751</guid><dc:creator>Steve SFARTZ</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/silverlight_plus_java/comments/8791751.aspx</comments><wfw:commentRss>http://blogs.msdn.com/silverlight_plus_java/commentrss.aspx?PostID=8791751</wfw:commentRss><description>&lt;P mce_keep="true"&gt;The &lt;A href="http://blogs.msdn.com/silverlight_plus_java/archive/tags/How-to/default.aspx"&gt;HowTo&lt;/A&gt; serie demoes Silverlight accessing Web Services in various configuration. In this post, we will demonstrate a REST service consumed by a Silverlight client application where the Site of Origin hosts the Web Services. This scenario is 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;&lt;STRONG&gt;D2D scenario&lt;/STRONG&gt;&lt;/A&gt;&lt;STRONG&gt; &lt;EM&gt;without&lt;/EM&gt; cross-domain policy&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&lt;EM&gt;The XAP package, the REST service Eclipse project and the Silverlight Eclipse project are 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;REST services are built with the Restlet framework and hosted in Tomcat &lt;/LI&gt;
&lt;LI&gt;The Silverlight application is also hosted in Tomcat&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/image_2.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/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=308 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/image_thumb.png" width=411 border=0 mce_src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/image_thumb.png"&gt;&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because the Site Of Origin and the Web Services reside in the same host, no Cross Domain policy is required.&lt;/P&gt;
&lt;P&gt;To successfully install the technical environment, please take the following step :&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Build the scenario detailled in &lt;A href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/29/silverlight-plus-xml-rest-style-in-cross-domain-access.aspx" mce_href="http://blogs.msdn.com/silverlight_plus_java/archive/2008/07/29/silverlight-plus-xml-rest-style-in-cross-domain-access.aspx"&gt;HowTo : Silverlight accessing Java REST services (Part 1 - Cross Domain : IIS + Tomcat)&lt;/A&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;If you don’t feel like doing the previous step, the XAP package available as an attachment contains a Silverlight client which is configured to access a REST service at http://localhost:8080/Restlet-servletfirstResource/items.&lt;/P&gt;
&lt;P&gt;The REST service is also available as an attachment to this post allows to do a GET and POST method to get a list of items or to insert a new one.&lt;/P&gt;
&lt;P&gt;Download the attachment and unzip it. There are two needed parts : the Silverlight XAP package and the Restlet Eclipse project.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/image_4.png" mce_href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/image_4.png"&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Host the REST service with Tomcat&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Import the Reslet-servletfirstResource project into your Eclipse workspace : &lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;go to File –&amp;gt; Import &lt;BR&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/image_6.png"&gt;&lt;IMG title=image style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=243 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/image_thumb_2.png" width=146 border=0&gt;&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Then chose General—&amp;gt;Existing Projects into Workspace &lt;BR&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/image_10.png"&gt;&lt;IMG title=image style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=270 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/image_thumb_4.png" width=231 border=0&gt;&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Select the root directory, Browse to the Restlet-servletfirstResource folder, then click on Finish. The Restlet-servletfirstResource has now been imported into your workspace &lt;BR&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/image_14.png"&gt;&lt;IMG title=image style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=268 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/image_thumb_6.png" width=229 border=0&gt;&lt;/A&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;Run the project on Tomcat Server. check that &lt;A title=http://localhost:8080/Restlet-servletfirstResource/items href="http://localhost:8080/Restlet-servletfirstResource/items"&gt;http://localhost:8080/Restlet-servletfirstResource/items&lt;/A&gt; is accessible you should get the following result : &lt;BR&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/image_16.png"&gt;&lt;IMG title=image style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=196 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/image_thumb_7.png" width=240 border=0&gt;&lt;/A&gt;&amp;nbsp;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;Host the Silverlight application in an Eclipse project running on Tomcat&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Create a new Dynamic Web Project&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Press Ctrl+n to go to the New Wizard Project, under Web select Dynamic Web Project. &lt;BR&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/image_18.png"&gt;&lt;IMG title=image style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=239 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/image_thumb_8.png" width=240 border=0&gt;&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;Call it REST-SilverlightClient and ensure that the Target Runtime is set to Apache Tomcat 6.0 &lt;BR&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/image_20.png"&gt;&lt;IMG title=image style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=240 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/image_thumb_9.png" width=205 border=0&gt;&lt;/A&gt; &lt;/LI&gt;
&lt;LI&gt;If Eclipse prompts you to switch to J2EE perspective, accept it.&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;In the REST-SilverlightClient project, create the WebContent\ClientBin folder and copy the XAP package into it.&lt;/LI&gt;
&lt;LI&gt;Now we need to host it through an Active X control :&lt;/LI&gt;
&lt;UL&gt;
&lt;LI&gt;Right click on WebContent folder and select New—&amp;gt;JSP, call it index&lt;/LI&gt;
&lt;LI&gt;Edit index.jsp, in the Head part put the following script that catches Silverlight Error.&lt;/LI&gt;&lt;/UL&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;script&lt;/SPAN&gt; &lt;SPAN class=attr&gt;type&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="text/javascript"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;     &lt;SPAN class=kwrd&gt;function&lt;/SPAN&gt; onSilverlightError(sender, args) {&lt;/PRE&gt;&lt;PRE class=alt&gt;     &lt;/PRE&gt;&lt;PRE&gt;         &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; appSource = &lt;SPAN class=str&gt;""&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE class=alt&gt;         &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (sender != &lt;SPAN class=kwrd&gt;null&lt;/SPAN&gt; &amp;amp;&amp;amp; sender != 0) {&lt;/PRE&gt;&lt;PRE&gt;             appSource = sender.getHost().Source;&lt;/PRE&gt;&lt;PRE class=alt&gt;         } &lt;/PRE&gt;&lt;PRE&gt;         &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; errorType = args.ErrorType;&lt;/PRE&gt;&lt;PRE class=alt&gt;         &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; iErrorCode = args.ErrorCode;&lt;/PRE&gt;&lt;PRE&gt;         &lt;/PRE&gt;&lt;PRE class=alt&gt;         &lt;SPAN class=kwrd&gt;var&lt;/SPAN&gt; errMsg = &lt;SPAN class=str&gt;"Unhandled Error in Silverlight 2 Application "&lt;/SPAN&gt; +  appSource + &lt;SPAN class=str&gt;"\n"&lt;/SPAN&gt; ;&lt;/PRE&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=alt&gt;         errMsg += &lt;SPAN class=str&gt;"Code: "&lt;/SPAN&gt;+ iErrorCode + &lt;SPAN class=str&gt;"    \n"&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE&gt;         errMsg += &lt;SPAN class=str&gt;"Category: "&lt;/SPAN&gt; + errorType + &lt;SPAN class=str&gt;"       \n"&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE class=alt&gt;         errMsg += &lt;SPAN class=str&gt;"Message: "&lt;/SPAN&gt; + args.ErrorMessage + &lt;SPAN class=str&gt;"     \n"&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=alt&gt;         &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (errorType == &lt;SPAN class=str&gt;"ParserError"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;PRE&gt;         {&lt;/PRE&gt;&lt;PRE class=alt&gt;             errMsg += &lt;SPAN class=str&gt;"File: "&lt;/SPAN&gt; + args.xamlFile + &lt;SPAN class=str&gt;"     \n"&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE&gt;             errMsg += &lt;SPAN class=str&gt;"Line: "&lt;/SPAN&gt; + args.lineNumber + &lt;SPAN class=str&gt;"     \n"&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE class=alt&gt;             errMsg += &lt;SPAN class=str&gt;"Position: "&lt;/SPAN&gt; + args.charPosition + &lt;SPAN class=str&gt;"     \n"&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE&gt;         }&lt;/PRE&gt;&lt;PRE class=alt&gt;         &lt;SPAN class=kwrd&gt;else&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (errorType == &lt;SPAN class=str&gt;"RuntimeError"&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;PRE&gt;         {           &lt;/PRE&gt;&lt;PRE class=alt&gt;             &lt;SPAN class=kwrd&gt;if&lt;/SPAN&gt; (args.lineNumber != 0)&lt;/PRE&gt;&lt;PRE&gt;             {&lt;/PRE&gt;&lt;PRE class=alt&gt;                 errMsg += &lt;SPAN class=str&gt;"Line: "&lt;/SPAN&gt; + args.lineNumber + &lt;SPAN class=str&gt;"     \n"&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE&gt;                 errMsg += &lt;SPAN class=str&gt;"Position: "&lt;/SPAN&gt; +  args.charPosition + &lt;SPAN class=str&gt;"     \n"&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE class=alt&gt;             }&lt;/PRE&gt;&lt;PRE&gt;             errMsg += &lt;SPAN class=str&gt;"MethodName: "&lt;/SPAN&gt; + args.methodName + &lt;SPAN class=str&gt;"     \n"&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE class=alt&gt;         }&lt;/PRE&gt;&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;PRE class=alt&gt;         &lt;SPAN class=kwrd&gt;throw&lt;/SPAN&gt; &lt;SPAN class=kwrd&gt;new&lt;/SPAN&gt; Error(errMsg);&lt;/PRE&gt;&lt;PRE&gt;     }&lt;/PRE&gt;&lt;PRE class=alt&gt; &lt;SPAN class=kwrd&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;script&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;UL&gt;
&lt;UL&gt;
&lt;LI&gt;In the Body part, instantiate a Silverlight control by adding the following HTML code, ensure that the param named “source” has is value set to the XAP package URI relative to index.jsp Web Page:&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;
&lt;DIV class=csharpcode&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;div&lt;/SPAN&gt; &lt;SPAN class=attr&gt;id&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="silverlightControlHost"&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;object&lt;/SPAN&gt; &lt;SPAN class=attr&gt;data&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="data:application/x-silverlight,"&lt;/SPAN&gt; &lt;/PRE&gt;&lt;PRE class=alt&gt;            &lt;SPAN class=attr&gt;type&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="application/x-silverlight-2-b2"&lt;/SPAN&gt; &lt;/PRE&gt;&lt;PRE&gt;            &lt;SPAN class=attr&gt;width&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="100%"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;height&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="100%"&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=alt&gt;        &lt;/PRE&gt;&lt;PRE&gt;        &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;param&lt;/SPAN&gt;     &lt;SPAN class=attr&gt;name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="source"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;value&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="ClientBin/REST-JavaServiceItem.xap"&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;param&lt;/SPAN&gt;     &lt;SPAN class=attr&gt;name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="onerror"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;value&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="onSilverlightError"&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;param&lt;/SPAN&gt;     &lt;SPAN class=attr&gt;name&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="background"&lt;/SPAN&gt; &lt;SPAN class=attr&gt;value&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 class=alt&gt;    &lt;/PRE&gt;&lt;PRE&gt;        &lt;SPAN class=kwrd&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN class=html&gt;a&lt;/SPAN&gt;     &lt;SPAN class=attr&gt;href&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="http://go.microsoft.com/fwlink/?LinkID=115261"&lt;/SPAN&gt; &lt;/PRE&gt;&lt;PRE class=alt&gt;            &lt;SPAN class=attr&gt;style&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="text-decoration: none;"&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;img&lt;/SPAN&gt; &lt;SPAN class=attr&gt;src&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="http://go.microsoft.com/fwlink/?LinkId=108181"&lt;/SPAN&gt; &lt;/PRE&gt;&lt;PRE class=alt&gt;                 &lt;SPAN class=attr&gt;alt&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="Get Microsoft Silverlight"&lt;/SPAN&gt; &lt;/PRE&gt;&lt;PRE&gt;                 &lt;SPAN class=attr&gt;style&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;="border-style: none"&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;a&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;object&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;iframe&lt;/SPAN&gt; &lt;SPAN class=attr&gt;style&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;='visibility:hidden;height:0;width:0;border:0px'&lt;/SPAN&gt;&lt;SPAN class=kwrd&gt;&amp;gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN class=html&gt;iframe&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;div&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;/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;Run the project on Tomcat Server and the Silverlight control will appear in the Eclipse Web Browser : &lt;BR&gt;&lt;A href="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/image_22.png"&gt;&lt;IMG title=image style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=216 alt=image src="http://blogs.msdn.com/blogfiles/silverlight_plus_java/WindowsLiveWriter/HowToSilverlightaccessingJavaRESTservice_F1AE/image_thumb_10.png" width=240 border=0&gt;&lt;/A&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;The great thing about that is that you will be able to test your REST Service and the Silverlight application without running multiple Development Environments.&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=8791751" width="1" height="1"&gt;</description><enclosure url="http://blogs.msdn.com/silverlight_plus_java/attachment/8791751.ashx" length="145518" 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/D2D/default.aspx">D2D</category></item><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>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>