1  服务点接口。@WebService
public interface IHelloWorld {
public String getHellow( @WebParam(name="name") String name);
}2 实现类@WebService(endpointInterface="com.web.hellow.IHelloWorld",serviceName="Hellow")
public class HelloWorld implements IHelloWorld {
public String getHellow(String name) {
String str="你好,世界;你好,"+name;
return str;
}
}3 暴露Web服务public static void main(String[] args) {
String address="http://localhost:8000/hellow";
HelloWorld hellow = new HelloWorld();
Endpoint.publish(address, hellow);
}以上生成正确wsdl,如下
targetNamespace为默认(包名倒置)
=============================================================
以上都没问题,我要修改targetNamespace为“http://aaa/”,代码如下@WebService(targetNamespace="http://aaa/")
public interface IHelloWorld {
public String getHellow( @WebParam(name="name") String name);
}-暴露服务生成wsdl如下有如下几个问题:
1.targetNamespace并没有修改,而绿色划线处namespace被修改
2.wsdl的内容发生了很大变化希望大神详细一些说明一下

解决方案 »

  1.   


    @WebService(endpointInterface="com.web.hellow.IHelloWorld",serviceName="Hellow",targetNamespace="http://aaa/")
    public class HelloWorld implements IHelloWorld {
        public String getHellow(String name) {
            String str="你好,世界;你好,"+name;
            return str;
        }
    }
      

  2.   

    解决了第一个问题,targetNamespace修改成功了,但是第二个问题,为什么设置了targetNamespace以后,wsdl报文发生了很大变化
      

  3.   

    我的怎么不能改targetNamespace,你是怎么改的
      

  4.   

    找了所有的 都没有发现可以的  最后只在 楼主说的这个方法才可以。把targetNamespace写在接口上的webservice注解。 但是楼主说的那个第二个问题。我目前是调通了,还没有发现有什么问题。