This topic explains how to create virtual assets from a WSDL or XML Schema.
Virtualize can construct virtual assets for a service by analyzing its definition file. It automatically generates Message Responders for the operations and fault messages defined in the WSDL or XML schema and populates those tools with the appropriate messages.
This is especially helpful if the service you want to virtualize is not available for live recording, but you have access to a definition file that describes it.
There are two main steps involved in virtualizing the application behavior from a definition file:
- Creating Message Responders from that definition file.
- Deploying those Message Responders.
Creating Message Responders from a Definition File
To automatically create Message Responders from a WSDL or XML schema file:
- Choose the SOA> WSDL or SOA> XML Schema option in one of the available project/.pva/Responder suite creation wizards.
- For details on accessing the wizards, see Adding Projects, Virtual Assets, and Responder Suites.
- Complete the WSDL/XML Schema wizard. Be sure to specify the appropriate WSDL or XML Schema location.
Virtualize will then create Message Responders for the defined operations and fault messages. You can then use the available controls to specify the response messages. For more details about reviewing and customizing the options in the tools that are created, see Message Responder Overview.
When using schemas, it is helpful to have a sample request message that correlates with the response message you are configuring. Paste this sample request into the Options > Request Template> Request Message Template area (in literal view). This makes it easier to configure Responder and Data Source Correlations.
Deploying the Virtual Assets
If the .pva is created directly in the VirtualAssets project, it will be deployed automatically. Otherwise, the simplest way to deploy the virtual asset is to copy the containing .pva file into the VirtualAssets project.
Alternatively, you could right-click the Virtualize Server view’s Local machine node, choose Add Virtual Asset, specify the .pva file that includes the virtual assets you want to deploy, then click Finish. When the wizard completes, Virtualize will automatically copy the .pva file to the VirtualAssets project.
For a more detailed discussion of deployment procedures and options, see Deploying Virtual Assets.
Customizing the Virtual Assets
For details on how to customize the Message Responder’s behavior, see Message Responder Overview.
Reviewing and Customizing SOAP Fault Messages
If you create virtual assets from a WSDL, Virtualize generates Message Responders for any custom SOAP Fault responses that are defined for WSDL operations, as well as a single generic Fault response without a type specified in the detail/Detail element (i.e. a schema "xsd:any" type).
These WSDL fault messages can be viewed and customized in the Message Responder’s Response tab. To see a specific fault message, select it from Operation.
The SOAP fault differs across SOAP versions; as a result, if you change the SOAP version (under the Service Options> SOAP version area or in the Virtualize preferences), the SOAP Fault format will change.
SOAP 1.2 Example
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Body> <Fault xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <faultcode xmlns=""></faultcode> <faultstring xmlns=""></faultstring> <detail xmlns=""> <ns1:exception xmlns:ns1="http://www.themindelectric.com/exceptions/"></ns1:exception> </detail> </Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
SOAP 1.1 Example
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Body> <confirmResponse xmlns="http://www.parasoft.com/wsdl/store-01/"> <Result>true</Result> </confirmResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
Video Tutorial: Creating a Virtual Asset from WSDL
This video describes how to create a virtual asset from a WSDL service description.