How Do I Configure Magic xpi as a Web Services Consumer? (Magic xpi 4.5)
The Magic xpi Web services consumer can access external Web services providers on the Internet or Intranet.
Follow these steps to access a Countries Demo Web service using the service's WSDL URL.
-
Create a new project or a new flow.
-
Define a new Web Service Client resource.
-
Enter the following value in the WSDL URL field: http://mui.magicsoftware.com/eDevCountriesDemo/Service1.asmx?WSDL
-
Click Configure to load the WSDL.
-
Define the following flow variables:
|
|
|
|
F.Result
|
BLOB
|
|
|
F.OUT
|
BLOB
|
|
|
F.Fault
|
BLOB
|
|
|
F.CountrySymbol
|
Alpha
|
2
|
US
|
-
Drag a Data Mapper utility to the flow area.
-
Drag the Web Services utility into the flow area as the child of the Data Mapper step.
-
Double-click or right-click on the Web Services utility and select Configuration from the context menu to open the Web Services Configuration dialog box.
-
Select the operation called GetCapitalCity.
-
Select F.OUT for the GetCapitalCity parameter, F.Result for the GetCapitalCityResponse parameter, and F.Fault for the Fault parameter (at the bottom left of the screen). Then click OK.
-
Double-click or right-click on the Data Mapper step and select Configuration from the context menu to open the Data Mapper window.
-
From the Toolbox's Mapper Schemas section, drag an XML type into the Destination area of the Data Mapper window.
-
In the XML Source's Properties pane, select the following XSD file entry: tempuri_org_.xsd. This file is found under the <Magic xpi>\Projects\<ProjectName>\resources\<ServiceName> folder.
-
Select the F.OUT flow variable as the data Destination.
-
Select GetCapitalCity as the XML root.
-
Click Save.
-
In the Data Mapper Destination pane, fully expand the tree to expose the cSymbol element.
-
Double-click on the cSymbol element, and select the F.CountrySymbol as the calculated value.
-
Click Save.
-
Drag a Save Message utility into the flow.
-
In the Message parameter, enter WS call result.
-
In the BLOB parameter, select the F.Result variable.
-
In the File Extension parameter, enter xml. The consumer flow should be set to AutoStart.
-
Save the project. The project should look like this.
-
Run the flow using the Debugger or Server.
Note:
|
-
If the Web service invocation fails, the variable mapped to the Fault (F.Fault) will be populated with the Fault response.
-
The XML result from the Web service call should be parsed using the Data Mapper, and with the same XSD used for the request. However, you should use the GetCapitalCityResponse root.
-
You should populate the F.CountrySymbol with the required country symbol before the first Data Mapper step (the default is US).
|