键入{http://www.w3.org/2001/XMLSchema}xml已引用但未定义

时间:2011-12-01 07:59:23

标签: gwt soap wsdl axis

我在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文件中做错了什么?请帮忙。

1 个答案:

答案 0 :(得分:1)

您的WSDL定义了两个引用名为xsd:xml的类型的消息部分。但是,这种类型不存在。请注意,您可以在此处查阅XML模式规范定义的类型列表:

http://www.w3.org/TR/xmlschema-2/#built-in-primitive-datatypes