应该问题出在delphi程序上吧,你下载fiddler让它在客户端监听请求,然后分别运行java和delphi的webservice客户端,你就会很清楚地比较两者的异同,到底delphi哪里出错了。

解决方案 »

  1.   

    发现点异样:我使用myeclipse生成的wsdl文件的格式好像不对:
      <wsdl:message name="getNameRequest" /> 
    - <wsdl:message name="getNameResponse">
      <wsdl:part name="out" type="xsd:string" /> 
      </wsdl:message>
    通篇文字里只有message元素,没有任何element元素。而标准的wsdl文件里包含element元素:
    - <s:element name="GetString">
      <s:complexType /> 
      </s:element>难到真是因为myeclipse生成的wsdl文件格式不对造成上述的错误吗?
      

  2.   

    在message上面没有<types>标签么,element都是在那里面定义呀
      

  3.   

    问题解决了,果然是因为myeclipse自动生成webservice工程的wsdl不够标准,只能java客户端访问。
    而用纯eclipse自动生成的webservice工程的wsdl很标准,不仅java客户端能访问,用delphi,vb也能访问(刚测了)
    两者生成的wsdl文件的区别是:myeclipse的没有types标签。而eclipse生成的就有,vb生成的也有。
      

  4.   

    使用纯eclipse生成webservice的方法:
    1,使用纯eclipse随便建立一个java工程,比如叫ddd,
    eclipse的版本:wtp-all-in-one-sdk-r-2.0-200706260303-win32.zip
    Version: 3.3.0
    Build id: I20070625-1500
    2,在里面建一个类,一个接口,类里有一个方法返回一个字符串。比如:实现类是:
    package com;
    public class DDD implements DDDInterface {
    public String getName(){
    return "dddd";
    }
    }
    3,对工程,new一个other里面的webservice
    4,下一步时,选择”Bottom up Java bean Web Service”.
    Service implementatiox选择你的实现类。
    勾上“Publish the Web service”
    5,点击下一步,这个会提示一个错误,不要害怕,“The class "com.DDD" cannot be loaded via project "WebServiceProject". Check that the project contains the class, or that the class is loadable according to the Java Build Path of the project.”,同时,你会发现多了一个工程“WebServiceProject”,这时,你暂停下来,把实现类和接口复制到这个WebServiceProject工程里,然后对这个工程建一个webservice,会发现这次不报错了。
    6,这时会看到你想公布的方法,比如“getName()”。就选择“document/literal(wrapped)”,
    点击下一步,这时可能会报“\Servers\Tomcat v5.0 Server at localhost-config is missing”,就是忘装tomcat了。装好tomcat,再下一步,正常的话会看到一个按钮“Start server”,点这个按钮。然后就只能点finish了。
    在console里会看到一个错误”严重 Unable to find config file.  Creating new servlet engine config file: /WEB-INF/server-config.wsdd
    “别管它没事。
    然后测试,应该没问题了。