SAPUI5 OData 401 (Unauthorized) + No Access-Control-Allow-Origin Header - odata

I work in SAP Web IDE to develop an SAPUI5 application which uses OData Service CUAN_IMPORT_SRV.
I start by defining the OData Model this way:
var oModel = new sap.ui.model.odata.v2.ODataModel("https://host:port/sap/opu/odata/sap/CUAN_IMPORT_SRV/", true, "UNAME", "PASSWORD");
Username and Password can access the data and do read + create operations on Hybris Marketing. This is tested with Postman.
However, when I try to test my application with Test Fiori Launchpad, I get this error message when executing the OData call:
Concering this topic, I read some other posts and tried to edit the URL to
proxy/https/host:port/sap/opu/odata/sap/CUAN_IMPORT_SRV/
...but this results in 404 Not Found.
Since I use Chrome as Browser, I disabled web security as I read in other posts. This did not work. That's why I tried this Chrome AddOn. As a result, I got this error log:
What more can I try to solve this issue?
Thank you for any advice!
Tried configuring destination in Cloud Platform:

Web IDE does not allow Cross Origin access.
In order access your ODATA service from Web IDE, you have to use Cloud Connector.
Cloud connector will create a ternel between AP Cloud platform and your ODATA Service Gateway System.
Follow these steps:
https://blogs.sap.com/2014/06/22/how-to-configure-an-external-gw-system-with-sap-river-rde/

Related

SAP Web IDE UI5 odata saprouter

I have a SAP server with below information (must use saprouter to connect to it from afar). (3rd picture)
And i have an Odata service that i connect on LOCAL like below. (2nd picture)
Now in SAP Web IDE, i want to connect to this Odata. (1st picture)
The picture is an example to connect to Northwind Odata test server.
I need to replace the northwind odata url with my Odata url in 2nd picture.
But this url is only for local.
So how can i config this? I think it has something to do with the saprouter.
And how can i include the username and password for the Odata too?
SAP Web IDE
Odata
SAP SERVER
These are the steps you need to follow:
You need to expose your OData service in your NW system. I think this can be done in the /iwfnd/maint_services transaction. But Google it, because I am not a system administrator.
Once done you should be able to access de OData inside your internal Network like this:
Https://host:port/sap/opu/odata...
Where host:port is the full qualified domain of your NW system.
The Cloud Platform is in the cloud (obviously), this means that it is outside your private network, so you need to configure a secure tunnel to pass your firewall. This way you can access from your SCP account to your NW in your private network.
To configure this tunnel, SAP provides a great tool called "SAP Cloud Connector". You can download it from here
Google some tutorials to configure it. There are tons and it is easy.
Now configure a destination in the Cloud Platform cockpit. As I can see in the pictures you already did it for the Nortwind service, so I guess you know how to do it. The main difference will be that instead of pointing to Nortwind, it will point to your NW system thought the Cloud Connector.
Last, change the line of the manifest.json file you highlight in the first picture, so it points to the new destination.
And that's it!!

WSO2 API Manager WSDL Endpoint

I am trying to Expose a WSDL in WSO2 API Manager, by selecting WSDL Endpoint in the Implementation tab.
And providing the service name and Port respectively.
But while testing the same, from Api Store, the response is 0 - No response body. Also the WSDL is not being invoked.
Please help with this.
I have checked many blogs and videos, but can't find exact solution.
Ex WSDL that I am using is: https://ws.cdyne.com/phoneverify/phoneverify.asmx?wsdl
Used the same wsdl and expose the service using api manager and got the response from the web server. But as per the query posted above you are testing the soap service using api store. There may be mismatch the param you are posting to web service. Therefore use tool like soapUI to test the web service.
User the followings while exposing the SOAP Service
SOAP WSDL - https://ws.cdyne.com/phoneverify/phoneverify.asmx?wsdl
SOAP Endpoint - https://ws.cdyne.com/phoneverify/phoneverify.asmx
Reference -
[1] http://blog.rajkumarr.com/2015/08/how-to-expose-soap-services-as-soap-services-via-wso2-api-manager.html
[2] http://www.vitharana.org/2015/01/soap-web-service-as-rest-api-using-wso2.html
[3] https://docs.wso2.com/display/AM191/Invoke+an+API+using+a+SOAP+Client

