Improvements to Web Services

Unofficial Content

The GeneXus X version includes new functionalities both to provide and consume services.

Providing web services

- XML Information Properties: There is a set of properties of SDT items that enhance the visual representation of the SDT with XML. This directly affects the provided services that return an SDT with these characteristics. For more details, please refer to Xml Information property
- A web service can be defined from the specification of a Data Provider. For more details, please refer to Data Provider (Output)
- A variable or blob attribute can be returned as a parameter of a web service.
The Base 64 of the file is returned (in previous versions the file path was returned, which made it unusable). It is important to note that this functionality is very restricted and cannot be considered as an implementation of binary file management; it doesn't compress data, and large-size files will negatively affect performance. Implementation is similar to using the &Blob.ToBase64String()function. When consuming a service with these characteristics, the &Blob.FromBase64String(&ContentBase64)function can be used. For more details, read Blobs in Base64

Consuming web services

-The most important change is the new "External Object" data type, which allows centralizing all the service information (as well as language-native objects and stored procedures). This directly impacts usability, since centralizing the object information, for example, simplifies the prototyping tasks, avoiding the use of location (XML or data type) and modifying the properties within the same external object.
For more details, read the External Object WSDL documentation
- Collection Serialization. This property of SDT collections (defined inside an SDT) allows setting its XML representation. This is necessary for some services that are more restrictive regarding the message to be sent. It means that if you have a collection of Cities inside the Customer structured data type, it could be serialized as follows (Wrapped):

     <Country>
         <Cities>
             <CityName>Montevideo</CityName>
             <CityName>Maldonado</CityName>
            ...
         </Cities>
      </Country>

OR as(Sequence):


   <Country>
     <CityName>Montevideo</CityName>
    <CityName>Maldonado</CityName>
    ...
   </Country>

For more information refer to Structured Data Type Editor

Compatibility

When converting a KB from a previous version, the relevant WSDL EOs will be created; and that's all you’ll need to do.

Converting the knowledge base is the recommended way to migrate an application which consumes web services to the newest GeneXus version.
However, another possibility is to import an xpz file which was developed in GeneXus 9.0. In this case, it is necessary to rename the External object Name as it was defined in GeneXus 9.0.
You can see the details in the following sample:
There is a web service described in http://localhost/services/aprc01.aspx?wsdl
This service is consumed in another knowledge base (GeneXus 9.0), with the following code:
&outval = &ws.Execute(&inval)
The ws variable is based on the Namespace.aprc01 data type.

This code is exported as GXW.xpz.

In order to import to GeneXus X, you can follow the steps below:
1. Open the GeneXus X version and execute Tool/Application Integration/WSDL import
2. After including the URL (http://localhost/services/aprc01.aspx?wsdl), the following object name will be suggested: aprc01
3. Replace this value with Namespace_aprc01
4. Finish the wizard, and Import the GXW.xpz file.