⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cardserviceclient.java

📁 精通Jboss——Ejb和Web Services开发精解的随书源代码
💻 JAVA
字号:
/*
 * Created on 2004-1-14
 *
 */
package com.liuyang.jboss.net.ejb.client;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;

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

import com.liuyang.jboss.net.ejb.Card;
/**
 * @author liuyang
 *
 */
public class CardServiceClient {

	public static void main(String[] args) throws Exception {
		String endpoint = "http://localhost:8080/jboss-net/services/CardService";
		Service  service = new Service();
		Call     call    = (Call) service.createCall();
		call.setTargetEndpointAddress( new java.net.URL(endpoint) );
		QName    qn      = new QName( "http://www.liuyang.com/samples/card", "Card" );
		call.registerTypeMapping(Card.class, qn,
			new org.apache.axis.encoding.ser.BeanSerializerFactory(Card.class, qn),        
			new org.apache.axis.encoding.ser.BeanDeserializerFactory(Card.class, qn));        
		Card result = null;
		try {
			call.setOperationName( "getCard"  );
			call.addParameter( "arg1",XMLType.XSD_STRING, ParameterMode.IN );
			call.setReturnType(qn);
			result = (Card) call.invoke( new Object[] {"test"} );
		} catch (AxisFault fault) {
			System.out.println("Error : " + fault.toString());
		}
		if(result!=null)   
			System.out.println(result.getAddress());
		else
			System.out.println("failed");
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -