@JJD 我看到你给我留言了here https://stackoverflow.com/questions/8968620/android-soapfault-error/9042499#comment11653966_9042499
我一会儿要开会,但我看了你的问题,很乐意为你提供尽可能多的帮助。我发现您在阅读架构定义时遇到问题。您拥有的这个 ws 定义是一个又一个的链接,这就是为什么它让您在阅读时感到困惑:
如果你继续:http://schemas.opengis.net/wfs/1.1.0/wfs.xsd http://schemas.opengis.net/wfs/1.1.0/wfs.xsd
采用“GetCapability”方法,让我们在 Web 服务定义中读取它:
PS:我没有测试这些,但是:
- 我认为命名空间应该是:http://www.opengis.net/wfs http://www.opengis.net/wfs(来自目标命名空间)
- 方法名称:获取能力
- url: http://schemas.opengis.net/wfs/1.1.0/wfs.xsd http://schemas.opengis.net/wfs/1.1.0/wfs.xsd
现在您有 GetCapability 的请求:
<!-- REQUEST -->
<xsd:element name="GetCapabilities" type="wfs:GetCapabilitiesType"/>
<xsd:complexType name="GetCapabilitiesType">
<xsd:annotation>
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="ows:GetCapabilitiesType">
<xsd:attribute name="service" type="ows:ServiceType" use="optional" default="WFS"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
GetCapability 有一个复杂的类型:GetCapabilityType,您可以在本页的 xsd 链接之一中找到它,准确地说“owsGetCapability.xsd”
--> 打开后,即:http://schemas.opengis.net/ows/1.0.0/owsGetCapability.xsd http://schemas.opengis.net/ows/1.0.0/owsGetCapabilities.xsd
您会发现这个复杂的类型定义:
<complexType name="GetCapabilitiesType">
<annotation>
<documentation>
XML encoded GetCapabilities operation request. This operation
allows clients to retrieve service metadata about a specific service instance.
In this XML encoding, no "request" parameter is included, since the element name
specifies the specific operation. This base type shall be extended by each specific
OWS to include the additional required "service" attribute, with the correct value for that OWS.
</documentation>
</annotation>
<sequence>
<element name="AcceptVersions" type="ows:AcceptVersionsType" minOccurs="0">
<annotation>
<documentation>When omitted, server shall return latest supported version.
</documentation>
</annotation>
</element>
<element name="Sections" type="ows:SectionsType" minOccurs="0">
<annotation>
<documentation>
When omitted or not supported by server,
server shall return complete service metadata (Capabilities) document.
</documentation>
</annotation>
</element>
<element name="AcceptFormats" type="ows:AcceptFormatsType" minOccurs="0">
<annotation>
<documentation>
When omitted or not supported by server, server shall return service metadata
document using the MIME type "text/xml".
</documentation>
</annotation>
</element>
</sequence>
<attribute name="updateSequence" type="ows:UpdateSequenceType" use="optional">
<annotation>
<documentation>
When omitted or not supported by server,
server shall return latest complete service
metadata document.
</documentation>
</annotation>
</attribute>
</complexType>
现在这个 GetCapabilityType 有元素/属性:
name="AcceptVersions" of type="ows:AcceptVersionsType" 和 minOccurs="0" 即可以为 null
name="Sections" of type="ows:SectionsType" 和 minOccurs="0" 即可以为 null
name="AcceptFormats" of type="ows:AcceptFormatsType" 和 minOccurs="0" 即可以为 null
name="updateSequence" of type="ows:UpdateSequenceType" 且其是可选的 -->use="optional"
在哪里可以找到这些属性定义?
-->在同一页面上您有:AcceptVersionsType 是:
<complexType name="AcceptVersionsType">
<annotation>
<documentation>
Prioritized sequence of one or more specification versions accepted by client, with preferred versions listed first. See Version negotiation subclause for more information.
</documentation>
</annotation>
<sequence>
<element name="Version" type="ows:VersionType" maxOccurs="unbounded"/>
</sequence>
</complexType>
因此 AcceptVersionsType 有一个类型为 VersionType 的元素,可以在 xsd 中找到owsOperationsMetadata.xsd(位于此页面的同一链接上),在其上有 xsd:owsCommon.xsd,这是找到 VersionType 的地方
IE: http://schemas.opengis.net/ows/1.0.0/owsCommon.xsd http://schemas.opengis.net/ows/1.0.0/owsCommon.xsd
<simpleType name="VersionType">
<annotation>
<documentation>Specification version for OWS operation. The string value shall contain one x.y.z "version" value (e.g., "2.1.3"). A version number shall contain three non-negative integers separated by decimal points, in the form "x.y.z". The integers y and z shall not exceed 99. Each version shall be for the Implementation Specification (document) and the associated XML Schemas to which requested operations will conform. An Implementation Specification version normally specifies XML Schemas against which an XML encoded operation response must conform and should be validated. See Version negotiation subclause for more information. </documentation>
</annotation>
<restriction base="string"/>
</simpleType>
和sectionsType是:
<complexType name="SectionsType">
<annotation>
<documentation>
Unordered list of zero or more names of requested sections in complete service metadata document. Each Section value shall contain an allowed section name as specified by each OWS specification. See Sections parameter subclause for more information.
</documentation>
</annotation>
<sequence>
<element name="Section" type="string" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
(SectionsType 有一个简单类型 String 的元素)
AcceptFormatsType 是:
<complexType name="AcceptFormatsType">
<annotation>
<documentation>
Prioritized sequence of zero or more GetCapabilities operation response formats desired by client, with preferred formats listed first. Each response format shall be identified by its MIME type. See AcceptFormats parameter use subclause for more information.
</documentation>
</annotation>
<sequence>
<element name="OutputFormat" type="ows:MimeType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
(AcceptFormatsType 有一个 MimeType 类型的元素,它与 VersionType 位于同一位置,即:http://schemas.opengis.net/ows/1.0.0/owsCommon.xsd http://schemas.opengis.net/ows/1.0.0/owsCommon.xsd
<simpleType name="MimeType">
<annotation>
<documentation>XML encoded identifier of a standard MIME type, possibly a parameterized MIME type. </documentation>
</annotation>
<restriction base="string">
<pattern value="(application|audio|image|text|video|message|multipart|model)/.+(;s*.+=.+)*"/>
</restriction>
</simpleType>
而 UpdateSequenceType 是(它是简单类型而不是复杂类型):
<simpleType name="UpdateSequenceType">
<annotation>
<documentation>
Service metadata document version, having values that are "increased" whenever any change is made in service metadata document. Values are selected by each server, and are always opaque to clients. See updateSequence parameter use subclause for more information.
</documentation>
</annotation>
<restriction base="string"/>
</simpleType>
(UpdateSequenceType是一个简单类型)
现在我希望它能更清楚地了解如何阅读架构。
现在复杂型表示与简单类型(例如:int)不同的对象。当您具有复杂类型并且使用 ksoap2 时,您必须在实现 kvmSerialized(ksoap2 序列化接口)的类(对象)中创建本地表示。
现在,您可以阅读我的答案以了解如何执行此操作:Link1 https://stackoverflow.com/questions/9023442/android-wsdl-web-service-ksoap2/9042267#9042267,link2 https://stackoverflow.com/questions/8968620/android-soapfault-error/9042499#9042499,link3 https://stackoverflow.com/questions/9068161/android-calling-net-webservice-ksoap2/9074239#9074239。我写了一些详细信息,将帮助您了解如何开始编码。
我今天不会使用电脑。希望这会有所帮助,如果我所说的任何内容含糊不清,请告诉我。