Espace on frontend server

Espace on frontend server

  
Hi,

How do I get the frontend server name, where a espace is running, from the system tables? What I want is to dynamically call a web service on a espace. To do that I need to get de server name where this espace is running so I can create an url to call the web service.

Thanks.

Kind regards,
Niek.
Hi Niek,

You can create an extension (example in attachment) method with the following code:

public void MssGetFrontendServerName(out string ssName) {
            ssName = AppInfo.GetAppInfo().FrontendName;
}

On the request you just need to call this action to get the server where the request is being served.

hope it helps,

regards,
Hélio
Hi Hélio,

Thanks for your comment!
 
Sorry, it’s not clear to me if this would work.
 
In production:
I have an espace that is running on server A that esapce should call a web service on server A and/or B and/or C depending on where this web service is hosted. What I want to do is build the url for the web service dynamically depending on what or all server(s) the web service is running. So I don’t think your code is going to work. Is there another solution?
 
Kind regards,
Niek.
Hi Niek,

So it seems you have to do it through the database. Do you have your eSpaces separated in zones?
You can look at the following system tables (you can add the reference) :

Server (frontend), Zone, ZoneServer, and eSpace (which has a zone Id)

This way you can see in which Server the eSpace is running. Then you can use the action SetWebReferenceURL (in EnhancedWebReferences system extension) to change the WebService address before calling it.

Will this help you?

regards,
Hélio