我通过以下格式请求的方法获得服务:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:com="http://com.org.srv">
<soapenv:Header/>
<soapenv:Body>
<com:methodName>
<com:someParam>value</com:someParam>
<com:param name="firstPoint">
<com:param name="code">value</com:param>
</com:param>
<com:param name="firstPointDesc">
<com:param name="pName">value</com:param>
<com:param name="pLo">value</com:param>
</com:param>
<com:param name="endPoint">
<com:param name="code">value</com:param>
</com:param>
<com:param name="endPointDesc">
<com:param name="pName">value</com:param>
<com:param name="pLo">value</com:param>
</com:param>
<com:param name="bunch">
<com:param name="temperature">val</com:param>
<com:param name="humidity">val</com:param>
<com:param name="pressure">val</com:param>
</com:param>
</com:methodName>
</soapenv:Body>
</soapenv:Envelope>
此信息按原样提供,我需要在eclipse中的xsd文件中对其进行描述。 我试过了:
<element name="methodNameRequest">
<complexType>
<sequence maxOccurs="1" minOccurs="1">
<element name="someParam" type="string" maxOccurs="1"
minOccurs="1">
</element>
<element name="deviceId" type="string"></element>
<element name="param" maxOccurs="1" minOccurs="1">
<complexType>
<sequence>
<element name="param" maxOccurs="1"
minOccurs="1">
<complexType>
<simpleContent>
<extension base="string">
<attribute name="name"
type="string" default="code" />
</extension>
</simpleContent>
</complexType>
</element>
</sequence>
<attribute name="name" type="string"
default="firstPoint" />
</complexType>
</element>
<element name="params" maxOccurs="1" minOccurs="1">
<complexType>
<sequence>
<element name="param" maxOccurs="1"
minOccurs="1">
<complexType>
<simpleContent>
<extension base="string">
<attribute name="name"
type="string" default="pName" />
</extension>
</simpleContent>
</complexType>
</element>
<element name="param" maxOccurs="1"
minOccurs="1">
<complexType>
<simpleContent>
<extension base="string">
<attribute name="name"
type="string" default="pLo" />
</extension>
</simpleContent>
</complexType>
</element>
</sequence>
<attribute name="name" type="string"
default="firstPointDesc" />
</complexType>
</element>
<element name="params" maxOccurs="1" minOccurs="1">
<complexType>
<sequence>
<element name="param" maxOccurs="1"
minOccurs="1">
<complexType>
<simpleContent>
<extension base="string">
<attribute name="name"
type="string" default="code" />
</extension>
</simpleContent>
</complexType>
</element>
</sequence>
<attribute name="name" type="string"
default="endPoint" />
</complexType>
</element>
<element name="params" maxOccurs="1" minOccurs="1">
<complexType>
<sequence>
<element name="param" maxOccurs="1"
minOccurs="1">
<complexType>
<simpleContent>
<extension base="string">
<attribute name="name"
type="string" default="pName" />
</extension>
</simpleContent>
</complexType>
</element>
<element name="param" maxOccurs="1"
minOccurs="1">
<complexType>
<simpleContent>
<extension base="string">
<attribute name="name"
type="string" default="pLo" />
</extension>
</simpleContent>
</complexType>
</element>
</sequence>
<attribute name="name" type="string"
default="endPointDesc" />
</complexType>
</element>
<element name="param" maxOccurs="1" minOccurs="1">
<complexType>
<sequence>
<element name="param" maxOccurs="1"
minOccurs="1">
<complexType>
<simpleContent>
<extension base="string">
<attribute name="name"
type="string" default="temperature" />
</extension>
</simpleContent>
</complexType>
</element>
<element name="param" maxOccurs="1"
minOccurs="1">
<complexType>
<simpleContent>
<extension base="string">
<attribute name="name"
type="string" default="humidity" />
</extension>
</simpleContent>
</complexType>
</element>
<element name="param" maxOccurs="1"
minOccurs="1">
<complexType>
<simpleContent>
<extension base="string">
<attribute name="name"
type="string" default="pressure" />
</extension>
</simpleContent>
</complexType>
</element>
</sequence>
<attribute name="name" type="string"
default="bunch" />
</complexType>
</element>
....
但没有成功:eclipse报告了Multiple elements with name 'param', with different types, appear in the model group.
。
任何人都可以为此或类似结构提供xsd
描述的有效示例吗?
我与wsdl架构和服务完全没有共同之处。
非常感谢。
答案 0 :(得分:1)
XML词汇表的设计者似乎一直致力于使用普通的XML工具使XML无法生效;他们可能已经成功了。为了挫败他们的邪恶计划,你最好的选择可能是将他们的XML映射到同构但更容易验证的XML(例如,使这些属性值成为元素名称),或者查看XSD 1.1断言,并处理你的XPath 2.0技能。