DEV Community

Peter + AI
Peter + AI

Posted on

Understanding the SOAP Declaration in Uniface 10.4 πŸš€

This blog post was created with the assistance of AI to help explain Uniface documentation in simple terms. πŸ€–

What is the SOAP Declaration? πŸ“‘

In Uniface 10.4, the public soap declaration is a powerful keyword that makes your operations accessible to SOAP clients. Think of it as opening a door πŸšͺ - without this declaration, external SOAP clients cannot access your operation, and they'll receive an "Access denied" error instead.

Key Terms Explained πŸ“š

SOAP 🧼

SOAP stands for Simple Object Access Protocol. It's a messaging protocol that allows different software applications to communicate with each other over the internet using XML messages. Think of it as a standardized way for programs to "talk" to each other, like having a common language for computers.

Service Component πŸ—οΈ

A Service Component in Uniface is a reusable piece of code that performs specific business functions. It can be activated by different types of clients, including web browsers and SOAP applications.

WSDL πŸ“‹

WSDL (Web Services Description Language) is an XML file that describes what your web service can do - like a menu πŸ“‹ that tells clients what operations are available and how to use them. When you create a SOAP service in Uniface, it can generate a WSDL file automatically.

Basic Syntax and Usage πŸ’»

The basic syntax is simple:

operation OPERATION_NAME
public soap  ; This line makes it accessible to SOAP clients
 params
 endparams
 <... your code here ...>
end
Enter fullscreen mode Exit fullscreen mode

Real Examples from Uniface 10.4 ✨

Simple SOAP Operation

Here's a basic example of making an operation available to SOAP clients:

operation SOAP_UPDATE
public soap ;- declare accessible via SOAP channel
 params
 endparams
 <... do something ...>
end
Enter fullscreen mode Exit fullscreen mode

This operation called "SOAP_UPDATE" can now be called by any SOAP client that knows how to reach your Uniface service.

Dual Access: SOAP and Web 🌐

You can make an operation accessible to both SOAP clients and web browsers at the same time:

operation doSomething 
 public soap
 public web
 scope 
 input
 output
 endscope
 < ... do something ...>
end
Enter fullscreen mode Exit fullscreen mode

This flexibility means your operation can serve both traditional web requests and structured SOAP messages.

Where Can You Use It? 🎯

The public soap declaration can be used in three types of Uniface components:

  • Service Components - Backend services that handle business logic 🏒
  • Dynamic Server Pages (DSP) - Pages that generate content dynamically πŸ“„
  • Static Server Pages (SSP) - Pre-built pages with SOAP capabilities πŸ“‹

How It Works Behind the Scenes βš™οΈ

When you declare an operation as public soap, Uniface automatically:

  • Includes the operation in the component's interface definition πŸ“
  • Allows the service to be exported as a WSDL file for client discovery
  • Handles SOAP message parsing and response formatting πŸ”„
  • Provides proper error handling with SoapFault messages when access is denied

Security Considerations πŸ”’

Remember that operations without the public soap declaration are protected - SOAP clients cannot access them. This gives you control over which parts of your application are exposed to external systems, which is crucial for security πŸ›‘οΈ.

Integration with Enterprise Systems 🏭

SOAP-based web services are particularly popular in enterprise and business-to-business applications. The SOAP protocol provides robust error reporting and standardized communication, making it ideal for mission-critical systems that need reliable data exchange.

Best Practices πŸ’‘

  • Only declare operations as public soap that you actually want external clients to access 🎯
  • Consider using both public soap and public web for maximum flexibility πŸ”„
  • Test your SOAP services thoroughly with different client applications πŸ§ͺ
  • Document your SOAP operations clearly for other developers πŸ“–

Conclusion πŸŽ‰

The public soap declaration in Uniface 10.4 is your gateway to creating robust, enterprise-ready web services. By simply adding this declaration to your operations, you open up powerful integration possibilities while maintaining security and control over your application's interface.

Whether you're building internal APIs or external partner integrations, understanding and using the SOAP declaration effectively can help you create more connected and interoperable applications 🌐✨.

Top comments (0)