WS annotation usage

Source: Internet
Author: User
 Package
CN. MRZ. myws;
Import javax. JWS. webmethod;
Import javax. JWS. webparam;
Import javax. JWS. webresult;
Import javax. JWS. WebService;
Import javax. xml. ws. endpoint;
@ WebService (name = "My Service Interface Name", portname = "my service port name", servicename = "my service name", targetnamespace = "zhanghao.com ", wsdllocation = "")

Public class Hello { @ Webmethod (operationname = "greetings ")

 Public
 @ Webresult (name = "which ")
 String sayhi (
   @ Webparam (name = "name ")

   String name)
{
  System. Out. println ("welcome" + name
+ "Call sayhi ()");
  Return "hi" + name;
 }
 
 Public static void main (string [] ARGs ){
  Endpoint. Publish ("http: // localhost: 7777/one", new
Hello ());
 }
}
    Http: // localhost: 7777/one? WSDL <? XML version = "1.0"
Encoding = "UTF-8"?>-<! --

 Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.6 in JDK 6. 

 
-->
-<! --

 Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.6 in JDK 6. 

 
-->
-<Definitions
Xmlns: Soap ="Http://schemas.xmlsoap.org/wsdl/soap/"
Xmlns: TNS ="Zhanghao.com"Xmlns: XSD ="Http://www.w3.org/2001/XMLSchema"Xmlns ="Http://schemas.xmlsoap.org/wsdl/"
Targetnamespace ="Zhanghao.com"Name ="My service name">-<Types>-<XSD: schema> 
<XSD: Import namespace ="Zhanghao.com"Schemalocation ="Http: // localhost: 7777/one? XSD = 1"
/> 
</XSD: schema> 
</Types>-<Message
Name ="Greetings"> 
<Part name ="Parameters"Element ="TNS: Greetings"/> 
</Message>-<Message
Name ="Greeting response"> 
<Part name ="Parameters"Element ="TNS: greeting response"/> 
</Message>-<Porttype
Name ="My service interface Name">-<Operation
Name ="Greetings"> 
<Input message ="TNS: Greetings"/> 
<Output Message ="TNS: greeting response"/> 
</Operation> 
</Porttype>-<Binding
Name ="My service port name binding"Type ="TNS: My Service Interface Name"> 
<Soap: Binding transport ="Http://schemas.xmlsoap.org/soap/http"
Style ="Document"/>-<Operation
Name ="Greetings"> 
<Soap: Operation soapaction = ""
/>-<Input> 
<Soap: Body use ="Literal"
/> 
</Input>-<Output> 
<Soap: Body use ="Literal"
/> 
</Output> 
</Operation> 
</Binding>-<Service
Name ="My service name">-<Port
Name ="My service port name"Binding ="TNS: My service port name binding"> 
<Soap: address location ="Http: // localhost: 7777/One"
/> 
</Port> 
</Service> 
</Definitions>  Http: // localhost: 7777/one? XSD = 1   
<? XML version = "1.0"
Encoding = "UTF-8"?>-<! --

 Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.6 in JDK 6. 

 
-->
-<Xs: Schema
Xmlns: TNS ="Zhanghao.com"Xmlns: xs ="Http://www.w3.org/2001/XMLSchema"Version ="1.0"Targetnamespace ="Zhanghao.com"> 
<Xs: element name ="Greetings"Type ="TNS: Greetings"/> 
<Xs: element name ="Greeting response"Type ="TNS: greeting response"/>-<Xs: complextype
Name ="Greetings">-<Xs: sequence> 
<Xs: element name ="Name"Type ="Xs: String"Minoccurs ="0"/> 
</Xs: sequence> 
</Xs: complextype>-<Xs: complextype
Name ="Greeting response">-<Xs: sequence> 
<Xs: element name ="Which"Type ="Xs: String"Minoccurs ="0"/> 
</Xs: sequence> 
</Xs: complextype> 
</Xs: schema>

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.