求助帮忙

刚开始学基于java的web service从网上找了一段代码如下:

 

代理接口:

   package com.qdl.dao;

import java.rmi.Remote;

public interface HelloClientInterface extends Remote{
   
    public String getName(String name) throws java.rmi.RemoteException;

}

测试程序:

package com.qdl.client;

import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.Service;
import com.qdl.dao.HelloClientInterface;

public class TestHelloClient {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO 自动生成方法存根
        System.out.println("Start...");
       
        try{
            String wsdlUrl = "http://localhost:8080/axis/SayHello.jws?wsdl";
               String nameSpaceUri = "http://localhost:8080/axis/SayHello.jws";
               //注意下面的serviceName和portName,
               //http://localhost/webservice/SayHello.jws?wsdl页面的xml最下端有
               String serviceName = "SayHelloService";
               String portName = "SayHello";
               ServiceFactory serviceFactory = ServiceFactory.newInstance();
               Service afService = serviceFactory.createService(new URL(wsdlUrl), new QName(nameSpaceUri, serviceName));
               HelloClientInterface proxy = (HelloClientInterface) afService.getPort(new QName(nameSpaceUri, portName), HelloClientInterface.class);
               System.out.println("返回信息是:" + proxy.getName("zhangsan"));
           
        }catch(Exception ex){
            ex.printStackTrace();
        }
    }

}

是第二种部署方法

 

问题是总出现入戏错误提示:

javax.xml.rpc.ServiceException: Incompatible service endpoint interface: com.qdl.dao.HelloClientInterface
    at org.apache.axis.client.Service.getPort(Service.java:441)
    at org.apache.axis.client.Service.getPort(Service.java:330)
    at com.qdl.client.TestHelloClient.main(TestHelloClient.java:27)
求高手帮忙

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值