Currently we consume an S4HANA odata service in SCP using cloud sdk.
As recommended , We currently use VDM generation approach to generate VDM class.
Now we identified that the S4HANA ODATA service is extendable.
customers extend the service and adds new attributes to the entry.
We need to bring the extended attributes and process them through our business logic and place
them on SCP data base
Please share guideline for this. How to achieve this?
Since VDM generation is design time activity, we are not able to influence it at runtime as
ours is multitenant SCP application and S4HANA service is extended by some customers based on their individual requirements
Thanks
Apoorv
For the purpose of accessing extended attributes of S/4HANA OData service, you can make use of the accessors(getters and settors) on customFields available on the VdmEntity. Here is an example:
final List<BusinessPartner> businessPartnerList =
new DefaultBusinessPartnerService().getAllBusinessPartner().execute(destination);
final Set<String> customfieldNames = businessPartnerList.get(0).getCustomFieldNames();
for( BusinessPartner bp : businessPartnerList ) {
customfieldNames.forEach(s -> bp.getCustomField(s));
}
To set a value to a custom field, use for e.g:
businessPartnerList.get(0).setCustomField("ShoeSize",9);
You can read more about it in this tutorial.
Related
Guidewire Policy Center 10.2 self managed. I'd like to create and quote submission for auto policy line.
Is there a rest api for submission creation exposed via the policy center? Based on the documentation I've an impression it should be there but swagger ui doesn't show related api
I found only soap based web service. Now coming to submission api I see it's very generic, it looks policyPeriodData should be a raw xml that contains all the data about drivers, vehicles etc. How can I get such template in an easy way?
Edit:
Using gosu scratchpad I was able to generate sample xml for policy period
var pp = new gw.webservice.pc.pc1000.gxmodel.policyperiodmodel.PolicyPeriod(pd) print(pp.asUTFString())
it contains drivers data but I don't see any api how to pass vehicles data
We have a custom OData Service. The service url is as below:
https://host:port/sap/opu/odata/sap/ZAPI_TRANSFERPRICE_CONDTYPE_SRV/$metadata
It can return all the price conditions by accessing the following URL:
https://host:port/sap/opu/odata/sap/ZAPI_TRANSFERPRICE_CONDTYPE_SRV/TransferPriceCondition
After the service classes are generated based on the metadata of this service. The getAll method is not generated.
I am not sure if something is required in the OData service.
SAP Cloud SDK Version is 3.7.0.
The getAll() method is disabled explicitly by setting sap:addressable="false" for the entity which is the case in the EDMX file you provided.
generally speaking when using the OData client generator, there will/should be a getAll method if your service does not explicitly forbid it. Can you share the metadata (edmx) file of that service so that we can reproduce the issue? Otherwise it's impossible to guess where the problem comes from.
I want to publish my API, but I want to limit so users can only execute in sandbox environment (I want to limit production to specific user/customers with specific agreement).
This is a basic functionality in other API managers, but I don't find how to do in WSO2.
I have found this article in Medium, and also noticed that when I create an aplication, a couple of new roles are created (Application/user_application_SANDBOX and Application/user_application_PRODUCTION), but I don't find how to use them.
Deep dive in doc doesn't helped me.
Option 1:
You can use application registration workflow to control key generation for production and sandbox, by sending it through an approval process.
If you want to automate it based on a property or something, you can write a custom workflow extension.
However, this is applied to applications but not to APIs. That means if you allow generating prod keys for an application, all APIs, that the application has subscribed to, are accessible with prod keys.
Option2:
If you want to do this in API level, you can write a custom mediation sequence. Within the custom sequence, you can read the key type (i.e. production or sandbox), subscriber, enduser (if required) etc. and decide whether you want to allow the request or not.
What is the ideal scenario to use platformwebservices and ycommercewebservices, and what is the difference between the two.
Platformwebservices
provide secure CRUD access to all models in the service layer over a well understood and widely adopted protocol.
A secured RESTful access to all Hybris models, when you create or update an item the platform web services will generate / update the API for you.It's accessible from '/ws410'. You do not need to change anything within this extension.
Ycommercewebservices
exposes part of the Commerce Facades as REST-based web services, including calls for product search and product details. The focus is to provide a working example of how a REST-based API can be exposed.
First it's a template, as it starts with 'Y' so to create your own you need to run 'ant extgen'. It will provide you RESTful access to few out of the box Facades. Up to you to add more Facades or update the existing one.
for OCC implementations use CommerceWebservices. PlatformWebservices are for doing basic CRUD operations and it completely bypasses the business logic .
So if you want to leverage any hybris provided business logic and don't want to write your own logic for example cart management CommerceWebservices is the recommended way.
I am new to ASP.NET MVC 5 and OWIN.
I have upgraded my project to MVC 5 to implement the authentication and authorization of my project. Problem is that my project does not store the user data. When user logins in I ask a different system via a WCF service to tell me if the user is authenticated. So I do not have a database nor tables that the user is stored in.
But I want to add the ability to login via social providers using OWIN. For this I will add a local database table to store the social provider Id/Token
Looking around other have asked similar question but only when they want to change database type store... Whilst I actually don't store the data... Is it still possible to customize this with ASP.NET Identity and how would I do this?
I would recommend creating a custom IUserStore that connects to the wcf service.
http://www.asp.net/identity/overview/extensibility/overview-of-custom-storage-providers-for-aspnet-identity
If you don't want to implement your own IUserStore, you can still use the built in default EF based UserStore and just only use the external login apis. The database schema will have a bunch of columns that will always be null like PasswordHash etc, but the operations you care about would still work fine:
CreateAsync(TUser) - Create a user
AddLoginAsync(userId, UserLoginInfo) - Associate an external login
FindAsync(UserLoginInfo) - Return the user with the associated external login
I looked into the solutions suggested. I found that the method names of the interfaces to implement did not really fit and there where way too many methods as well.
I ended up only using the OWIN Context in AccountController to extract the LoginInfo with all the details I wanted. This way I did not have to implement any custom versions of IUserLoginStore etc...
I wanted the simplest solution to implement and therefore I ended up with:
1. Added StartupAuth class from template mvc project and configured different providers there
1. In AccountController: Extracted the claims from LoginInfo,
2. Stored OpenId in a table for lookup and then continued on as before.
You have to provide a UserStore and pass it to the UserManager, if you are already using entityframework in the default mvc5 project, you can write your CustomUserStore which inherits from Microsoft.AspNet.Identity.EntityFramework.UserStore and override the methods defined in Microsoft.AspNet.Identity.EntityFramework.IUserLoginStore:
public interface IUserLoginStore<TUser, in TKey> : IUserStore<TUser, TKey>, IDisposable where TUser : class, Microsoft.AspNet.Identity.IUser<TKey>
{
Task AddLoginAsync(TUser user, UserLoginInfo login);
Task<TUser> FindAsync(UserLoginInfo login);
Task<Collections.Generic.IList<UserLoginInfo>> GetLoginsAsync(TUser user);
Task RemoveLoginAsync(TUser user, UserLoginInfo login);
}
if you don't use entityframework, you have to provide your own way of accessing your database,by writing a UserStore which implements IUserStore, IUserLoginStore, IUserClaimStore, IUserRoleStore,IUserPasswordStore,IUserSecurityStampStore (depends on your need but at least IUserStore and IUserLoginStore as IUserStore is mandatory and IUserLoginStore is what you want to add)
all these interfaces are in Microsoft.AspNet.Identity namespace.
here how to implement a Custom MySQL ASP.NET Identity Storage Provider and
here how to use Dapper ORM instead of EntityFramwework.