We have a Requirement of Consuming the WCf Services which is hosted in IIS like http://localhost/someservice.svc.
We would like to consume that Service via java script and bind my sample data controls called grid view on client side itself.
I think this can be done by Serializing and deserialzing to JSON and consume the data source and bind the grid controls.
Pls Refer the below link
http://forums.infragistics.com/forums/p/48035/258346.aspx
I would like to Achieve my func like the above link.
Can you pls guide me to achieve this Tasks.
Thanks
Regards
N.Balaji
Balaji,
Yes, you can definitely enable your WCF service (whether within IIS or not) to use JSON.
You do need to make one choice: do you want to use that service from the ASP .NET AJAX framework, or do you want to create a more general solution that is not tied down to that framework's usage within the browser?
If it's the former, use WebScriptEnablingBehavior. If it's the latter, use WebHttpBehavior.
For either scenario, detailed instructions are available in the following two MSDN sections:
AJAX Integration and JSON Support
WCF Web Http Programming Model
Related
I've been given a WDSL file and have to create a web service client using axis2. I've been able to generate the CallbackHandler and Stub using WSDL2java. I've tried following this tutorial to create the Client http://briansjavablog.blogspot.com.au/2013/01/axis2-web-service-client-tutorial.html
I'm not sure if I implemented the client properly. It runs, but I'm not sure how you view any output results. I've never dealt with web services before. The Stub file that was generated contains so much code, how am I supposed to know what I should be calling? All tutorials I've found give example Clients, but I want to know what I need to look at to create my own.
If anyone has any advice or links to creating clients that are easy to understand, it would be appreciated.
I think that this probably went un-answered for a while due to the fact that the question is not clear and you probably need an introduction to Web Services and SOAP in general. If you are given the WSDL (or can pull it from a URL out there somewhere) then you are using the Web Service as a client - you have (from the post) already created the stub for client use. You simply need to use it. You are sending a request to the server (Web Service) and sending it the data that it requires (as the SOAP parameters that are laid out in the Web Service schema). Based on this SOAP request you will get a response. Your stubs that are created for the client act as the invocation and response points for your client.
So your question as to how do you test it: you decide what to do with the response as this is what you are coding into the client.
And about creating your own Web Service - you would need to start with a schema (often times you write your objects/data and the functions that you want them to perform and tools (like Axis2) will generate the server code (for Web Services and SOAP transport) on top of this.
So in your question, I think that you need to a) check out some Web Services books/online tutorials to figure out what it is, b) code your client to display the results and stuff - and just make sure that you are actually sending and getting responses from the Web Service, and c) also see what it would take to create your own Web Service (for whatever purpose you are planning the service to be established for, before creating your own.
Effectively I think that you just need to get your feet wet with Web Services in the first place. And the tutorial that you pointed out ( http://briansjavablog.blogspot.com.au/2013/01/axis2-web-service-client-tutorial.html) is excellent for anyone looking to get a web services client started - thanks for posting that.
I have a simple scenario where i want to output only json to the user.Now should i use a simple httphandler, call it from jquery and get the json or create a WCf service?
I want to use WCf service but don't see any advantage, maybe someone can point few of them and scenarios.
Anything would be suffice. Your thoughts are in correct direction, why to create a wcf service and increase the overload(maintaince, deployment etc).
If you are using Ajax, Look in to PageMethods, which would even free you from creating a separate HTTPHandler and you could call your code behind methods directly in your javascript.
I am assuming you are using asp.net.
Is there some way that I can get list of all the WCF restful services operations at client side( something like helpEnabled).
I tried to use http://servername/service/help, but it returns complete html. I want to get the operations suported by the service in the program.
I want to list all the operations supported by the service.
Is there any way to do it?
The short answer: It depends on what the creator of the service you are trying to consume has exposed.
There are two sides to this particular "issue". One side states that you should be able to hit a GET endpoint and then follow links (often ATOM PUB, esp. for the REST in Practice crowd). The other is pushing WADL, a REST analog to WSDL (SOAP Services). In the first camp, there is no map and the service works more like a website. In the second, you have a description of all services.
I am going develop a WPF windows based application. I want to work with Entity Framework Self Tracking Entities and WCF. I was wondering if using Json is possible/recommended? If yes, please assist me; is there any tutorial that can help?
You can use the DataContractJsonSerializer to serialize the messages. You will have to use a REST based service (WebHttpBinding) as SOAP mandates XML as the message payload.
You can tell WCF to use the DatcontractJsonSerializer on the service side by settings in the WebGet and WebInvoke attributes but on the client side you will have to manually use this serializer as REST doesn;t have a metadata standard and therefore you have to create the requests and manage responses in a more manual fashion
Here is a reasonable guide to using Json and REST support in WCF
However, what is your driver to using Json? WCF is much more geared to SOAP based interaction currently (although the WCF 4.5 WebApi is going to address that to quite a degree). As your client is WPF you don't seem to gain alot from using Json
As a contrast with a asmx file, how can I get in the visual service page that shows the available methods on the service?
http://soweb.adwiza.com/person.asmx
Versus
http://soweb7.adwiza.com/remote/person.svc
WCF does not have the list of operations page. The information is available by looking at the raw WSDL http://soweb7.adwiza.com/remote/person.svc?WSDL.
If you want a friendlier way to see that information as well as the ability to invoke the service (which the old ASMX page gave for simple types) then you can use the WCF Test Client (WcfTestClient.exe).
It will show you all of that information: