Interface-oriented WebService publishing method

Source: Internet
Author: User
Tags wsdl

Import Javax.jws.WebService; /**  */@WebServicepublicinterface  jobservice    {public  String getjob ();}
 import   Javax.jws.WebService; @WebService (Endpointinterface  = "Com.oracle.ws.c.jobservice") //  Set the service endpoint interface, specify the interface for external service  public  class  jobserviceimpl implements   Jobservice {@ Override  public   String Getjob () {return  "Jee Research Engineer |    Android Research Engineer | Database Engineer | front-end Engineer | Test Engineer | operations Engineer ";  public  void   say () {System.out.println ( "Good morning!")    ); }}
Import Javax.xml.ws.Endpoint;  Public class Test {    publicstaticvoid  main (string[] args) {        jobservice Jobservice=new  Jobserviceimpl ();        String address= "Http://127.0.0.1:9999/ws/jobservice";        Endpoint.publish (address, jobservice);        System.out.println ("WSDL address:" +address+ "?) WSDL ");}    }

Client

ImportCom.oracle.ws.c.jobservice;ImportCom.oracle.ws.c.jobserviceimplservice; Public classTest {/**Test WebService Publishing by implementing an interface **/ Public Static voidMain (string[] args) {jobserviceimplservice ws=NewJobserviceimplservice (); Jobservice Jobserviceimplport=Ws.getjobserviceimplport (); String Jobs=Jobserviceimplport.getjob (); //"Jee Research Engineer | Android Research Engineer | Database Engineer | front-end Engineer | Test Engineer | operations Engineer "String[] Jobarray=jobs.split ("\\|"); System.out.println (jobarray[2]); System.out.println (jobarray[0]); System.out.println (jobarray[3]);}}

Interface-oriented WebService publishing method

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.