RestTemplate equivalent for struts2 - struts2

In spring mvc there's is a class called RestTemplate that you can use to send rest requests in your server side code. See link
http://spring.io/blog/2009/03/27/rest-in-spring-3-resttemplate
Does anything like this exist for struts2 where I can call a restful web service and parse the json response ? Can I do this using the struts2json plugin?
Thanks

Related

call to oauth to get token in apache camel

I am new to Apache Camel. I wanted to call Oauth service from my existing route and get the access token value to call another rest service. I could not find anything on web. I wanted to implement it using Spring XML.

Blazor Web Assembly connecting to OAuth via Implicit Flow

In my blazor web assembly project, I have to connect to a Web API that doesn't implement OIDC.
I read on the aspnetcore github thet they made the choice to implement only OIDC connections...
I think I have to write a custom implementation of RemoteAuthenticationService and add it via the builder.Services.AddRemoteAuthentication method, but can't understand how to do this.
Reading the current implementation of RemoteAuthenticationService doesn't help.
The only thing I have to do to connect the Web API is to call this URI :
https://<webapi>/oauth/Authorize?client_id=<MyClientId>&state=<State>&scope=read&response_type=token&redirect_uri=<RedirectUri>
The user fill in the form and get redirected in my blazor app via the RedirectUri, having the accessToken in url parameters.
Then I have to add the accessToken in the headers of all Web API Requests, but I found how to do it via AuthorizationMessageHandler.
How can I implement this flow with Blazor Web Assembly ? Do I search in wrong direction ?

consume secure web service asmx in asp.net mvc

I want to consume secured web service in asp.net mvc, I need to create proxy class to this service
I tried to use wsdl.exe tool but it gave me the following errors
There was an error downloading
The request failed with HTTP status 401: Unauthorized.
is there another way to create proxy class
or there is another technique to call this secured web service in my application
It looks like the WSDL requires authentication in order to be downloaded. I suppose the Web Service also. The WSDL.exe utility allows you to specify the username and password to be used when downloading the WSDL. So go ahead, talk to the author of the web service to understand what account you need to use in order to access it and then try the /username and /password parameters:
wsdl.exe /username:john /password:secret http://example.com/foo.asmx?WSDL

Can webmatrix query an external odata web service like stackoverflow using razor

i was hoping i could capture external web service just the way i interact with my database e.g
var data_websevice = Database.Open("http://www.stackoverflow.com/atom/tags");
is this a possibility?
I actually need to return a json data to my client page. using the autocomplete jquery UI.Thanks
You can't use the Database helper for that. It's only intended for use with databases.
You can obtain data from an external resource by Uri using the WebClient class to request it, just like in any other ASP.NET application.

Can I call a REST webservice an 'XML webservice'?

Since REST services do not require XML, but we can use it with XML so can I call it a XML web service?
I'm doing my home work with the requirement that:
Using ASP.NET MVC
Provide an XML Web service
I was thinking about SOAP, but REST is more simple for me and I found alot of tut for REST with ASP.NET MVC rather than SOAP (They now all telling me about WCF...)
If REST is not an XML web service, please show some basic document about SOAP (or any thing else that call XML web service) with ASP.NET MVC!
Take a look at WCF Web Api. REST does not imply any particular format. A good REST service will allow you to set the Accept Header: json, xml, so on. E.g.: "accept" : "application/json"
Here is a good post on how to achieve this with WCF Web Api.
You can simply add a Web Service into your MVC application. You must take care about exclude "*.asmx" from your routes.
I.E:
routes.IgnoreRoute("{resource}.asmx/{*pathInfo}");

Resources