将 Jaxb 架构与 Spring WS 结合使用:解组响应时出现的问题
我有一个 XML 架构,其中声明了所有请求和响应对象。
-------- For Actual Object -------
<xs:complexType name="conversation">
<xs:sequence>
<xs:element name="ID" type="xs:integer"/>
<xs:element name="startDate" type="xs:dateTime"/>
<xs:element name="endDate" type="xs:dateTime"/>
<xs:element name="participants" type="xs:string" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
-------- For Request -----------
<xs:element name="GetListRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="userId" type="xs:string" />
<xs:element name="date" type="xs:long" />
<xs:element name="dateTo" type="xs:long" />
</xs:sequence>
</xs:complexType>
-------- For Response -----------
</xs:element>
<xs:element name="GetListResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="conversations" type="hmp:conversation" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
但我需要创建一个新的删除请求,并且只希望删除的行数作为响应。因此,我创建了以下内容:
-------- For DELETION ( I only need to retrieve the number of rows deleted) -------
<xs:element name="deleted" type="xs:integer"/>
-------- For Response -----------
<xs:element name="GetDelConversationListResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="deletes" type="hmp:deleted" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
但它抱怨无法解析名称 hmp:deleted。我相信我需要将其添加到 WSDL 或其他内容中?有人可以帮忙吗?
I have a XML Schema where I've declared all the Requests and Responses objects.
-------- For Actual Object -------
<xs:complexType name="conversation">
<xs:sequence>
<xs:element name="ID" type="xs:integer"/>
<xs:element name="startDate" type="xs:dateTime"/>
<xs:element name="endDate" type="xs:dateTime"/>
<xs:element name="participants" type="xs:string" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
-------- For Request -----------
<xs:element name="GetListRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="userId" type="xs:string" />
<xs:element name="date" type="xs:long" />
<xs:element name="dateTo" type="xs:long" />
</xs:sequence>
</xs:complexType>
-------- For Response -----------
</xs:element>
<xs:element name="GetListResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="conversations" type="hmp:conversation" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
But I need to create a new deletion request and want only the number of rows deleted as a reponse back. So, I have created the following:
-------- For DELETION ( I only need to retrieve the number of rows deleted) -------
<xs:element name="deleted" type="xs:integer"/>
-------- For Response -----------
<xs:element name="GetDelConversationListResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="deletes" type="hmp:deleted" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
But its complaining about cannot resolve the name hmp:deleted. I believe I need to add this in the WSDL or something?? Could somebody pls help??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您说
type="hmp:deleted"
时,那么您的架构中必须定义一个相应的类型,而您没有该类型(您已经定义了一个名为deleted
的元素) code>,但不是类型)。您应该能够做到这一点,这更简单:
When you say
type="hmp:deleted"
, then there must be a corresponding type defined in your schema, which you don't have (you've defined an element calleddeleted
, but not a type).You should be able to do this, which is simpler: