Allows you to configure the format of the value returned by the WINDEV SOAP server to the SOAP client program. By default, the WINDEV SOAP server returns simple data only (character string, integer, boolean, ...).
Types specific to the SOAP protocol are returned by SOAPEncodeResult to the SOAP client.
Caution: This function can only be used in a WINDEV "SOAP Server" application.
Versions 22 and later
New in version 22
RESULT SOAPEncodeResult(5, SOAPIntType)
// Same as RESULT 5 used in the code of the SOAP server.
RESULT SOAPEncodeResult(myVariable, "mytype")
Syntax
<Result> = SOAPEncodeResult(<Value to encode> , <Type> [, <Namespace> [, <Encoding style>]])
<Result>: Character string
Value encoded according to the specified parameters.
<Value to encode>: Character string (with quotes)
Value to encode according to the specified parameters.
<Type>: Constant or character string
Type of the result to return. Can be:- a character string used to specify a specific type.
- a preset SOAP type (see the notes)
<Namespace>: Optional character string (with quotes)
Namespace of the value to return.
<Encoding style>: Optional character string (with quotes)
Encoding style of the value (also called "EncodingStyle"). This parameter can correspond to any namespace defined in the WSDL.
Remarks
Returning a value from a WINDEV SOAP server to a SOAP client
By default, to return a value from a WINDEV SOAP server, the RESULT keyword can be used in the different functions of the SOAP server.
For example:
RESULT 5
RESULT "Result String"
To return specific types (other than WINDEV types), you must use
SOAPEncodeResult.
For example:
RESULT SOAPEncodeResult(5, SOAPIntType, "urn:myNameSpace")
Remark: The following code line:
SOAPEncodeResult("value", "type", "space", "style")
generates a response envelope such as:
<PROJECTNAMEResponse xmlns="namespace of PROJECTNAMEResponse" SOAP-ENV:encodingStyle="style">
<PROJECTNAMEResult xmlns:ns2="style" xsi:type="ns2:type">value</PROJECTNAMEResult>
</PROJECTNAMEResponse>
Returning a result without encoding it
SOAPEncodeResult used on a WINDEV SOAP server returns an "encoded" result. However, a string can be returned directly without being encoded. In this case, the XML string must be valid and it must contains one of the two sub-strings below:
- "xmlns:"
- </return>. In this case, the XML code must be enclosed between <return> and </return>. These tags must be removed when receiving the result.
Caution: The XML is case sensitive: only the </return> tag in lowercase characters is recognized.
On the client side, you must use
SOAPGetResult associated with the
SOAPXMLResult constant.
Preset SOAP types
The SOAP types that can be used are:
| |
Constant | Type |
---|
SOAPBase64BinaryType | Binary |
SOAPHexBinaryType | Hexadecimal binary |
SOAPBooleanType | Boolean |
SOAPStringType | Character string |
SOAPNormalizedStringType | Character string without carriage return (CR) and without tabulation (TAB) |
SOAPDecimalType | Any number without limit |
SOAPIntType | Integer included between - 2 147 483 648 and + 2 147 483 647) |
SOAPShortType | Short integer |
SOAPUnsignedShortType | Unsigned short integer |
SOAPIntegerType | Integer (no limit) |
SOAPLongType | Long integer |
SOAPUnsignedLongType | Long unsigned integer |
SOAPNegativeIntegerType | Negative integer (except 0) |
SOAPNonNegativeIntegerType | Non-negative integer |
SOAPNonPositiveIntegerType | Non-positive integer |
SOAPUnsignedIntType | Unsigned integer |
SOAPPositiveIntegerType | Positive integer (except 0) |
SOAPByteType | Byte |
SOAPUnsignedByteType | Unsigned byte |
SOAPFloatType | Real |
SOAPDoubleType | Double real |
SOAPAnyURIType | URL address |