Legacy API has been refactored in Sugar 12.0.0

This is to let all know that the Legacy API has been refactored in Sugar 12.0.0. The documentation has been carried over from Sugar 11 and is incorrect.

The file 'service/core/webservice.php' no longer exists in Sugar 12.0.0 and has been replaced with 'service/core/Webservice.php' notice that the file name is spelled differently.

Additionally, the new file service/core/Webservice.php has no concept of a "custom" directory. 

In order to get around these issues, I had to create a custom/service/core/CustomWebservice.php to look into the custom directories. 

 &  this is a bug! This is not documented in the Release Notes or the blog post

  • Hi Jeff,
    I agree there’s a problem here with the documentation and the file you mentioned.


    The functionality has been re-written from 11.2 to 11.3 to comply with Security scans and code readiness for future releases.

    Our team is considering a hotfix to rename the file to lowercase as it was before.

    Good deal you found a workaround to add your custom code to this SOAP API, however, we do not want anybody to use SOAP webservice any longer much less extending it. We have been advocating to move away from SOAP we will continue to do so until it is completely removed from our product.

    Therefore our message to the community is: Stop using SOAP.

    Sugar’s REST API is the recommended path for integrations, performant, secure and easily extendable, instructions can be found here.

    Having said that, we’ve decided to remove that Extending SOAP guide from our documentation.

    SugarCRM | Principal Developer Advocate

  •  -

    The issue is that the file, service/core/Webservice.php doesn't know to look into the "custom" directory for a new version. It only looks in the core directories. 

    The run function is currently 

       public function run(?string $requestMethod = ""): void
        {
            ob_start();
            require_once $this->webserviceImplPath;
            require $this->webservicePath;
            require $this->registryPath;
    
            $xml = require $this->rpcEncodedFile;
            $wsdl = 'data://text/plain;base64,' . base64_encode($xml);
            $service = new $this->webserviceClass($this->webserviceUrl, $wsdl);
            $service->registerClass($this->registryClass);
            $service->register();
            $service->registerImplClass($this->webserviceImplClass);
    
            SugarMetric_Manager::getInstance()->setTransactionName('soap_' . ($requestMethod));
    
            // set the service object in the global scope so that any error, if happens, can be set on this object
            global $service_object;
            $service_object = $service;
    
            $service->serve();
        }

    Notice the "require" statements.

    The first three require statements should read

            require_once get_custom_file_if_exists($this->webserviceImplPath);
            require get_custom_file_if_exists($this->webservicePath);
            require get_custom_file_if_exists($this->registryPath);
    

    The last require needs to check if a custom rpcEncodedFile exists, if not default back to the core file.

  • One further note -

    I'm in the process of migrating a customer from SuiteCRM to Sugar 12.0.0; they have a few hundred integrations that use the custom/service/v4_1_custom/rest.php integration. It's going to take them a while to migrate to the v11 API.