代码如下:
package com.peidw.foxconver.wsclient;import org.apache.axis.client.Call;
import org.apache.axis.client.Service;public class CaClient { public static void main(String[] args) {
try {
String endpoint = "http://xurrency.com/servidor_soap.php?wsdl";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(endpoint);
call.setOperationName("getValue");
call.addParameter("amount", org.apache.axis.encoding.XMLType.XSD_FLOAT,javax.xml.rpc.ParameterMode.IN);
call.addParameter("base", org.apache.axis.encoding.XMLType.XSD_DATE,javax.xml.rpc.ParameterMode.IN);
call.addParameter("target", org.apache.axis.encoding.XMLType.XSD_DATE,javax.xml.rpc.ParameterMode.IN);

call.setReturnType(org.apache.axis.encoding.XMLType.XSD_FLOAT);
call.setUseSOAPAction(true);

call.setSOAPActionURI("http://xurrency.com/servidor_soap.php/getValue");

float result = (Float)call.invoke(new Object[]{444.4,"CNY","USD"});
System.out.println("result is "+result);
}catch (Exception e) {
e.printStackTrace();
}

}}
===============异常信息==========
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: org.xml.sax.SAXException: Bad envelope tag:  definitions
 faultActor: 
 faultNode: 
 faultDetail: 
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: Bad envelope tag:  definitions
at org.apache.axis.message.EnvelopeBuilder.startElement(EnvelopeBuilder.java:71)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1048)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
=============请大家帮调试一下,谢谢!

解决方案 »

  1.   

    php使用什么工具写的wsdl?
    一般来说是字符问题~ 检查看看是不是有特殊字符~
      

  2.   

    这是个国外网站发布的wsdl服务,与网站方联系没回复.我在想是不是因为sax2.jar的问题
      

  3.   

    用myeclipse生成客户端调用时也现在提示wsdl校验失败....郁闷
      

  4.   

    我用php帮你试过了 可以用的~
    但是不是因为wsdl协议版本的问题~
    axis可以设置使用协议的版本吗,可以试一试~
      

  5.   

    ... Schema for the SOAP/1.1 envelope ...他们用的是1.1版本的~
      

  6.   

    我觉得是jar包的问题,但在网上看到一个例子,说是php生成的wsdl文件中包含有特殊代码造成的谁能用axis1.4来调试下;...
      

  7.   

    这是访问的地址有问题 
    你这样写下看看 
    String endpoint = "http://xurrency.com/servidor_soap.php"; 
    去掉后面的  ?wsdl