how to find language of the current session when calling odata service without passing any language - sap-cloud-sdk

We have a use case where we integrate with S4HANA Odata service using a technical user
We do not specify language anywhere while calling the service
The service returns response where some elements of response are language dependent (e.g. units)
we need to know which language was determined at S4HANA side and used for returning the elements based
on the language.
How can we identify the language of the response in cloud SDK>
Regards,
Apoorv

To my knowledge it is generally not possible to obtain the language of an S/4HANA OData service via an OData request. I recommend setting the sap-language header proactively.
There might be other means of getting the S/4HANA language set for a specific user that I am not aware of. But unless an OData service implements an endpoint for specifically the user language I believe it cannot be retrieved as part of the OData response.

Related

User Info from JWT Kogito

I understand the mechanism of OIDC in Kogito with the help of process-usertasks-with-security-oidc-quarkus example.
However, I have a question about user information. In the given example, the approved field is filled by a Query string. Is there any way to get user information in Kogito? If it doesn't have that feature, can it reflect from header to service?
The integration with the security context inside the Kogito app is something that is on the radar, see https://issues.redhat.com/browse/KOGITO-6162. That would ignore the query string and use the authenticated user. Perhaps, for now, you could create your own endpoint to retrieve the authenticated information as needed and mimic the same API call that is done in the generated endpoint.
I figure out a temporary fix that problem with help of written Custom Service when using Kogito with Quarkus.
https://quarkus.io/guides/security-jwt
JWT Injection can call from the Service layer when used with Kogito.
It is also possible to propagate user identity to other workflow items with internally tagged process variables.

Working with S4HANA extensible service - VDM approach or other way

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.

Unsupported languages in Azure AD B2C Localized Resources

I would like to know how, if possible, to add unsupported languages as a Localized Resource in Azure B2C's authentication process. At present you can only select from a predefined list of languages, but I need to add other languages, Welsh for example, as options for the user.
I understand that this feature is currently in Preview and so the functionality just might not exist.
Actually,this information in that official document may be helpful to you:
we are planning to provide an extension of this feature that allows
you to upload a JSON resource towards 'custom languages'. The feature
allows you to specify the name and language code for any language and
provide all the translations for that language. If you need this
feature, send us your scenario at aadb2cpreview#microsoft.com.
So, I think you can send your scenario to the Email address aadb2cpreview#microsoft.com. You will get help with that Extension.
Hope this helps!

Difference between platformwebservices vs ycommercewebservices

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.

Accessing Dynamics CRM 2011 data through a website using only HTML5, JS, and CSS

Looking to create a completely external portal using only HTML5, JS, and CSS to show CRM 2011 data. It does not look like I can use REST or SOAP because they cannot authenticate externally. Does anyone know how I would do this?
Thanks!
To do this, your OrganizationData.svc service would need to be externally accessible, and it would need to function without authentication (or, your authentication would need to happen within your javascript - where the end user would be able to read your source code). Either way is not a wise idea, since all of your data would be visible to the world!
If you are only dealing with internal authenticated users, read up on the oDATA endpoint.
If you want to deal with external and/or unauthenticated users, you'll need to find another way to do this that does all of the data filtering & authorization control you need.
I think we normally achieve this using a intermediary integration service. You could have a service which has access to the Org service through conventional CRM authentication, and which provides a number of methods which can be called anonymously (or by custom security) by client code.
For example, a web page calls the 'int' service's 'getContact' method, passing an email address of the user. The 'int' service validates the user's email address and then retrieves the required data from CRM's org service, using credentials stored in a config file (a CRM user with sufficient permissions to serve the 'int' service's methods). The 'int' service then parses the data and returns it to the client code - which has no knowledge of CRM's existence - perhaps as JSON for usability.

Resources