How Do I Access a Web Service? (Magic xpa 2.x)

« Go Back


Created ByKnowledge Migration User
Approval Process StatusPublished

How Do I Access a Web Service? (Magic xpa 2.x)

Web services are described in a special XML file called a WSDL (Web Service Description Language). The WSDL document describes the service, including the structure of the input and output. In order to access a Web service, you must first find its WSDL entry, which will generally be a URL on the Web. To access a Web service from Magic xpa, you need to define a SOAP entry in the Services section and load the service WSDL. When the WSDL is loaded, a client module (JAR file) is generated and optionally XML schemas are generated as well.

Creating a Web Service Client Entry

  1. Go to Options->Settings->Services.

  2. Press F4 (or Edit->Create Line) to open up a line.

  3. Give your web service a name. In our example, we used CountryInfo.

  4. In the Server column, zoom to select SOAP.

  5. Press Alt+Enter to access the Server properties.

  6. In the WSDL URL field, enter the URL of the WSDL you are accessing. The Client Module field will fill in automatically.

  7. Click the Load button. It will take a few moments for Magic xpa to create the Client Module and XML Schema files.

Also in Service Properties, you can set up attachment encoding type, and the security settings to be used.

Accessing the Web Service

Once the Web service is defined, you can access it easily from within Magic xpa.

  1. Press F4 (Edit->Create Line) to open up a line.

  2. Press I to select the Invoke operation. The cursor will move to the next field.

  3. Web service will be selected by default. Tab to the next field.

  4. Go to the Properties pane (Alt+Enter).

  5. Zoom from the Service field to select the service you want. In our example, that is CountryInfo.

  6. Zoom from the Operation field to select which Web Service operation you want to access.

  7. Zoom from the Fault field to select a variable (Blob or Alpha) to hold the error code description (if the operation completes successfully the variable will have an empty value).

  8. Zoom from the Arguments field to set up the arguments for this Web service. The exact argument list will vary depending on the Web service, but Magic xpa will display a list of what the Web service expects. Often the argument will be a complex type argument represented as XML document, in which case the location of the XML Schema location will be listed.

  9. Zoom from the Return value field to specify a variable for the Returned value from the Web service.

That is all there is to it! If the Web service uses complex input or output, you will need to put together the XML Blob for the Arguments and/or Return value.