我想通过使用xsd从soap xml生成类。我已经成功至今,但现在,我有这个SOAP消息:将wsdl文件导入到xsd文件
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"
xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
<SOAP-ENV:Body>
<tds:GetSystemDateAndTime/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
XSD会产生这样的:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="Envelope" targetNamespace="http://www.w3.org/2003/05/soap-envelope"
xmlns:mstns="http://www.w3.org/2003/05/soap-envelope"
xmlns="http://www.w3.org/2003/05/soap-envelope"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified"
xmlns:app1="http://www.onvif.org/ver10/device/wsdl">
<xs:import namespace="http://www.onvif.org/ver10/device/wsdl" schemaLocation="GetSystemDateAndTime_app1.xsd" />
<xs:element name="Envelope" msdata:IsDataSet="true" msdata:Locale="en-US" msdata:Prefix="SOAP-ENV">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Body" msdata:Prefix="SOAP-ENV">
<xs:complexType>
<xs:sequence>
<xs:element ref="app1:GetSystemDateAndTime" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
此的xmlns:TDS =“HTTP://www.onvif .org/ver10/device/wsdl“链接this document。
正如我所说的,到目前为止,我只是下载了一个位于schemaLocation属性中的文件,将它放到了像xsd文件一样的文件夹并更改了路径。然后我使用“xsd myXsdFile.xsd otherXsdFiles.xsd/c”。但对于wsdl文件,这是不可能的。 SchemaLocation属性不包含wsdl文件,当然当我使用xsd commnand时,我会收到GetSystemDateAndTime不存在的消息。我知道wsdl文件与xsd非常不同,但我无法采取正确的方式,如何将这个文件与我的xsd文件结合。有什么建议吗? Thx
Thx,用于回复。这是我的错误。我不得不写这个:“xsd GetSystemDateAndTime.xsd GetSystemDateAndTime_app1.xsd/c”。我不知道,我发现我必须将schemaLocation属性更改为生成类。我愚蠢的错误。 – Hyen 2012-03-09 13:01:31