How Do I Consume a WCF Web Service? (Magic xpa 3.x)
By using Windows Communication Foundation (WCF), you can create a service that exposes a Web endpoint. This provides easy and secure access and consumption to a large library of services based on this worldwide standard. You do this in Magic xpa by creating a component.
-
From the Project menu, select CRR.
-
Open a new line (F4) and from the Type column, select WCF.
-
Zoom (F5) and if a component was not selected, the WCF Component box opens. In this box, enter the service endpoint URL that the Web services step calls. For example, http://www.dataaccess.com/webservicesserver/textcasing.wso?WSDL.
If a component was already loaded, its property sheet opens.
After you have defined the web service, you can use it in the same way you use any other .NET component.
For example, for this web service, you can write a program with a Verify operation using one of the following expressions:
DotNet.TextCasingSoapTypeClient().InvertStringCase('My String')
Or
DotNet.TextCasingSoapTypeClient('TextCasingSoap').InvertStringCase('My String')
After executing the program, you will see a message box with the result text of: mY sTRING.
Note: When consuming a WCF service configured to use Windows authentication, after importing the WCF Consumer project export (created on another machine), you need to either reload the component or change the machine name in the userPrincipalName property in the WCFClientModules\system.servicemodel.client.config file. This is required because when the WCF component is generated, it creates a configuration specific to the machine (the logged on user when Windows authentication is used) and this configuration is not changed when you import a project or a WCF component.
How Do I Consume a Web Service with Faults Using WCF?