I have a Silverlight application and I would need to be able to get data from practically any webservice. I'd like to provide the functionality for the user to specify an URL of a webservice during runtime, then my app would discover the service and offer some UI to select the webmethod and fill the necessary parameters. Then the user could call the webservice and the app would display the data on the UI.
How can I achieve this?
I assume you mean a SOAP web service? There are many components in .NET that you would normally want to use for this (e.g. WCF's metadata download and client proxy generation functionality, based on CodeDOM, as well as various classes for dealing with WSDL and XSD schema). Unfortunately, these are not present in Silverlight. So, I can think of two approaches:
1) Manually implement a general-purpose SOAP client in Silverlight (i.e. manually implement metadata download, WSDL parsing, XSD parsing, etc) - this will be very difficult unless you can find some existing code for this that you can adapt to Silverlight (and even then it's probably still very difficult)
2) Do it through the server. The server will do all the difficult parts, and Silverlight will just display the UI. Still not an easy task, but possible; You can start by reverse-engineering how the WCF Test Client application works by using Reflector and go from there.
Related
We wanted to perform load testing of a silverlight application. We only need to test for max of 50-75 users
Wanted to get inputs if we can use JMeter and if yes, how can we go about it.Also, please do suggest if there are any other possible alternatives and cost associated with them.
You cannot load test Silverlight application with regular HTTP samplers as the protocol is binary and needs to be decoded before being able to:
variabilize
correlate
In order to do so, you would need to develop a plugin for this technology which might not be easy.
Some interesting elements:
http://jmeter.apache.org/usermanual/jmeter_tutorial.html
http://jmeter.apache.org/usermanual/component_reference.html#Java_Request
http://jmeter.apache.org/usermanual/component_reference.html#JSR223_Sampler
Alternatively, you could have a look at other solutions.
Silverlight runs on client side therefore I don't see a lot of sense in load testing it as it will always have only one user.
If your Silverlight application assumes a backend and you need to know if the backend is capable of handling 50-70 concurrent users - you could use JMeter for this. In the absolute majority of cases Silverlight applications use SOAP web services for communication between client application and the backend and SOAP is something JMeter naturally supports via its HTTP Request sampler, check out Building a SOAP WebService Test Plan User Manual chapter for more details.
Alternative options are in:
If your Silverlight application functions are exposed to JavaScript you could use JMeter's WebDriver Sampler to kick off real browsers, invoked functions methods and render the results.
Alternative to JMeter would be HP LoadRunner which seems to support Silverlight up to certain extent (not more than JMeter doesn however) and is free up to 50 concurrent users.
We are testing application which is implemented using Silverlight. The development team has used CSLA for encryption and decryption of request and response body. A message body is in an encrypted format, we are facing issues for co-relation and parameterization.
Anyone having experience of load testing for such kind of application? We are using VSTS 2015
Csla is not an encryption; rather it is a framework for development of business objects. One of the key features is that the object can move across the network, so that the same business rules run on both the Silverlight client and the Asp.net server (which is where you data access will occur). It does this by serializing the objects using HTTP, WCF or some other protocol back and forth.
If the calls you are load testing do not require a user to be authenticated, you should be able to capture them with something like Fiddler and replace them. If the calls are authenticated, you may encounter issues as Csla automatically can serialize the Silverlight appdomain's IPrincipal so its available on the server as well. That may or may not cause problems with your load testing, but it would depend on how exactly the authorization and authentication was implemented.
I want to send simple data (geolocation data to be precise) from Windows Phone 7 application to a windows forms application and use it, as I'm a total beginner in this field I don't know which tools to use.
I searched about wcf services and tested this method but there's some issues: the data is sent from the phone application but isn't sent to the winforms application (guess something is missing)
If your know how to do this in a quick way, or have good tutorials I'll be thankful.
EDIT
I found this tutorial, it show how to connect directly wp7 application and desktop application without using sockets neither wcf service, I'm wondering if it is really works if the application isn't in localhost.
the like for the tutorial: wp7 tutorial
I had a similar problem and so I created a REST/JSON WCF service hosted in IIS with AppHarbor to provide the data. There's hundreds of ways to do it (Ruby/Heroku, etc..), but that particular one fits well within the Microsoft stack. I also needed to share route data and I used the WCF service to wrap the BingMaps services so that route computations are cached and shared. Considering that I had already created a local model, moving it out of my phone project into a service took less than a few hours (including the usual config hiccups, and forgetting to add the appharbor user to my bitbucket repo).
Consuming the service from WinForms (or any client) shouldn't be an issue as the service knows nothing about the client implementation.
Here's a tutorial from code project. REST WCF Service with JSON
I think you would need to implement some sort of server side solution which you could upload to on your Windows Phone and download from on your Windows Form application. This could be achieved using a WCF service which was connected to a server side database.
Another option would be to use sockets and communicate directly with your WinForms application. Check this tutorial on how to use basic sockets on WP7.
I have a .wsdl file defining a web service, and I want to generate a client object to use the web service. Generating this is unproblematic in a normal .Net project, but it fails when targeting WP7 (the client object gets generated, but does not have all the methods it should have). When doing this directly using SlSvcUtil.exe I get the error message that it does not support operations using SOAP encoding (use='encoded').
The service is run by a third party, and I can't change it.
One solution would be to set up an intermediate server to translate to a format I can read, but I'd like to avoid that. What are my other options? Are there any non-MS libraries that can do this code generation for me? If not, how big of an undertaking would it be to parse the SOAP manually?
I had the same problem and found no solution. It seems there is a lack in the use of SOAP services, when targeting WP7.
In my case I ended up writing my own client class to parse the SOAP manually. The effort was kept within limits but it depends of the complexity of the service.
For more informations about the SOAP protocol I can recommend w3cschools SOAP Tutorial.
It can also be helpful to generate a client object in a normal .Net project and then investigate the network communication with SOAP webservice with fiddler or wireshark.
I have googled a bit for how I should handle security in a web service application when the application is basically the data repository for a Silverlight application, but have gotten inconclusive results.
The Silverlight application is not supposed to have its own user authentication, since it will be reachable only through a web application that the user have already authenticated to get into.
As such, I was thinking I could simply add a parameter to the SL application that is a cookie-type value, with a certain lifetime, linked to the user in the database. The SL application would then have to pass this value alongside other parameters to the web services. Since the web service is hopefully going to be a generic web service endpoint, few methods, adding an extra parameter at this level will not be a problem.
But, am I supposed to roll this system on my own? It sounds to me as this isn't exactly new features that nobody has considered before, so what are my options?
First of all use SSL for the service. Otherwise users will be able to capture all the parameters passed to the service. It's still possible to see it in case of https but it will be a little bit more difficult.
Also, consider using Message Inspector for adding custom headers to the messages which you will validate on the server. This way you will not need to add extra parameters.