微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

AXIS WebServices开发

官网地址: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!";
	}
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