Can I get JSM's port number like "document.location.host"

Use this Forum to post your “How to …” questions about your use of aXes. This is not a technical support forum. Both the aXes Support Team at LANSA and other aXes customers may answer your questions. LANSA cannot guarantee the accuracy of any information posted by customers.

Moderator: jeanmichel

Post Reply
Fairdinkum
Posts: 128
Joined: 24 Jul 2017, 17:02

Can I get JSM's port number like "document.location.host"

Post by Fairdinkum »

Hello,

I really need to know how to get the port number of JSM server which a session runs in order that making it easier to manage several JSM servers.

For example:
I use the script shown below.
--------------------------------------------------------------------
var ip = document.location.host.split(":")[0];

var id = FIELDS("G1001").getValue().trim();
if ( id === "" || id === null ){
alert("Enter the Product Code Please.");
}else{
var config =
{
serverUrl: "http://" + ip + ":5563/service/longreach.jsp",
credential: {user:"lansa", password:"lansa"}
};
LONGRANGE.FileTransfer.setDefaultConfig(config);
.......
--------------------------------------------------------------------

In this case, the port number "5563" in the above code has to be changed whenever it is changed in httpd.xml.

If the port number in the code becomes a variable, it would be much better.

Does anyone know that?

Thanks for your help.

Best Regards,
Hidekazu Tanaka
Fairdinkum
Posts: 128
Joined: 24 Jul 2017, 17:02

Re: Can I get JSM's port number like "document.location.host"

Post by Fairdinkum »

Finally, I was able to get the JSM port number using the following code:
--------------------------------------------------------
$(function() {
$.ajax({
type:'GET',
url:'/jsm/axinfo.json',
dataType:'json',
async: false,
success: function(res){
console.log(JSON.stringify(res));
alert( "SFM Port=" + res.sfm.port);
},
error:function(){console.log("failed...");}
});
});
--------------------------------------------------------

Thank you so much Alick and Frank :D
Attachments
getJsmPort.png
getJsmPort.png (109.95 KiB) Viewed 4233 times
Post Reply