Consume Secured web service in Asp.Net MVC

I'm working on asp.net mvc
I want to consume secured web service in my project
In previous I can consume unsecured web service (asmx) by calling wsdl to create proxy class ,now
I tried to create proxy class for the service by using wsdl.exe by using the following formula
Wsdl /language:language /protocol:protocol /namespace:myNameSpace /out:filename /username:username /password:password /domain:domain
But I had the following error
Error: There was an error processing 'https:// .asmx?wsdl'.
- There was an error downloading 'https:// .asmx?wsdl'
- Unable to connect to the remote server
- A socket operation was attempted to an unreachable network ??.???.???.??:???
Can you tell me how can I consume secured web service in my project
Yara
I dont know what sort of service you are talking about but I suspect you are Adding it as a Service/Web reference. If thats the case then assuming its called WebService1 and that the security you are talking about it basic authentication then:
WebService1 svc = new WebService1();
svc.AuthenticationHeaderValue = new WebService1.AuthenticationHeader();
svc.AuthenticationHeaderValue.UserName = "username";
svc.AuthenticationHeaderValue.Password = "password";
Try that. As I said I dont have much info on what you are trying to do so its a guess.
First of all it doesn't matter you are in MVC or any other technology.
If you can call https webservice using simple code, it will do wonders for you.
So first try calling simple HTTPS web service, google and play around it.
For learning purpose and to gain more knowledge, check these links
How to call HTTPS web service method from a .net console application?
Calling a https web service (C#)
http://support.microsoft.com/kb/901183

Using Breeze with a WebApi Service from another domain

How can I use an existing webapi service with breeze? Note that my webapi service resides at "server1/api" and the web application is at "server2". I tried changing the service name in the dataservice, but get an XMLHttpRequest Exception 101. This is a cross domain error. Is it possible to use breeze with a webapi service from another domain?
Cross-origin Breeze Apps
Yes it is possible to get the Breeze client app from one server and have that Breeze app communicate with a data service hosted on a different server.
A Breeze client app runs cross-origin quite well on a CORS-supportive browser when the service is configured for CORS.
Cross-origin issues and CORS solutions are in a more general category of web security problems. They aren't Breeze-specific. We plan to post a topic on CORS + Breeze in the "Cool Breezes" section of the Breeze web site.
UPDATE: 10 Dec 2013
This sample uses a primitive CORS implementation that we no longer recommend if you have upgraded to Web API2. Please read this excellent article "CORS Support in ASP.NET Web API 2" which explains basic CORS and how to engage Web API2 CORS support.
The rest of this answer remains as originally written.
Todo Sample with CORS
Until then, take a look at the code for the Todo Sample. The server for that sample is setup for CORS, has been deployed to todo.breezejs.com, and you can see it in action by looking at the jsFiddle at the bottom of the Breeze Todo Sample topic page.
Four points of interest:
App_Start/BreezeSimpleCorsHandler.cs does the work
App_Start/BreezeWebApiConfig.cs turns it on
// CORS enabled on this server
GlobalConfiguration.Configuration.MessageHandlers.Add(new BreezeSimpleCorsHandler());
A Web.config line you'll need for IIS7 (not needed for IIS8 or VS2012's IIS Express)
Scripts/app/dataservice.js is ready to point to a foreign server; see this line:
// * Cross origin service example *
//var serviceName = 'http://todo.breezejs.com/api/todos'; // controller in different origin
Hope that tides you over for now.

ODATA Service access on Iphone

I want to access an WCF .svc service from my iphone application. It is an ODATA based service.
the samples from the ODATA sdk for iOS shows how to create proxy classes for the database schema using normal HTTP access. But my trouble is that my service is behind an SSL layer. SO I am getting a parsing error whenever i am trying to access to generate proxy classes using the ODATAGEN library present inside the OData sdk for iOS.
Can anyone help me regarding this. I have been using the ODatasdk version v1.3.
Thanks in advance.

Resources