尝试生成JAX-WS响应并获得异常

时间:2014-10-28 06:55:13

标签: java soap

我正在尝试生成JAX-WS响应并获得以下异常:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>

Could not generate the XML stream caused by: com.ctc.wstx.exc.WstxParsingException: Undeclared     namespace prefix "tns"&#xd;. at [row,col {unknown-source}]: [20,26].</faultstring></soap:Fault>
</return>

</soap:Body></soap:Envelope>

这是我的架构:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://url"
           xmlns:tns="http://url">
  <xs:element name="context" nillable="true" type="tns:context" />
  <xs:complexType name="context">
    <xs:sequence>      
      <xs:element minOccurs="0" maxOccurs="1" name="Recommendations" type="tns:ArrayOfElements" />
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="ArrayOfElements">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" name="Recommendation" nillable="true" type="tns:Recommendation" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="Recommendation">
    <xs:sequence>
      <xs:element minOccurs="1" maxOccurs="1" name="item" type="xs:int" />
    </xs:sequence>
  </xs:complexType>
  <xs:element name="Recommendation" nillable="true" type="tns:Recommendation" />
  <xs:element name="ArrayOfRecommendation" nillable="true" type="tns:ArrayOfRecommendation" />
</xs:schema>

任何建议可能是导致此错误的原因?我正在使用JBoss 6.2来实现这个JAX-WS

PS。添加ArrayOfRecommendation:

<xs:complexType name="ArrayOfRecommendation">
  <xs:sequence>
    <xs:element minOccurs="0" maxOccurs="unbounded" name="Recommendation" nillable="true"   type="tns:Recommendation" />
  </xs:sequence>
</xs:complexType>
<xs:complexType name="Recommendation">
  <xs:sequence>

0 个答案:

没有答案