Creating a Provided Web Service (.NET Core)
Note |
---|
If using an AMT version with a preview of CoreWCF: Open an existing Generation Set in the AMT Developer Studio and add the parameter COREWCF=TRUE. |
Follow the steps below to create a Provided Web Service.
- Create one or several routines to be used in the Provided Web Service in an existing or new Form (insertable Forms can be used as well). Return values can be passed as a function return value or in the routine parameters (by reference). Multiple return values are supported and the return values can also be structures, lists and lists of structures.
- Create a new Provided Web Service. If necessary, set the SOAP Default style and Default
use to a non-default value. Open the Operations of the Provided Web Service and perform the following
actions:
- Add one or more entries under PortType. For each PortType, set the URL to use for that
PortType of the Provided Web Service. The URL is typically:
https://<Server Name>[:<port>]/<IIS Application>/<PortType Name>.svc
Also see the page Managing Provided PortTypes.
- Select each PortType and add one Operation, or several, for that PortType. For each
Operation, select a routine from the routines created in step 1. The Routine Mappings will be automatically
filled for each created Operation. Also see the page Managing Provided Operations.
- Add one or more entries under PortType. For each PortType, set the URL to use for that
PortType of the Provided Web Service. The URL is typically:
- Generate the Provided Web Services. Generated Provided Web Services are located the application's SoapProvider directory (..\Binaries\Common\SoapProvider).
- Open the IIS Manager to create a new application pool and a new application for the Web Service (associate the application with the application pool). Point the physical path of the Provided Web Service website to point to the new SoapProvider directory.
- Recycle the Application Pool associated with the Provided Web Service in the IIS Manager.
- To be able to access the WSDL Contract, the appsettings.json file found in the
SoapProvider directory needs to be configured.
- Open the appsettings.json file.
- Find the "ServiceMetadataBehaviorConfig" section and set the property
"HttpGetEnabled" or "HttpsGetEnabled" to true:
"ServiceMetadataBehaviorConfig": {
"HttpGetEnabled": true,
"HttpsGetEnabled": false
}
Each Provided Web Service can be enabled or disabled and configured individually. Optionally, "IncludeExceptionDetailInFaults" can also be set to true for debugging purposes.
- The WSDL contract can then be accessed through the web service itself, either by browsing to the Web Service and
opening the SingleWDSL URL, or by appending the Web Service URL with ?SingleWDSL
to create the following URL:
http://<Server Name>[:<port>/<IIS Application>/<PortType Name>.svc?SingleWDSL
A local example: http://localhost/AMT-LION/PWS_NETCORE/LionScreens.svc?singleWsdl
- The Provided Web Service is now ready for use. It is also possible to first further configure the appsettings.json
file.
Note ► If Error 400 occurs when browsing a Web Service, a likely cause is that both "HttpGetEnabled" and "HttpsGetEnabled" are set to False in the appsettings.ini file. ► The AmtSoapHost will crash if the appsettings.json file contains an enabled entry with a HTTPS binding (Transport) without a valid security certificate bound to the HTTPS port in the IIS.
Logfiles are written to the App_Data\Logs subfolder of the SoapProvider folder (..\Binaries\Common\SoapProvider\App_Data\Logs)
For more detailed and advanced information concerning the configuration of a Provided Web Service, visit Configuring Provided Web Services and
its following pages.