Java WebService Basic tutorial for Dummies

Source: Internet
Author: User
Tags wsdl

Online to find a lot of webservice-related technology, feeling too disorganized, for a novice, screening material what too troublesome, weekend idle to write an article using Java Deployment WebService fool version of the tutorial, less than welcome to shoot bricks. Advanced version of the stay to write next week.

Okay, now get to the point. Personal lazy, directly affixed to the picture ... The relevant instructions have been written notes, compared to the online or more detailed.

1. This tutorial uses Java-api's own jar package to create a Java project, with the following directory structure:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/47/E2/wKioL1QCkMqwzkXQAABc2QNA_X8827.jpg "title=" Directory structure. png "alt=" wkiol1qckmqwzkxqaabc2qna_x8827.jpg "/>

2. Document source code and explanatory notes

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/47/DF/wKiom1QCkE-gCK9bAAFrrzrxtTI544.jpg "style=" float: none; "title=" server. png "alt=" wkiom1qcke-gck9baafrrzrxtti544.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/47/E2/wKioL1QCkWbjSzq5AAKIpqUeUdM954.jpg "style=" float: none; "title=" client. png "alt=" wkiol1qckwbjszq5aakipqueudm954.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/47/DF/wKiom1QCkE-yP7YoAAEg9QC2lzs726.jpg "style=" float: none; the "title=" implementation class. png "alt=" wkiom1qcke-yp7yoaaeg9qc2lzs726.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/47/E2/wKioL1QCkWfg5KbdAACcygAuQws298.jpg "style=" float: none; "Title=" interface. png "alt=" wkiol1qckwfg5kbdaaccygauqws298.jpg "/>

PS: Some comments are blocked by watermarks, but you can see at a glance what that means ...


3. After the server is written, run as application, access the above defined http://localhost:8888/ns, to verify whether the service is published successfully, if it appears, basically is OK: 650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/47/E0/wKiom1QCkafDKhTtAABL047RHoM867.jpg "title=" Ns.png "alt=" Wkiom1qckafdkhttaabl047rhom867.jpg "/>

If exception is present, the JDK version is basically less than 1.6.17, this also pits me for a while, the online tutorial did not say!!!

-_-

Visit http://localhost:8888/ns?wsdl again, such as:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/47/E2/wKioL1QCkzaAhsQ0AAQC6zrZlp8403.jpg "title=" Wsdl.png "alt=" wkiol1qckzaahsq0aaqc6zrzlp8403.jpg "/> It is clear that the QName in the client is using the part labeled in the Red box.

That's about as much as the server.


4. Client-side invocation

Run as application directly on the client page, you can see the results directly, no longer demonstrate


That ' s all~

This article is from the "Null" blog, so be sure to keep this source http://lanfengjun.blog.51cto.com/5136542/1547060

Java WebService Basic tutorial for Dummies

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.