Java XML命名空间扩展导致SOAP信封中出现命名空间错误
我有一个SOAP信封,我正在其中添加一个响应负载。我已经定义了名称空间:Java XML命名空间扩展导致SOAP信封中出现命名空间错误,java,xml,spring,soap,xalan,Java,Xml,Spring,Soap,Xalan,我有一个SOAP信封,我正在其中添加一个响应负载。我已经定义了名称空间: xmlns="http://custom.nsendpoint.com/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 在响应元素中 在custom.nsendpoint.com/1.1 XSD中,有2个从基类型扩展而来的元素: <xs:complexType name="Contact"> <xs:annotation
xmlns="http://custom.nsendpoint.com/1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
在响应元素中
在custom.nsendpoint.com/1.1 XSD中,有2个从基类型扩展而来的元素:
<xs:complexType name="Contact">
<xs:annotation>
<xs:documentation>
A Contact
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="EmailAddress" type="s:ContactEmailAddress" minOccurs="0" maxOccurs="1" nillable="true" />
<xs:element name="Address" type="s:Address" minOccurs="0" maxOccurs="1" nillable="true" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="CompanyContact">
<xs:annotation>
<xs:documentation>
Company Contact type
</xs:documentation>
</xs:annotation>
<xs:complexContent>
<xs:extension base="Contact">
<xs:sequence>
<xs:element name="Name" type="s:CompanyName" minOccurs="1" maxOccurs="1" nillable="true" />
<xs:element name="Type" type="s:CompanyType" minOccurs="0" maxOccurs="1" nillable="true" />
<xs:element name="Size" type="s:CompanySize" minOccurs="0" maxOccurs="1" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="PersonContact">
<xs:annotation>
<xs:documentation>
Person Contact type
</xs:documentation>
</xs:annotation>
<xs:complexContent>
<xs:extension base="Contact">
<xs:sequence>
<xs:element name="Title" type="s:PersonTitle" minOccurs="1" maxOccurs="1"/>
<xs:element name="FirstName" type="s:PersonFirstName" minOccurs="1" maxOccurs="1" />
<xs:element name="MiddleName" type="s:PersonMiddleName" minOccurs="0" maxOccurs="1" nillable="true" />
<xs:element name="LastName" type="s:PersonLastName" minOccurs="1" maxOccurs="1" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
当我深入研究transform
方法逻辑时,我看到它在org.apache.xml.serializer.TreeWalker
对象上调用的traverse
方法上失败,它说:
Method threw 'org.xml.sax.SAXException' exception
如果删除联系人类型上的xsi:前缀,错误消息就会消失
谁能告诉我我做错了什么?我只是不知道我做错了什么
org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
Method threw 'org.xml.sax.SAXException' exception