How Do I Configure Magic xpi as a Web Services Consumer? (Magic xpi 3.x)
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 service to the flow area, but do not configure it (click OK).
-
Drag the Web Services service into the flow area as the child of the Data Mapper step. The Component Properties dialog box opens.
-
Click the Configuration button, select the resource that you created earlier, and then define an 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.
-
Return to the Data Mapper step, and select Configuration from its context menu.
-
Create a new XML Destination, and click Properties.
-
Select the following XSD file entry: tempuri_org_.xsd. This file is found under the <Magic xpi>\Projects\<ProjectName>\resources\<ServiceName>.
-
Select the F.OUT flow variable as the data Destination.
-
Select GetCapitalCity as the XML root.
-
Click OK to close the Destination configuration dialog box, and click Map to open the Data Mapper screen.
-
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 the OK buttons until you exit the Data Mapper.
-
Drag a Save Message service 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).
|
|