· Jan 10, 2023

SOAP business service is not functioning correctly with session enabled and customized business dispatch name

Currently we have an SOAP bussiness service "Calculator" in production and this "Calculator" service has following settings:

  • Service class: CustomPackage.Calculator (Extends EnsLib.SOAP.Service)
  • Service name: "Calculator"
  • Basic settings -- Port 8088
Class DemoPackage.Caculator.CalculatorService Extends EnsLib.SOAP.Service

Parameter ADAPTER = "EnsLib.SOAP.InboundAdapter";

Parameter SERVICENAME = "CalculatorService";

Parameter NAMESPACE = "";

Parameter SOAPSESSION = 1;

Method Init() [ WebMethod ]
    IF '$G(%session) 
        $$$TRACE("%session is undefined")
        $$$TRACE("NewSession: "_$CASE($ISOBJECT(%session), 1:"True", 0:"False"))
        Set %session.Data("value") = 0

Currently, when we call Init method as shown above on http://localhost:8088/Calculator, we got "%session is undefined" logged.

Product version: IRIS 2022.2
$ZV: IRIS for Windows (x86-64) 2022.2 (Build 368U) Fri Oct 21 2022 16:44:33 EDT
Discussion (2)3
Log in or sign up to continue

If you use custom port there is no session, that's expected/by design.

A session (%session) is a %CSP.Session object that is available only when the SOAP service uses a standard request via a properly configured web server (apache, IIS, other), to configure it check the "EnableStandardRequests" setting in the Business Service, configure the Web Application and the web server (or use default namespace Web Application), then invoke the service via the web server port.

In my experience I prefer to use standard request via web server, in general there is no need or valid reason (I can think of) to use custom port, unless you need something very specific, for example you don't have a web server ( SMP, something very unusual...).