工大后院

 找回密码
 加入后院

扫一扫,访问微社区

QQ登录

只需一步,快速开始

搜索
查看: 1477|回复: 1

初学web service 吾知大虾们有咩好书介绍叻? 付一小例 大家一齐学

[复制链接]
发表于 2006-6-30 13:06 | 显示全部楼层 |阅读模式
Hello.jws:

public class Hello
{
        public String hello(String name)
        {
                return name + "welcome to axis!";
        }

}





WebServiceClient.java:

package coffee;

import org.apache.axis.client.*;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;


public class WebServiceClient
{   
    public static void main(String args[])
    {        
        System.out.println("开始调用WebService");        
        try
        {
            String endpoint = "http://localhost:8209/axis/Hello.jws";
            Service  service = new Service();
            Call call = (Call)service.createCall();
            call.setTargetEndpointAddress(new java.net.URL(endpoint));
            
            call.setOperationName("hello");
            String s = (String)call.invoke(new Object[] {"coffee"});
            System.out.println(s);
        }
        catch (Exception e)
        {
            System.out.println(e.toString());
        }
        System.out.println("调用WebService正常结束");        
    }
}
发表于 2006-6-30 21:05 | 显示全部楼层
我看oreilly的,感觉写得不好。后来翻看了好多其他资料才理解。其他书没看过。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 加入后院

本版积分规则

QQ|Archiver|手机版|小黑屋|广告业务Q|工大后院 ( 粤ICP备10013660号 )

GMT+8, 2025-5-15 05:07

Powered by Discuz! X3.5

Copyright © 2001-2024 Tencent Cloud.

快速回复 返回顶部 返回列表