WSDL interface invocation

Source: Internet
Author: User
Tags wsdl
Import org.apache.cxf.endpoint.Client;
Import Org.apache.cxf.frontend.ClientProxy;
Import Org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
Import Org.apache.cxf.transport.http.HTTPConduit;

Import Org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
	public class Webserviceutil {private static final long connect_timeout = 1000L * 5;
	
	Private static final Long recive_timeout = 1000L * 15; /** * Proxy way to get WebService client [CXF] (this method mainly functions to set the timeout time) */@SuppressWarnings ("unchecked") public static <T> T getclient (class<t> classz, String URL)
		{Jaxwsproxyfactorybean factory = new Jaxwsproxyfactorybean ();
		Factory.setaddress (URL);
		Factory.setserviceclass (CLASSZ);
		T obj = (t) factory.create ();
		Client proxy = clientproxy.getclient (obj);
		Httpconduit conduit = (httpconduit) proxy.getconduit ();
		Httpclientpolicy policy = new Httpclientpolicy ();
		Policy.setconnectiontimeout (connect_timeout);
		Policy.setreceivetimeout (recive_timeout);
		Conduit.setclient (Policy); Return obj; }} url= http://127.0.0.1:8080/****?wsdl generate client code: Wsimport-s D:\cos\pa-p Com.customer.service.client.paramTypeService -keep HTTP://127.0.0.1:8080/****?WSDL Use example Queryserviceporttype client = Webserviceutil.getclient (
Queryserviceporttype.class, URL);
 String Resultstr=client.getphotospath (jsonobj.tostring ());

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.