SAP making HTTPS requests to REST service - sap

Is this possible? I'm about to start into a project which requires a call from an SAP instance to a remotely hosted service using XML over HTTPS. Does anyone have sample ABAP code?

There is a SDN article titled "Real Web Services with REST and ICF". This covers the server side (providing a REST service) only, but maybe this could help you getting started. There's also the (arguably rather concise) documentation on client side ICF development. However, it looks like you'll have to parse the body on your own, using nothing but the XML support SAP provides you with. That's the drawback of REST...

This can be done using cl_http_client.
Check the SAP help documentation for the code.
For making HTTPS calls, you also need to import the certificate of your service provider into the system. This can be done using the transaction "STRUST". This step is compulsory; without it, you`ll get communication errors.

Related

Consume a web service using WSE3.0 or WCF?

I have to use a number of functions provided by a government web service. I have no idea what they used to implement this service. Could have been COBOL for all I know.
My problem is that I've been trying to access this service using the security features provided by WSE3.0 but have had no luck. I'm consistently getting errors regarding the certificates.
After some research I've realized that WSE3.0 is essentially defunct and I should be using WCF. But, I'm only writing a client and most literature seems to refer to the services themselves.
Is there even such a thing as using 'WCF' to write a client? Should it matter which I use?
Thanks in advance.
Sure, WCF is a great choice for writing a web service client. Here is how to create the client ("add service reference"). After this you need to create the binding (just like in the service samples).

Axis2 REST client application with non-Axis2 framework on server side

I need to develop a REST client application that consumes a REST based web service written in some non-Axis2 framework like Apache Slign or Jersey. As far as I can think, this should not be possible as from what I've read from online docs is that Axis2 treats a REST request internally as a SOAP message. If the server side is also Axis2, then it would understand this and handle it gracefully but a non-Axis2 framework should not understand it as a valid REST call and therefore should fail.
Can someone suggest or atleast provide some pointers?
I was part of an Enterprise Service Bus(ESB) development where it had numerous web-services written in Axis2 , Weblogic etc . Also we had various clients which were non-Axis2 as well invoking the services in the ESB .
That is why strongly support my answer .

What online REST API workbenches are available?

When creating a site/script to be on the client end of a RESTful API, what tools are available to create a "workbench" to explore the API, examining headers and responses while working through the design? Preferably one(s) that allow you to enter a custom endpoint, and create sample requests to see the responses. I recall seeing one nice workbench before, but its name has escaped me.
Re-found the one I remembered: The Apigee Console is a great interface for playing around with an existing API or building your own.
Mashery's I/O Docs is an open source workbench that you can deploy yourself on a Node.js server with Redis for storage.
If you have the wadl file of the ReST Services, you can load it in SOAP UI and use it.
EditedAnother much simpler tool Rest Client

How do you protect a resource on a webserver using REST API

I wanted to know how to can i protect a resource on a webserver using REST API.Like for example i want to access http://www.xyz.com/folder/impresource.doc but before accessing that i have to be authenticated. The thing is i am try to create a simple mobile client to authenticate with a rest service and then be able to access the resource.
I would appreciate a good example explaining how it can be done Thanks :)
It would be nice if i could get an example in php.
You implement a web service (be it REST, or be it SOAP) in some programming language (for example, Java or C#) running in some "container" (for example, IIS/.Net or Tomcat).
The layer below REST (for example, the C# code you're using to implement your IIS/.Net/SOAP web service, or the Java code in your .war) is the layer where you want to write any custom access code.
Alternatively, some vendors (for example, Amazon S3) have already done this for you:
http://aws.amazon.com/s3/faqs/
Other vendors (such as Microsoft) give you a way to use their authentication infrastructure with your web service:
Secure REST Service Microsoft Azure AppFabric
In java you can use a servlet filter, which will send an error code if it does not find an authentication object in the user session and if authenticated let the request handling proceed. A very popular implementation of this approach is Spring security[http://static.springsource.org/spring-security/site/tutorial.html]

Consume a WCF service via HTTP POST and without a service reference

I am going to need a web service that receives a string via HTTP POST and processes it without any response to the client. However, since I'm not the one making the client (which will be cell phones) I am unable to use a generated client class to consume the service. The service would also need to be self hosted in a regular Windows service, if that matters.
As I'm not too experienced with web services nor WCF, I am frankly unsure if I can or should use WCF for this, but as it's the only type of web service I'm at least a little familiar with I figured it would be great to start out with one if at all possible.
I've been googling around quite a bit but haven't been able to find any good references to this, so I'd also be very grateful if someone has a link lying around to someplace that discusses it.
I think you need WCF Restful service with one way operation. Following link might help you:
A Developer's Guide to the WCF REST Starter Kit,