axis调用webservice接口的问题!~~急
这个是webservice的wsdl文件
<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="http://impl.webservice.hs.com" xmlns:tns="http://impl.webservice.hs.com" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://request.webservice.hs.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding" xmlns:ns2="http://webservice.hs.com" xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://request.webservice.hs.com">
- <xsd:complexType name="SubPlanRequest">
- <xsd:sequence>
<xsd:element minOccurs="0" name="EFFECTIVEDATE" nillable="true" type="xsd:string" />
<xsd:element minOccurs="0" name="EXPIREDATE" nillable="true" type="xsd:string" />
<xsd:element minOccurs="0" name="MDN" nillable="true" type="xsd:string" />
<xsd:element minOccurs="0" name="ORDERID" nillable="true" type="xsd:string" />
<xsd:element minOccurs="0" name="PAYMDN" nillable="true" type="xsd:string" />
<xsd:element minOccurs="0" name="PRODUCTID" nillable="true" type="xsd:string" />
<xsd:element minOccurs="0" name="RECORDSEQUENCEID" nillable="true" type="xsd:string" />
<xsd:element minOccurs="0" name="SERVICEID" nillable="true" type="xsd:string" />
<xsd:element minOccurs="0" name="SPID" nillable="true" type="xsd:string" />
<xsd:element minOccurs="0" name="SUBSCRIPTIONTIME" nillable="true" type="xsd:string" />
<xsd:element minOccurs="0" name="UPDATETYPE" nillable="true" type="xsd:string" />
<xsd:element minOccurs="0" name="orderMethod" nillable="true" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://impl.webservice.hs.com">
- <xsd:element name="transfer">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="in0" nillable="true" type="ns1:SubPlanRequest" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="transferResponse">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="out" nillable="true" type="ns2:Response" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://webservice.hs.com">
- <xsd:complexType name="Response">
- <xsd:sequence>
<xsd:element minOccurs="0" name="resultCode" type="xsd:int" />
<xsd:element minOccurs="0" name="sequenceID" nillable="true" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
- <wsdl:message name="transferResponse">
<wsdl:part name="parameters" element="tns:transferResponse" />
</wsdl:message>
- <wsdl:message name="transferRequest">
<wsdl:part name="parameters" element="tns:transfer" />
</wsdl:message>
- <wsdl:portType name="subPlanServicePortType">
- <wsdl:operation name="transfer">
<wsdl:input name="transferRequest" message="tns:transferRequest" />
<wsdl:output name="transferResponse" message="tns:transferResponse" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="subPlanServiceHttpBinding" type="tns:subPlanServicePortType">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="transfer">
<wsdlsoap:operation soapAction="" />
- <wsdl:input name="transferRequest">
<wsdlsoap:body use="literal" />
</wsdl:input>
- <wsdl:output name="transferResponse">
<wsdlsoap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="subPlanService">
- <wsdl:port name="subPlanServiceHttpPort" binding="tns:subPlanServiceHttpBinding">
<wsdlsoap:address location="http://127.0.0.1:9090/WapToV/services/subPlanService" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
调用此接口的代码如下:
package com;
import java.util.List;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
/**
*
* @author Administrator
*/
public class Test {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
try{
//WebService URL
String service_url = "http://127.0.0.1:9090/WapToV/services/subPlanService";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(service_url));
//设置要调用的方法
call.setOperationName(new QName("http://impl.webservice.hs.com", "transfer"));
//该方法需要的参数
call.addParameter("EFFECTIVEDATE", org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.addParameter("EXPIREDATE", org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.addParameter("MDN", org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.addParameter("ORDERID", org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.addParameter("PAYMDN", org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.addParameter("PRODUCTID", org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.addParameter("RECORDSEQUENCEID", org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.addParameter("SERVICEID", org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.addParameter("SPID", org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.addParameter("SUBSCRIPTIONTIME", org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.addParameter("UPDATETYPE", org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
call.addParameter("orderMethod", org.apache.axis.encoding.XMLType.XSD_STRING,
javax.xml.rpc.ParameterMode.IN);
//方法的返回值类型
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_ANY);
call.setUseSOAPAction(true);
//call.setSOAPActionURI("http://impl.webservice.hs.com");
//调用该方法
Object res = call.invoke(
new Object[]{
"20080822151414","20081022151414","13937135031","10160","13937135031","31000001101","145021,","310000011","21040","20100822154848","1","03"
}
);
System.out.println( "Result: " + res);
} catch (Exception e){
System.err.println(e);
}
}
}
总是报异常 Index: 1, Size: 1 请大家帮帮忙 看看是什么原因啊