加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

AXIS WebServices开发

发布时间:2020-12-16 23:02:14 所属栏目:安全 来源:网络整理
导读:官网地址: http://axis.apache.org/axis/ api文档:http://axis.apache.org/axis/java/apiDocs/index.html 当前最新版本:Axis 1.4 Final? 2. 自定义部署-wsdd Service: package com.service;import java.rmi.RemoteException;import javax.xml.rpc.Parameter

官网地址:http://axis.apache.org/axis/

api文档:http://axis.apache.org/axis/java/apiDocs/index.html

当前最新版本:Axis 1.4 Final?



2. 自定义部署-wsdd


Service:

package com.service;

import java.rmi.RemoteException;

import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.ServiceException;

import org.apache.axis.Constants;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;


public class AixsService {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String endpoint = "http://localhost:8080/Test2/services/TestService?wsdl";
		Service service = new Service();
		try {
			Call call = (Call)service.createCall();
			call.setTargetEndpointAddress(endpoint);
			call.setOperationName("receive");  //Client端调用的方法名
			//call.addParameter("somebody",XMLType.SOAP_STRING,ParameterMode.IN);
		        //call.setReturnType(Constants.XSD_STRING);
			String xxx = (String)call.invoke(new Object[] {"This is the message!"});  //传输的数据
			System.out.println("Service Receive:"+xxx);      //打印:Service Receive:thank you!
		} catch (ServiceException e) {
			e.printStackTrace();
		} catch (RemoteException e) {
			e.printStackTrace();
		}

	}

}

Client:

package com.client;

public class AixsClient {
	
	public String receive(String xmlMsg){
		System.out.println("Client Receive:" + xmlMsg);  //打印:Client Receive:This is the message!
		return "thank you!";
	}
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读