cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Web Service Factory Template

Solved
Highlighted
MEGA Partner

Web Service Factory Template

Hello, 

I am trying to use WSF Templates, and where i have succesfuly deployed, it doesn't feel to be stable. Can anyone provide more information regarding these templates, like how long does the session stays open. Do we need to dispatch or all changes automatically dispatched? How can we get rid of the session?

 

regards

8 Replies
Highlighted
MEGA

Re: Web Service Factory Template

Hello,

 

which version of the WSF template to do you use ? In which release of the platform are you ? Which language is the macro in MEGA ? Java or C# ?

 

Significant improvement have been done in V2R1 U3 CP4 and V3 CP2.

 

Be default the WSF Template :

  • Open HOPEX in single-session in private transaction
  • The dispatch is done at the end of the request
  • The MEGA process is closed at the end of the request.

 

So for every call to the end point of your REST API :

  • HOPEX is launched (spro process)
  • a session is opened
  • the macro is executed
  • the work is dispatch or discarded
  • the session is closed
  • HOPEX process is closed

 

If in your deployment opening/closing HOPEX is time consuming you can get into situation if you do several call where the calls fail because HOPEX is still closing.

 

Look at the architecture schema here : https://community.mega.com/t5/HOPEX-Store/Web-Service-Factory-Template/m-p/21388

 

Highlighted
MEGA Partner

Re: Web Service Factory Template

Hello, 

I am using V3 at this point, macro is in mega. Question is how long should the client wait before sending another request? and a new token would be required at that point?

 

regards

Imran 

Highlighted
MEGA

Re: Web Service Factory Template

The token is valid for 1h (3600s) so don't worry about this. In the latest template the session and spro stay open long enough to handle next request and avoid the problem described above.

 

Have a look at the documentation here : https://community.mega.com/t5/REST-API/bd-p/api

You may find useful behavior in terms of REST API.

 

Could you share your use case ? to see if the catalog of existing REST API fit or not ?

 

For information, we have fix a wide range of issue in V3 CP3 coming this month on managing the web service.

 

  • At installation : the API call need to be made on an dedicated application pool HOPEX API for MWASAPI and HOPEXAPI
  • At runtime : SSP need to know that this is an API call through the web service to find the proper SPRO with the MWASAPI.

I recommend you to use the latest template publish on the HOPEX Store link I provided above and use minimum V3 CP2 HF3 and even better V3 CP3.

Highlighted
MEGA Partner

Re: Web Service Factory Template

Hello, 

Procedure to run behind single sign is the same?

Highlighted
MEGA

Re: Web Service Factory Template

I assume you mean single sign on ?

 

The API need a valid bearer token. So if you are able to get a valid bearer from your SSO tool then Yes.

 

I'm no export on how to get a bearer through API with single sign on.

 

All example here will only show how to get a bearer token from MEGA own identity server (UAS).

Highlighted
MEGA Partner

Re: Web Service Factory Template

I don't believe webservice is closing the session properly after the request is complete, after two or three successful tries error is always the same "Cannot open session". Is there anyway to close the session manually, 

Highlighted
MEGA Partner

Re: Web Service Factory Template

Hello, 

The scenario is simple informatica (a third party client) will read Entity (DM) objects from mega, and write back if necessary any missing objects. I was planning to have two service methods getEntities and addEntities, to read and write back to mega, but problem here is after couple of tries error: cannot open session keeps popping up, our client might take it as defective programming on our part when it cannot connect mega at all. A web service is suppose to be always on. 

 

regards

Imran Usman Khatyan

MEGA

Re: Web Service Factory Template

In this post there is 2 threads :

 

Using the WSF Template 

 

To ensure it works :

 

Leveraging capabilities of standard REST API.

 

With V3 with provide out of the box REST API that can read and write in the repository. This REST API is based on GraphQL principle.

In your case you can leverage the schema on Information Architecture that expose Entity MD in read/write.

 

I suggest you follow our e-learning about this API.

 

Have a look at the documentation here : https://community.mega.com/t5/REST-API/bd-p/api

You may find useful behavior in terms of REST API.

 

 

With this solution it will be standard HOPEX REST API and you would not have to bother writing a custom web service.