我正在使用gSOAP从WSDL文档创建C++代码。问题是当我在WSDL文件上运行wsdl2h工具时,gSOAP给我带来了错误。这些错误都与名称空间问题有关。例如gSOAP和一般SOAP问题
Warning: could not find element 'GetRPCMethods' type '"http://www.broadband-forum.org/cwmp/cwmp-1-2.xsd":GetRPCMethods' in schema urn:tr069
我粘贴了命名空间的定义和它们是如何使用下面的例子。任何人都知道我要去哪里错了?
urn:tr069应该是指当前文档。
<s0:definitions
name="tr069"
xmlns:s0="http://schemas.xmlsoap.org/wsdl/"
xmlns:s1="urn:tr069"
xmlns:s2="http://schemas.xmlsoap.org/wsdl/soap/"
targetNamespace="urn:tr069">
<s0:types>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="urn:tr069"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd1="http://www.broadband-forum.org/cwmp/cwmp-1-2.xsd"
targetNamespace="urn:tr069">
<xsd:import namespace="urn:dslforum-org:cwmp-1-2" schemaLocation="cwmp-1-2.xsd" />
<xsd:element name="GetRPCMethods" type="xsd1:GetRPCMethods" />
</xsd:schema>
</s0:types>
<s0:message name="GetRPCMethods">
<s0:part element="s1:GetRPCMethods" name="GetRPCMethods" />
</s0:message>
</s0:definitions>
我有几个其他的问题,据我了解目标命名空间不具有指向的实际位置,它只是一个指向当前文档的公约,这是正确的吗?在cwmp-1-2.xsd中也有一个名为GetRPCMethods的元素,它包含一个包含另一个元素的序列。如上所述,最好使用整个元素(GetRPCMethods)作为消息的一部分,还是应该在消息中定义GetRPCMethods的特定部分?
谢谢。
对不起,我没有正确粘贴它的问题,我编辑了这个问题。是的,文件格式良好。所以targetNamespace可以是任何东西? – toc777 2011-03-01 16:18:28
是的,它可以是任何URI(URL或URN),但确保它是有意义的。例如,如果您决定使用URI并拥有域“mydomain”,我宁愿将它保留为> http:// mydomain/xml/types/item – javadeveloper 2011-03-02 15:14:49