Xml 复杂类型的Axis WSDL无法验证
我遇到了一些wsdl模式名称空间地狱 我有一个来自Axis web服务的WSDL,我正在使用WCF生成一个存根服务以进行测试 问题是,SVCUTIL工具生成的代码很好,但在托管时,不会公开任何方法 我检查了WSDL,有一行验证失败。我试图检查这是否是罪魁祸首,但名称空间太乱了,我无法理解它的头绪 因此,WSDL大致是这样的。我介绍了WSDL绑定、服务和端口,因为我只想重点了解名称空间问题Xml 复杂类型的Axis WSDL无法验证,xml,wcf,wsdl,xsd,axis,Xml,Wcf,Wsdl,Xsd,Axis,我遇到了一些wsdl模式名称空间地狱 我有一个来自Axis web服务的WSDL,我正在使用WCF生成一个存根服务以进行测试 问题是,SVCUTIL工具生成的代码很好,但在托管时,不会公开任何方法 我检查了WSDL,有一行验证失败。我试图检查这是否是罪魁祸首,但名称空间太乱了,我无法理解它的头绪 因此,WSDL大致是这样的。我介绍了WSDL绑定、服务和端口,因为我只想重点了解名称空间问题 <?xml version="1.0" encoding="UTF-8"?> <w
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:axis2="http://p1-services.customer.com/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:ns0="http://returnobject.foo.bar.com/xsd"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:ns1="http://ws.receiver.foo.bar.com" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
targetNamespace="http://p1-services.customer.com/">
<wsdl:documentation>WSP1IA01Service</wsdl:documentation>
<wsdl:types>
<xs:schema xmlns:ax22="http://returnobject.foo.bar.com/xsd"
attributeFormDefault="qualified"
elementFormDefault="qualified" targetNamespace="http://returnobject.foo.bar.com/xsd">
<xs:complexType name="ReturnEnvelope">
<xs:sequence>
<!-- Simplified -->
<xs:element minOccurs="0" name="errorCode" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
<xs:schema xmlns:ns="http://ws.receiver.foo.bar.com" attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://ws.receiver.foo.bar.com">
<xs:element name="setMessage">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="xmlMessage" nillable="true" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="setMessageResponse">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="return" nillable="true" type="ns0:ReturnEnvelope"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
</wsdl:types>
</wsdl:definitions>
WSP1IA01服务
验证失败的位是对SetMessageResponse元素中ns0:ReturnEnvelope的引用。它说找不到类型
我无法理解为什么,因为上面声明的类型带有指向NS0前缀的targetNamespace
有什么想法吗?那些类型声明应该如此复杂吗
另外,这种构造的目的是什么:
<xs:schema xmlns:ax22="http://returnobject.foo.bar.com/xsd"
我不熟悉您的工具集,但我可以看到一个可能导致问题的问题。首先,一些基线:
在wsdl:types
中定义了两种模式。第一个用于名称空间http://returnobject.foo.bar.com/xsd
其中包含类型ReturnEnvelope
第二个模式用于名称空间http://ws.receiver.foo.bar.com
并从http://returnobject.foo.bar.com/xsd
名称空间
ax22
未使用且不必要,但它的存在不会干扰表示相同命名空间的ns0
第二个模式定义可以“看到”ns0,因为第二个模式定义嵌套在定义前缀的wsdl:definitions
中。但是,第二个模式不能使用该名称空间的模式内容(第一个模式);他们是没有联系的兄弟姐妹。要允许使用另一个命名空间的类型,需要向第二个架构添加xs:import
元素:
<xs:import namespace="http://returnobject.foo.bar.com/xsd"/>
根据工具的不同,您可能还必须使用schemaLocation
告诉它该模式所在的位置,但希望它能够找到它,因为它们彼此紧挨着