This article describes the method of Java accessing the server webservice through the client. Share it for your reference, as follows:
InputStream in = TestClient.class.getClassLoader().getResourceAsStream("datasource.properties");Properties prop = new Properties();prop.load(in);String endpoint = prop.getProperty("url", "none"); // Indicate the service location, System.out.println(System.getProperty("java.library.path")); // System is the webapp name, change it to your own webappService service = new Service(); // Create a Service instance, note that it is necessary! Call call = null;try {call = (Call) service.createCall();} catch (ServiceException e) {// TODO Auto-generated catch blocke.printStackTrace();} // Creating a Call instance is also a must! call.setTargetEndpointAddress(endpoint); // Set the service location for Call call.setOperationName("getRefInfo"); // To call the method name in HelloWorld String jsonv= (String) call.invoke(new Object[] {cardInNo}); // Datasource.properties file contents, place in the src directory. url refers to the path accessed by the webservice class url=http://localhost:8090/bid/services/HelloWorldFor more information about Java related content, please check out the topics of this site: "Java Data Structure and Algorithm Tutorial", "Summary of Java File and Directory Operation Skills", "Summary of Java Operation DOM Node Skills" and "Summary of Java Cache Operation Skills"
I hope this article will be helpful to everyone's Java programming.