WEBservice a variety of ways

Reprinted from: https: //www.cnblogs.com/wuyongyin/p/11850585.html

WebService is a cross-programming language, remoting technology cross-platform operating system, it has been around for years, many interfaces are to be issued by WebService way; this series of articles focuses on various methods of calling Java WebService using online the Chinese simplified <-> Traditional conversion service (http://www.webxml.com.cn/WebServices/TraditionalSimplifiedWebService.asmx) as a test server, use one of the simplified convert Traditional methods toTraditionalChinese to demonstrate calling WebService. In this paper, we do some preparatory work to facilitate the actual call subsequent articles.

1、WSDL

In order to prevent the line WebService unavailable, where the WSDL posted here, convenience and control codes.

http://www.webxml.com.cn/WebServices/TraditionalSimplifiedWebService.asmx?wsdl

  View Code

2, generates a message with SoapUI Soap

The online WebService while achieving Soap1.1 and Soap1.2, generate a message here.

2.1 Soap1.1

Queries xml

View Raw

2.1 Soap1.2

View xml

View Raw

3, the local WebService service

Because we use online WebService server for .NET implementation, and our client is JAVA, if you can not invoke a RPC call; WebService here to create a local JAX-WS implementation for this series of articles RPC way It calls. RPC is outdated, but for the integrity of the technology, but also recorded.

3.1 interface class

复制代码
package com.inspur.zsyw.ws;

import javax.jws.WebParam;
import javax.jws.WebService;

@WebService
@SOAPBinding(style = SOAPBinding.Style.RPC) public interface ITestService { String hello(@WebParam(name = "name") String name); }
复制代码

3.1、实现类

复制代码
package com.inspur.zsyw.ws.impl;

import com.inspur.zsyw.ws.ITestService;

@javax.jws.WebService(endpointInterface="com.inspur.zsyw.ws.ITestService", targetNamespace = "http://ws.zsyw.inspur.com/", serviceName = "TestService")
public class TestServiceImpl implements ITestService {
    @Override
    public String hello(String name) {
        return "hello," + name;
    }
}
复制代码

3.3、本地WSDL

http://10.40.103.48:9006/zsywservice/TestService?wsdl

  View Code

4、调用

本文主要介绍一些准备工作,具体调用参见下列文章:

Java调用WebService方法总结(2)--JAX-WS调用WebService

Java调用WebService方法总结(3)--wsimport调用WebService

Java调用WebService方法总结(4)--Axis调用WebService

Java调用WebService方法总结(5)--Axis2调用WebService

Java调用WebService方法总结(6)--XFire调用WebService

Java调用WebService方法总结(7)--CXF调用WebService

Java调用WebService方法总结(8)--soap.jar调用WebService

Java调用WebService方法总结(9,end)--Http方式调用WebService

Guess you like

Origin www.cnblogs.com/UUUz/p/12176588.html