我使用AXIS 1.4
在我的GWT
服务器端访问SOAP
。
这是我的代码:
String result = "";
QName servQN = new QName("XYZService");
Service service = new Service( wsdlLocation, servQN );
Call call = (Call) service.createCall();
call.setOperationName("call");
call.setTargetEndpointAddress( endpointURL );
result += (String) call.invoke( new Object[] { "LOGIN", arr } );
然后,这是我创建的WSDL文件:
<?xml version ="1.0" encoding ="UTF-8" ?>
<definitions name="XYZ"
targetNamespace="http://xxx.yyyyy.com/xxxserv/soap/main.wdsl"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://xxx.yyyyy.com/xxxserv/soap/main.wdsl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<message name="getRequest">
<part name="action" type="xsd:string"/>
<part name="params" type="xsd:xml"/>
</message>
<message name="getResponse">
<part name="Result" type="xsd:xml"/>
</message>
<portType name="XYZPortType">
<operation name="get">
<input message="tns:getRequest"/>
<output message="tns:getResponse"/>
</operation>
</portType>
<binding name="XYZBinding" type="tns:XYZPortType">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="get">
<soap:operation soapAction="urn:localhost-main#get"/>
<input>
<soap:body use="encoded" namespace="urn:localhost-main"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:localhost-main"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="XYZService">
<port name="XYZPort" binding="tns:XYZBinding">
<soap:address location="http://xxx.yyyyy.com/xxxserv/soap/server.php"/>
</port>
</service>
当我在开发模式下运行这个时,我得到了这个错误:
javax.xml.rpc.ServiceException: Error processing WSDL document:
java.io.IOException: Type {http://www.w3.org/2001/XMLSchema}xml is referenced but not defined.
我在WSDL文件中做错了什么?请帮助。
您的WSDL定义了引用称为xsd:xml
的类型的两个消息部分。然而,这种类型并不存在。注意,您可以在这里查阅XML模式规范定义的类型列表:
http://www.w3.org/TR/xmlschema-2/built-in-primitive-datatypes