Site Properties
Question

Hi Everyone,

I am developing my first proper reactive app, this app consumes the SOAP services. One of the requirement of the app was that I should make sure that the end point for the SOAP services be dynamic instead of static (WSDL). I manage to find this example (https://success.outsystems.com/Documentation/11/Extensibility_and_Integration/SOAP/Consuming_SOAP_Web_Services/Use_Advanced_Extensibility/Example%3A_Change_service_endpoint_at_runtime) to achieve the dynamic end point.

Now the issue is that once the dynamic part is generated inside the app then it needs to pass to the "OnBeforeRequestAdvanced" of the SOAP service. The only way (Please correct me if I am wrong) to pass the dynamic end point to the "OnBeforeRequestAdvanced" is to use site properties variable. 

My concern is that site properties is used by all the instances of the app at the same time, so if let's say two or more than 2 clients are using the app and their session of the app trying to change the values of the site properties at the same time then the outcome for the clients will be unpredictable.

How to make sure that the multiple users are not going to run into this situation. I am thinking of creating multiple site properties (this option will reduce the probability, but not remove the issue). Can I have any advice from anyone? Thanking in advance.

Hello Badar Nasir,

You can use Client Variables where each user has their own, it is simpler.

Client Variables Reset on default at logout or if login expires.

I hope this can help you.

Best regards.

Hi,

If that value is processed in runtime (the endpoint) you can have an action to process the URL based in the logged user Id and use the result for the endpoint.

If it's something that can be stored, (I don't know all the use case) I don't know if store the endpoint in the database can be the solution (for a given UserId, have the corrspondent endpoint) and then get that value from there. 

Hope this can help.


Best regards,

Ricardo Pereira

Hi Douglas,

Thanks for you suggestion, I think I mentioned in my post that the OnBeforerequestAdvance does not access the session variable, so unfortunately unable to use your method. But if you think of something else then please share it with me.

Hi Ricardo,

Thanks for your suggestion, I am not using user entity. Even if somehow I mange to glue the user entity with end point then I am not sure how can I get the value of the end point from the user entity. See what option I get in the expression window when try to assign endpoint.

I am open for suggestions, thanks.

20210923140829AssignSite.SOAPSendEndPointAddressValue.png

Hi Badar,

You can use GetUserId() in OnBeforerequestAdvance. So, you can store your dynamic data in db while it is related to the user or user-related table and you do whatever you want in the OnBeforerequestAdvance.

Sincerely,

Necmettin

Some extra info: using site properties for data that changes constantly is a very bad idea. See Best practices

Hi Tim,

I agree with you that using site properties is not best practice, but should there be not an alternative? That's what I am looking for.

Thanks for your advice

The scope inside that onBeforeRequestAdvanced is faily limited, but it is possible to use a function and you do have access to the GetUserId(). So based on the userid, you could query for a specific url.  And technically you could just return the value of a client variable through a function. 

Hi Tim, as I am not creating user accounts for this app so I don't see if I can use this idea. But thanks for your input. Please let me know if you come up with something else, thanks.

If you don't have named users, on what is the choice of url based? So, when should it take URL1 and when should it take URL2 ?


Hi Tim, the URL are basically scanned in using a QR code and stored in local storage of the device. So if 100 devices are using the app at the same time then they have their individual URL stored locally. The site properties are used to set the destination URL just before the soap call is made.

My worry is if 2 devices are using the app at the same time then both might try to set the destination URL using site properties at the same time.

I was thinking that my problem could be resolved using the JS global variables that could be manipulated based on session but only problem is that my JS skills are no way near this level.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.