写了个客户端,可是运行的时候报org.xml.sax.SAXException :operation description is missing parameter description!
工具:myeclipes
语言:java
client::::::----------------------------------------------------------------------------
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
public class Test {
public static void main(String [] args) {
try {
String fileName = "welcome.wav";
String endpoint =
"http://localhost:8080/JTTS_WS/services/JTTS";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName("http://service.jttsws.sinovoice.com", "jTTS_PlayToFile"));
//String ret = (String) call.invoke( new Object[] { "Hello!" } );
String ret = (String) call.invoke( new Object[] {"欢迎使用",fileName, 0, 0, null, 0,"84316E85-143E-4410-B00B-9DF681684C6C", (short) -1,(short) -1, (short) -1, (short) 9, (short) -1, (short) -1,(short) -1, (short) -1, (short) -1, (short) -1, (short) -1,(short) -1, (short) -1, (short) -1} );
System.out.println("Sent 'Hello!', got '" + ret + "'");
} catch (Exception e) {
System.err.println(e.toString());
}
}
}
----------------------------------wsdl-------------------------------------------- <?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="http://service.jttsws.sinovoice.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://service.jttsws.sinovoice.com" xmlns:intf="http://service.jttsws.sinovoice.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <!--
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT) -->
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://service.jttsws.sinovoice.com" xmlns="http://www.w3.org/2001/XMLSchema">
- <element name="jTTS_PlayToFile">
- <complexType>
- <sequence>
<element name="text" type="xsd:string" />
<element name="fileName" type="xsd:string" />
<element name="format" type="xsd:int" />
<element name="flag" type="xsd:long" />
<element name="playToFileCallBackable" type="xsd:string" />
<element name="userData" type="xsd:long" />
<element name="voiceId" type="xsd:string" />
<element name="domain" type="xsd:short" />
<element name="pitch" type="xsd:short" />
<element name="volume" type="xsd:short" />
<element name="speed" type="xsd:short" />
<element name="puncMode" type="xsd:short" />
<element name="digitMode" type="xsd:short" />
<element name="engMode" type="xsd:short" />
<element name="tagMode" type="xsd:short" />
<element name="backAudio" type="xsd:short" />
<element name="backAudioVolume" type="xsd:short" />
<element name="backAudioFlag" type="xsd:short" />
<element name="voiceBufSize" type="xsd:short" />
<element name="insertInfoSize" type="xsd:short" />
</sequence>
</complexType>
</element>
- <element name="jTTS_PlayToFileResponse">
- <complexType>
- <sequence>
<element name="jTTS_PlayToFileReturn" type="xsd:string" />
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
- <wsdl:message name="jTTS_PlayToFileResponse">
<wsdl:part element="impl:jTTS_PlayToFileResponse" name="parameters" />
</wsdl:message>
- <wsdl:message name="jTTS_PlayToFileRequest">
<wsdl:part element="impl:jTTS_PlayToFile" name="parameters" />
</wsdl:message>
- <wsdl:portType name="JTTS">
- <wsdl:operation name="jTTS_PlayToFile">
<wsdl:input message="impl:jTTS_PlayToFileRequest" name="jTTS_PlayToFileRequest" />
<wsdl:output message="impl:jTTS_PlayToFileResponse" name="jTTS_PlayToFileResponse" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="JTTSSoapBinding" type="impl:JTTS">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="jTTS_PlayToFile">
<wsdlsoap:operation soapAction="" />
- <wsdl:input name="jTTS_PlayToFileRequest">
<wsdlsoap:body use="literal" />
</wsdl:input>
- <wsdl:output name="jTTS_PlayToFileResponse">
<wsdlsoap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="JTTSService">
- <wsdl:port binding="impl:JTTSSoapBinding" name="JTTS">
<wsdlsoap:address location="http://localhost:8080/JTTS_WS/services/JTTS" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
工具:myeclipes
语言:java
client::::::----------------------------------------------------------------------------
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
public class Test {
public static void main(String [] args) {
try {
String fileName = "welcome.wav";
String endpoint =
"http://localhost:8080/JTTS_WS/services/JTTS";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress( new java.net.URL(endpoint) );
call.setOperationName(new QName("http://service.jttsws.sinovoice.com", "jTTS_PlayToFile"));
//String ret = (String) call.invoke( new Object[] { "Hello!" } );
String ret = (String) call.invoke( new Object[] {"欢迎使用",fileName, 0, 0, null, 0,"84316E85-143E-4410-B00B-9DF681684C6C", (short) -1,(short) -1, (short) -1, (short) 9, (short) -1, (short) -1,(short) -1, (short) -1, (short) -1, (short) -1, (short) -1,(short) -1, (short) -1, (short) -1} );
System.out.println("Sent 'Hello!', got '" + ret + "'");
} catch (Exception e) {
System.err.println(e.toString());
}
}
}
----------------------------------wsdl-------------------------------------------- <?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="http://service.jttsws.sinovoice.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://service.jttsws.sinovoice.com" xmlns:intf="http://service.jttsws.sinovoice.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <!--
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT) -->
- <wsdl:types>
- <schema elementFormDefault="qualified" targetNamespace="http://service.jttsws.sinovoice.com" xmlns="http://www.w3.org/2001/XMLSchema">
- <element name="jTTS_PlayToFile">
- <complexType>
- <sequence>
<element name="text" type="xsd:string" />
<element name="fileName" type="xsd:string" />
<element name="format" type="xsd:int" />
<element name="flag" type="xsd:long" />
<element name="playToFileCallBackable" type="xsd:string" />
<element name="userData" type="xsd:long" />
<element name="voiceId" type="xsd:string" />
<element name="domain" type="xsd:short" />
<element name="pitch" type="xsd:short" />
<element name="volume" type="xsd:short" />
<element name="speed" type="xsd:short" />
<element name="puncMode" type="xsd:short" />
<element name="digitMode" type="xsd:short" />
<element name="engMode" type="xsd:short" />
<element name="tagMode" type="xsd:short" />
<element name="backAudio" type="xsd:short" />
<element name="backAudioVolume" type="xsd:short" />
<element name="backAudioFlag" type="xsd:short" />
<element name="voiceBufSize" type="xsd:short" />
<element name="insertInfoSize" type="xsd:short" />
</sequence>
</complexType>
</element>
- <element name="jTTS_PlayToFileResponse">
- <complexType>
- <sequence>
<element name="jTTS_PlayToFileReturn" type="xsd:string" />
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
- <wsdl:message name="jTTS_PlayToFileResponse">
<wsdl:part element="impl:jTTS_PlayToFileResponse" name="parameters" />
</wsdl:message>
- <wsdl:message name="jTTS_PlayToFileRequest">
<wsdl:part element="impl:jTTS_PlayToFile" name="parameters" />
</wsdl:message>
- <wsdl:portType name="JTTS">
- <wsdl:operation name="jTTS_PlayToFile">
<wsdl:input message="impl:jTTS_PlayToFileRequest" name="jTTS_PlayToFileRequest" />
<wsdl:output message="impl:jTTS_PlayToFileResponse" name="jTTS_PlayToFileResponse" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="JTTSSoapBinding" type="impl:JTTS">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="jTTS_PlayToFile">
<wsdlsoap:operation soapAction="" />
- <wsdl:input name="jTTS_PlayToFileRequest">
<wsdlsoap:body use="literal" />
</wsdl:input>
- <wsdl:output name="jTTS_PlayToFileResponse">
<wsdlsoap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="JTTSService">
- <wsdl:port binding="impl:JTTSSoapBinding" name="JTTS">
<wsdlsoap:address location="http://localhost:8080/JTTS_WS/services/JTTS" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货