CXF Release WebService Service

Source: Internet
Author: User
Tags soap

Guide Package
antlr-2.7.7. Jaraopalliance-1.0. Jarasm-3.3. Jarcommons-collections-3.2.1. Jarcommons-lang-2.6. Jarcommons-logging-1.1.1. JARCXF-2.4.2. JARCXF-MANIFEST.JARCXF-xjc-Boolean-2.4.0. JARCXF-xjc-bug671-2.4.0. JARCXF-xjc-dv-2.4.0. JARCXF-xjc-ts-2.4.0. Jarfastinfoset-1.2.9. Jargeronimo-activation_1.1_spec-1.1. Jargeronimo-annotation_1.0_spec-1.1.1. Jargeronimo-javamail_1.4_spec-1.7.1. Jargeronimo-jaxws_2.2_spec-1.0. Jargeronimo-jms_1.1_spec-1.1.1. Jargeronimo-servlet_3.0_spec-1.0. Jargeronimo-stax-api_1.0_spec-1.0.1. Jargeronimo-ws-metadata_2.0_spec-1.1.3. Jarisorelax-20030108. JARJAXB-api-2.2.1. JARJAXB-impl-2.2.1.1. JARJAXB-xjc-2.2.1.1. Jarjettison-1.3. Jarjetty-continuation-7.4.5. V20110725.jarjetty-http-7.4.5. V20110725.jarjetty-io-7.4.5. V20110725.jarjetty-security-7.4.5. V20110725.jarjetty-server-7.4.5. V20110725.jarjetty-util-7.4.5. V20110725.jarjoda-time-1.6.2. Jarjra-1.0-alpha-4. Jarjs-1. 7r2.jarjsr311-api-1.1.1. JARMSV-core-2010.2. Jarneethi-3.0.1. Jaropensaml-2.4.1. JAROPENWS-1.4.1. Jarrelaxngdatatype-20020414. Jarsaaj-api-1.3. Jarsaaj-impl-1.3.2. Jarserializer-2.7.1. jarslf4j-api-1.6.1. jarslf4j-jdk14-1.6.1. jarspring-aop-3.0.5. Release.jarspring-asm-3.0.5. Release.jarspring-beans-3.0.5. Release.jarspring-context-3.0.5. Release.jarspring-core-3.0.5. Release.jarspring-expression-3.0.5. Release.jarspring-jms-3.0.5. Release.jarspring-tx-3.0.5. Release.jarspring-web-3.0.5. Release.jarstax2-api-3.1.1. Jarvelocity-1.7. Jarwoodstox-core-asl-4.1.1. jarwsdl4j-1.6.2. jarwss4j-1.6.2. Jarxalan-2.7.1. Jarxml-resolver-1.2. Jarxmlbeans-2.4.0. Jarxmlschema-core-2.0. Jarxmlsec-1.4.5. jarxmltooling-1.3.1. Jarxsdlib-2010.1.jar
View Code

Publishing a service using the parent class
Serverfactorybean released WebService
1  Packagecn.itcast.cxf;2 3 ImportOrg.apache.cxf.frontend.ServerFactoryBean;4 5 /**6 * Use Serverfactorybean to publish CXF javase applications7  * @author 8  *9  */Ten  Public classHelloService { One      A      Publicstring SayHello (string name) { -System.out.println ("SayHello called ..."); -         return"Hello" +name; the     } -      -      Public Static voidMain (string[] args) { -         //Get Service Factory beans +Serverfactorybean Bean =NewServerfactorybean (); -         //the publishing address of the binding service +Bean.setaddress ("Http://192.168.151.42:5678/hello"); A         //Specify the type of service provided atBean.setserviceclass (HelloService.class); -         //specifying instances of service delivery -Bean.setservicebean (NewHelloService ()); -         //Start Service-----Publish - bean.create (); -SYSTEM.OUT.PRINTLN ("Server Ready ..."); in     } -}

Publishing services using subclasses

Jaxwsserverfactorybean class release CXF  javase WebService app
1  Packagecn.itcast.cxf;2 3 ImportJavax.jws.WebService;4 Importjavax.jws.soap.SOAPBinding;5 6 ImportOrg.apache.cxf.jaxws.JaxWsServerFactoryBean;7 ImportOrg.apache.cxf.wsdl.http.BindingType;8 9 /**Ten * Use Jaxwsserverfactorybean to publish CXF javase applications One * @webservice annotations must be added on the class being published as a service, if not annotated, though not A error, but will not expose any method -  * @authorZHAOQX -  * the  */ - @WebService - //change the server to the SOAP 1.2 version, and release the 1.1 version if not added . -@javax. Xml.ws.BindingType (value=Javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING) +  Public classHiservice { -      Publicstring Sayhi (string name) { +System.out.println ("Sayhi called ..."); A         return"HI" +name; at     } -      -      Public Static voidMain (string[] args) { -Jaxwsserverfactorybean Bean =NewJaxwsserverfactorybean (); -Bean.setaddress ("Http://192.168.151.42:6789/hi"); -Bean.setserviceclass (Hiservice.class); inBean.setservicebean (NewHiservice ()); - bean.create (); toSYSTEM.OUT.PRINTLN ("Server Ready ..."); +     } -}

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.