Pick a Silverlight RIA scenario [D2D, B2E, B2B, B2C] or choose a Web Services style [SOAP/RPC, XML/REST]
The HowTo 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 D2D scenario without cross-domain policy.
The SOAP service Eclipse project and the Silverlight Eclipse project are available as an attachment to this post.
Technical Environment
Because the Site of Origin and the Web Service reside in the same host, no Cross Domain policy is required.
In case you haven’t done the How-To : Silverlight accessing Java SOAP services (Part 1 – Cross Domain : IIS + Tomcat), you can directly import the SOAP-Sum service Eclipse project into your Eclipse Workspace.
In the REST way, we showed you how to host a Silverlight Application using a JSP. Now we are going to host a Silverlight application using a Servlet
Instance of Silverlight plugin :
private void responseHandler(HttpServletResponse response) throws IOException{
PrintWriter pw = response.getWriter();
pw.println("" +
"<div id=\"silverlightControlHost\">" +
" <object data=\"data:application/x-silverlight,\"" +
" type=\"application/x-silverlight-2-b2\"" +
" width=\"100%\" height=\"100%\">" +
" <param name=\"source\" value=\"ClientBin/SOAP-Sum.xap\"/>" +
" <param name=\"background\" value=\"white\" />" +
" <a href=\"http://go.microsoft.com/fwlink/?LinkID=115261\"" +
" style=\'text-decoration: none;\'>' +
" <img src=\"http://go.microsoft.com/fwlink/?LinkId=108181\""+
" alt=\"Get Microsoft Silverlight\"" +
" style=\'border-style: none\'/>' +
" </a>" +
" </object>" +
" <iframe style='visibility:hidden;height:0;width:0;border:0px'>' +
"</iframe>" +
"</div>");
pw.close();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
responseHandler(response);
super.doGet(request, response);
Silverlight will access the SOAP-Sum service without cross-domain
- Ronny Kwon