Jaxwsproxyfactorybean and Jaxwsdynamicclientfactory

Source: Internet
Author: User

1, Jaxwsproxyfactorybean

Introduction: The invocation of a similar mechanism with RMI, that is, the client directly calls the server-side service Interface (interface), CXF through the runtime proxy generation of the remote service proxy object, the client to complete the access to WebService ; several required fields: setaddress-This is the address we posted when we webservice, keep it consistent. Cons: the benefit of invoking a service is that the invocation process is very simple, with a few lines of code completing a WebService call, but the client must also rely on the server-side interface, which is a very restrictive invocation method. Requiring server-side webservice to be Java implementations-and thus losing the meaning of using WebService
  1. public   class  client {  
  2. public   static   void  main (String[] args)  {  
  3.          jaxwsproxyfactorybean bean =  new  jaxwsproxyfactorybean ();   
  4.          bean.setserviceclass (Helloworldservice. class
  5.          bean.setaddress (
  6.          HelloWorldService helloWorldService =  (HelloWorldService) bean.create ();  
  7.          string result = helloworldservice.sayhello ( "Kevin"
  8. SYSTEM.OUT.PRINTLN (result);
  9. }


2,jaxwsdynamicclientfactory Summary: Simply specify the location of the server-side WSDL file, then specify the parameters of the method and method to invoke, and do not care about how the service side is implemented.      
  1. Public class Client3 {
  2. public   static   void  main (String[] args)   throws  exception {  
  3.          jaxwsdynamicclientfactory clientfactory = jaxwsdynamicclientfactory.newinstance ();   
  4.          client client = clientfactory.createclient ( "http://localhost:9090/helloWorldService?wsdl"
  5.          object[] result = client.invoke ( "SayHello" ,  "KEVIN"
  6.          system.out.println (Result[0
  7. }
  8. }


3, Jaxwsserverfactorybean release with Jaxwsserverfactorybean, requires a separate jetty package.

Jaxwsproxyfactorybean and Jaxwsdynamicclientfactory

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.