How to Get the Safe X3 Java Bridge Host and Port values

By | May 5, 2012

The Safe X3 Java Bridge provides the ability to add technical functionalities to the X3 platform, it also plays a very important role in integrating Sage ERP X3 with external systems. What can be done using Safe X3 Java Bridge Server, well almost everything that can be done in Java and Visual Studio.Net.

The below function will get the Safe X3 Java Bridge Server information from within Sage X3

Local Char WTARGET (128)
#Get Java Server Name
Call GETJAVSRV(GINSTID,WTARGET)
End
Subprog GETJAVSRV(ASOLNAME,AJAVASRV)
Value Char ASOLNAME
Variable Char AJAVASRV()
Local Char WHOST(200) : WHOST = “”
Local Integer WPORT : WPORT = 0
Local Char VPROP(200)
Local Integer OK
Local Char WTARGET (128)
# Find the value of the property in Solution.xml
# OK=0 value found
#   =1 property not found
#   =2 solution file not found
#   =3 Error reading file
# Search the value of the property “component.serverjava.servername” in Solution.xml
Call RECHPROP(“component.serverjava.servername”,VPROP,OK) From INTRUTILA
If OK = 0
WHOST = VPROP
Endif
# Search the value of property “all.host.port” in Solution.xml
Call RECHPROP(“all.host.port”,VPROP,OK) From INTRUTILA
If OK = 0
WPORT = val(VPROP)
Endif
If WHOST <> “” and WPORT <> 0
Onerrgo GETJAVSRVERR
#The use of SRVEXISTS function may impact performance
Local Integer WEXISTS
WEXISTS = func SRVEXISTS(WHOST,WPORT)
If WEXISTS=1
AJAVASRV  = WHOST
AJAVASRV += “:”
AJAVASRV += num$(WPORT)
Endif
Endif
End
$GETJAVSRVERR
End
$GETJAVSRVEND
End
#——————————————————————-
#
# Function test for the existence of a server
#
#——————————————————————-
Funprog SRVEXISTS(AHOST,APORT)
Value Char AHOST()
Value Integer APORT
Local Integer WOPEN
[L]WOPEN =-1 :# ni 0, ni 1 !!!
Onerrgo EXISTSERR
# generates an error “27” if unknown host or if the port is not open
Opsock [L]AHOST,[L]APORT Using [TSTB] # test si il y a eu une erreur
If [L]WOPEN=0 : Goto EXISTSEND : Endif
# Wait for Closure after a second
Sleep(1)
Opsock [L]AHOST,0 Using [TSTB] # Wait for the closure is effective after 2 to 3 seconds!
Sleep(2)
[L]WOPEN =1
Goto EXISTSEND
$EXISTSERR
[L]WOPEN =0
Resume:# Block error is necessarily confined by a “Resume”
$EXISTSEND
# To delete the error of disconnection
Onerrgo
End [L]WOPEN

About Us
Greytrix – a globally recognized Premier Sage Gold Development Partner is a one-stop solution provider for Sage ERP and Sage CRM needs. Being recognized and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development and implementation expertise.

Greytrix caters to a wide range of Sage Enterprise Management (Sage X3) offerings – a Sage Business Cloud Solution. Our unique GUMU™ integrations include Sage Enterprise Management (Sage X3) for Sage CRMSalesforce.com and Magento eCommerce along with Implementation and Technical Support worldwide for Sage Enterprise Management (Sage X3). Currently we are Sage Enterprise Management Implementation Partner in East Africa, Middles East, Australia, Asia. We also offer best-in-class Sage X3 customization and development services, integrated applications such as POS | WMS | Payment Gateway | Shipping System | Business Intelligence | eCommerce and have developed add-ons such as Catch – Weight  and Letter of Credit for Sage Enterprise Management to Sage business partners, end users and Sage PSG worldwide.

Greytrix is a recognized Sage Rockstar ISV Partner for GUMU™ Sage Enterprise Management – Sage CRM integration also listed on Sage Marketplace; GUMU™ integration for Sage Enterprise Management – Salesforce is a 5-star app listed on Salesforce AppExchange.

For more information on Sage X3 Integration and Services, please contact us at x3@greytrix.com. We will be glad to assist you.