Friday, October 12, 2012

Silverlight accessing secured Webservice

Silverlight accessing secured Webservice

I'm trying to get a Silverlight application to connect to a Java webservice using a service reference.

I've come to the conclusion that Silverlight doesn't work the same way as as WPF or ASP.NET with respect to service connectivity.

I've searched the net and all I found for authentication was articles talking about securing the application by user by altering the service to include a webmethod.

I have to use the existing service. I've been using NetworkCredetials in ASP.NET and WPF; what's the equivalent in Silverlight?

Sorry, I should have mentioned that it's an axis service on a JBoss server.

UPDATE: This link seems to indicate that this should be possible http://blogs.msdn.com/coding4fun/archive/2008/02/24/7883342.aspx. They use NetworkCredentials to connect to to the Twitter API.

Answers & Comments...

Answer: 1

Does the web service have a clientaccesspolicy.xml or crossdomain.xml policy file?

http://msdn.microsoft.com/en-us/library/cc197955(VS.95).aspx

by : KeithMahoneyhttp://stackoverflow.com/users/63778

Answer: 2

This should definitely be possible. Shouldn't matter what language the service was written in - only the format of the output (SOAP, JSON etc).

Do you have any SSL involved?

Try fully opening your your ClientAccessPolicy (no restrictions) and then try copying that to different roots (root of the server, root of the app, root of the SL app etc) to see if you get any better results.

I think a fully open policy file would look like this:

<?xml version="1.0" encoding="utf-8"?> <access-policy>   <cross-domain-access>     <policy>       <allow-from http-request-headers="*">         <domain uri="*"/>       </allow-from>       <grant-to>         <resource path="/" include-subpaths="true"/>       </grant-to>     </policy>   </cross-domain-access> </access-policy> 
by : Mark Cooperhttp://stackoverflow.com/users/75594

Answer: 3

Make sure you binding contains the tag in the ServiceReferences.ClientConfig Security mode should be = Transport for the Https acces of the webservice

<basicHttpBinding>                 <binding name="FactorSoap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">                     <security mode="Transport" />                 </binding>  </basicHttpBinding> 
by : Chittahttp://stackoverflow.com/users/843959




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog