cxfはwsdlを介して直接webserviceを呼び出し/アクセスし、クライアントコードを書く必要はありません.

999 ワード

//    wsdl      ws,    soap    ,    ,   
import org.apache.cxf.endpoint.Client;   
import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;   
import org.springframework.context.support.ClassPathXmlApplicationContext;   
public class TestMain {   

 public static void main(String[] args) {   
   String xmlInput = "query              sqlserver1              020";     
  JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();   
  String wsUrl = "  "  
  String method = "findAllUser";
  Client client = dcf.createClient(wsUrl);   
  Object[] res = null;   
  try {   
   res = client.invoke(method, xmlInput);
  } catch (Exception e) {   
   e.printStackTrace();   
  }   
    System.exit(0);   
 }   
}