WSDL file generation

Source: Internet
Author: User
Tags soapui wsdl

1. Background

Have the web development of readers, believe that what is b/s structure and not unfamiliar. In the B/s structure, the application logic is fully implemented in the application server, the user performance is fully implemented on the Web server, the client only needs the browser to do business processing. Yes, the client is generally operated through a browser. But with the development of science and technology, we now want to access the application of the server, not only can use the browser, can also use POS, ATMs, and other machines. With these tools that are not browsers, the biggest headache in development is how to test. Always can not, really use POS machine to test it, but the test price is OK, feasible; What if the ATM machine? What should I do then? So, we need to use other tools to help with testing. I know that is soapui tools, this is the author in the work of the test tools to use. However, the author is curious, Soapui is the work of it? That is, the customer initiated a transaction, through the SOAPUI (assuming) how to enter the system backend? With such doubts we entered today's blog.


2. Illustrative examples

Here's an example of how to generate a WSDL file and how to test it with SOAPUI tools. With this in mind, readers will be able to see how soapui simulates a third-party system test. Here, the author will create a user class, because it is an example, so I do not use the database, but the provisions of the user name to "Owen", Password to "1234" to implement the user's login test. Remember, the user's login is no longer used by the browser, but is implemented using the SAOPUI tool. (Source address: Https://github.com/owenwilliam/UserLogin)

3. Generating a WSDL file

The author here stipulates that the Userlogin class as the user login interface class, that is, SOAPUI initiated the request, the first call is this class. Next, we'll use this class to generate a WSDL file.

1) Right-click the class and select Create Web Service


2) Select the service environment and service Engineering, we all adopt the default.


3) Enter the name of the WSDL file that we want to generate, which can be named by itself, or by using the default.


4) If the Tomcat server does not start, then the following step will be performed.


5) The last step, we do not have to tick, direct finish on it.


6) Review our project and discover that the following files were generated. One of them is the userlogin.wsdl file we care about. At the same time, I am interested, you can open Web. XML, SERVER-CONFIG.WSDD, UNDEPLOY.WSDD file to see exactly. Here the author does not give the analysis.


4. Understanding WSDL Files

1) To view the generated WSDL file, we see the <element name= "Userlogin" > Below are some of the parameters we defined in the Userlogin class method. In other words, when a customer initiates a request to our system, both fields are required fields and correspond to the type of string we specify.

<wsdl:types>  <schema elementformdefault= "qualified" targetnamespace= "http://client.owen.com" xmlns= " Http://www.w3.org/2001/XMLSchema ">   <element name=" Userlogin ">    <complexType>     < sequence>      <element name= "name" type= "xsd:string"/>      <element name= "password" type= "xsd:string"/ >     </sequence>    </complexType>   </element>   <element name= " Userloginresponse ">    <complexType/>   </element>  </schema> </wsdl:types>

2) The <wsdl:message> tags in the WSDL file are **request and **responser, which we are familiar with B/s architecture, is the request and response information hint.

<wsdl:message name= "Userloginrequest" >      <wsdl:part element= "Impl:userlogin" name= "Parameters" >      </wsdl:part>   </wsdl:message>   <wsdl:message name= "Userloginresponse" >      < Wsdl:part element= "Impl:userloginresponse" name= "parameters" >      </wsdl:part>   </wsdl:message >

3) Finally is an important <wsdl:service/> tag, this is the address of the URL we need to request the service, which is where we want to write the address bar in Soapui.

<wsdl:service name= "Userloginservice" >      <wsdl:port binding= "impl:userloginsoapbinding" Name= " Userlogin ">         <wsdlsoap:address location=" Http://localhost:8888/UserLogin/services/UserLogin "/>      </wsdl:port>   </wsdl:service>




WSDL file generation

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.