WebService Publishing Interface

Source: Internet
Author: User
Tags wsdl

One: Write interface program, calculate function class, have subtraction four methods

1 /**2  * 3  */4  PackageCom.hlcui.util;5 6 /**7  * @authorAdministrator Publish this class as a public interface8  */9  Public classCalculateutil {Ten     /** One * Addition A      *  -      * @paramx -      * @paramy the      * @return -      */ -      Public DoublePlusDoubleXDoubley) { -         returnX +y; +     } -  +     /** A * Subtraction at      *  -      * @paramx -      * @paramy -      * @return -      */ -      Public DoubleMinus (DoubleXDoubley) { in         returnX-y; -     } to  +     /** - * Multiplication the      *  *      * @paramx $      * @paramyPanax Notoginseng      * @return -      */ the      Public DoubleMultiplyDoubleXDoubley) { +         returnX *y; A     } the  +     /**, the - * Division $      *  $      * @paramx -      * @paramy -      * @return the      */ -      Public DoubleDivideDoubleXDoubley) {Wuyi         returnX/y; the     } -}

Second: Publish this class to provide an interface for others to call

Here I deploy it directly to the server to publish:

1:file--new--web Service

2: Configure interface information

3:next

Choose the interface method, start the service, etc., until finish.

Third, test whether the interface is published successfully

In the browser input: http://ip:port/projectName/services/class name? wsdl

For example: After my interface is published, enter in the browser address bar

http://localhost:8080/angular_study/services/CalculateUtil?wsdl

If the access succeeds, the following XML file information is rendered:

The interface was published successfully.

Four: Call the published interface, here can refer to the previous blog (call the Weather interface)

1: Save the WSDL file for the third step, and copy it to the SRC of the new project Angularclient

2: Right-click--web service--generate Client, the interface is as follows:

3: All the way next, to finish, will generate the client code under the Angularclient project.

4: Write the test code to call the interface.

WebService Publishing Interface

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.