Consume Webservice using typescript - web-services

I am attempting to use typescript to consume a RESTful webservice, and am having a few issues understanding how to write the call.
I want to consume this call for the Reddit API:
POST /api/register
http://www.reddit.com/dev/api
How can I write that post method using Typescript?

Look at amplify.js (http://amplifyjs.com/). This library provides a convenient wrapper around the invocation of REST services and has TypeScript definition filed to facilitate easy consumption from TypeScript.

Related

WSO2 BPS rest API tests

I didn't find such kind of an information in your documentation so I would like to know if there any opportunities/tools for testing API for the whole diagram? like a set of API call one after another? Will it be OK if I put several rest API calls in one test method? Are there better approaches for doing that?
Thanks,
We didn't find any lib for that but we used RestAssured library for testing API calls.

Creating and using SOAP based web service in Laravel framework

In Laravel 4 framework, how to create a SOAP based web service. I would like to build a SOA based web application in laravel. Please clarify with an example how to use web service with some step by step examples or links as i am completely new to laravel
Thanks in advance..
You can use "php-wsdl-creator" (also supports SOAP). They have a great tutorial and many demo php files to get you started. It can also easily be implemented in laravel or any other framework for that matter. :)
You can find more information on Google Code: https://code.google.com/p/php-wsdl-creator/
Also note that SOAP requires an extension to be loaded in PHP.
For more recent needs, you should use a Project such as wsdl2phpgenerator or PackageGenerator from WsdlToPhp. This sort of projects, requirable with composer, use an OOP approach and allows to build a SOAP request easily with PHP objects then handle the response just as the request with PHP objects.

Calling a webservice through a mobile client

I am working with phonegap and jquery mobile at the moment. I just want to know whether there is a library that I can use or a way to call SOAP an RESTful webservices to my mobile client.
I did a lot of research and did not find anything that I can use. Do I need to write this from scratch?
Thank you.
First forget about SOAP, at from pure javascript point of view. On the other hand if you are willing you can use Java to create a web service client side code. Next step would be to connect jQuery and native Java part of Phonegap. It can be done easily if you create your own plugin.
Then again if this is a to much job for you there is also another solution. Same function used for jQuery REST call can be also used for jQuery SOAP call. More information can be found in this tutorial. But be warned, you will need to write client side XML. Still this is not that great solution.
On the other hand I would rather choose REST over SOAP. While SOAP is great it creates to much data overhead and we need smallest possible data footprint. Because Phonegap is HTML/JS/CSS wrapper it is commonly used to communicate via XHR/Ajax. So in our case it's better to use jQuery Ajax functions. Here you can find an excellent tutorial.
One great thing about using $.ajax function inside a Phonegap app for REST call is that you don't need to worry about CROSS-DOMAIN calls.
There's also third solution, rather hard but probably best of them all. Instead of using jQuery $.ajax function you should think about using Backbone MVC framework with jQuery Mobile. It will take time to master this combination but from my experience this is No. 1 solution if you want to use REST to communicate with your server.

Create SOAP webservice starting from WSDL using Groovy?

We have a wsdl for which we need to create a server implementation. In previous projects we used wsdl2java from Apache CXF, but now we want to keep it all in Groovy. Is there a way in which we can create a server implementation and keep it all in Groovy? Or are there any other ways we can achieve this?
The ultimate goal would be that we can hook this implementation into a Grails application that will serve as the server for clients.
Yes. You can either use the plugin or use cxf directly.
If you follow that tutorial, you can always use wsdl2java and just rename the generated files to be .groovy files and update the syntax to be more groovified. They will still work like normal. Also, as you may or may not know, you don't have to copy the jars directly to your lib directory as it says in the tutorial, you can just use normal Grails dependency management.
I think a better fit for you would be Groovy WS Lite. Spring-ws is also an option, it is a powerful library and reasonably well documented, since grails is spring at the end of day, this may integrate very well with grails. Shameless plug: This is web service integration testing tool I created which uses groovy and spring-ws. You can see the code to get a "working example".

Beginner Design pattern question (Web Services involved)

I am a noob to web services world. I need to develop a login validator module and expose it as a service. I want it to be service independent, i.e I should have the option of exposing it as a SOAP service or REST service in the future.
What pattern should I follow ? Sorry if I am unclear in my requirements, I can clarify as per need.
Thanks !!
Edit : I am using Eclipse as an IDE and Jersey libraries. I am not into any framework, simply using the MVC pattern. I find a lot of difference between SOAP ann REST methods, so I want my methods to be implementation independent - i.e I should be easily able to use my method through a SOAP or REST service call as per need. What should I do for maximum flexibility ?
Picking a good MVC framework and understanding how to use it properly can help ensure that your feature is "service independent". Most of the documentation I've read for good frameworks suggest that you keep your business logic separate from your controller.
If you read the documentation for the tools that you use, and ensure that there is a layer between your business logic and your controllers, then that will make the job of switching from SOAP to REST or some other protocol much, much easier.
Since you mentioned you're using Eclipse in your comment below, I'm assuming you are using or are willing to use Java:
Restlets
http://www.restlet.org/
Spring 3.0 REST
http://blog.springsource.com/2009/03/08/rest-in-spring-3-mvc/
Develop your service as a POJO. Make sure to respect staless pattern.
Create an EndPoint class for each publication type you require (Soap, Rest, EJB, JMS, what ever)
Use appropriate standard to expose your EndPoint. For Soap and Rest the JAX-WS api and implementations can do it for you using java annotations on your EndPoint.
That's it !