SOAPUI Chinese operation Manual (vii)----WEB Service Sample Project

Source: Internet
Author: User
Tags soapui

Rest Inference

This short tutorial will guide you through the architecture inference function.

We will create a new project and add a rest service, and the initial WADL file is started.

Once the request is sent, we can use the response to build our schema.

Demo Request

to demonstrate the principles, we will take a demo from a An example of Flickr's rest .

https://www.flickr.com/services/rest/?method=flickr.test.echo&format=rest&foo=bar&api_key= D6c7b624b138bcb07a2e2c736aefeb65

The request (when successful) returns the following response in this format:

<RSP stat= "OK" >    <method>flickr.test.echo</method>    <format>rest</format>    <foo>bar</foo>    <API_KEY>9E5F204388E9D6070B6B1423876BE728</API_KEY></RSP >

NOTE: The main changes to the API, so you may need to visit Flickr's Rest demo site and get an up-to-date API key.

Create Projects and services

Get very easy to request to a rest project:

    • Open file menu
    • Select a new rest project

In the Create Rest Project window, open:

    • Copy and previous URLs into the area

    • Click OK

The project is created and added to the workspace:

The URL from the requested parameter is automatically extracted and can be viewed in the editor.

Requests and responses

Now we initiate the request:

The request contains all the parameters that are defined in it. Parameters are pre-populated with default values.

We have not yet sent the request, so the response is blank:

Schema tab

The rest of the reaction looks at the label with the so-called "architecture" at the bottom. This is the inference schema checker.

    • Open the Schemas tab

No information has been logged yet.

In general, we want to automate the process of conflict resolution. But for demonstration purposes, this time we will take the manual:

    • Make sure that automatic parsing is disabled.
Get response
    • Click Run

The request is sent, and we get a response:

NOTE: The main changes to the API, so you may need to visit Flickr's Rest demo site and get an up-to-date API key.

The Schema tab has changed to indicate that the schema conflicts have occurred:

This means that the analysis of the reaction shows that there is a conflict between the current response and the previously inferred pattern.

    • Turn on schema checking

Now we can resolve the conflict manually.

    • Click Resolve Conflict

For each conflict detected, we get a notification and can act as needed.

In this case, we can assume that all conflicts should be resolved (again, without the previous pattern).

    • Click Yes (yes) all *

All conflicts are then automatically resolved and logged in the log mode:

Inference schema

When all conflicts have been resolved, the schema is added on the Schema tab:

So far, we can see a namespace and have an XSD schema associated with it. As a schema based on only one response, we can optimize it with a few more requests. We should try to change the response so that they are as different as possible. For example, we can issue an invalid request so that we can infer a schema failure, or make a query request that returns an empty result set, and so on.

Add definition

More responses can be automatically added to the schema by simply sending different requests. Since we can assume that the reaction will be effective, we can use the "auto-resolve" function.

    • Return to conflict tab

    • Make sure that automatic resolution is enabled.
Different requests

In order to get a different response, we need to change the requirements:

    • Delete API_KEY value

This will ensure that we get an error response.

    • Click Run

The request is sent, and we get a response:

This time, because a conflict has been resolved and automatically recorded:

Update mode

When all conflicts are resolved, the new response is included in the Schema tab:

The new response has been included in the schema:

before after

Now you can continue to modify the requirements and build your own patterns.

SOAPUI Chinese operation Manual (vii)----WEB Service Sample Project

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.