在Web服务响应中升级WAS之后的Xmlns前缀

时间:2015-09-16 03:40:35

标签: java xsd jaxb websphere-7 websphere-8

非常感谢你的帮助。问题是我的WAS从7升级到8.5。在升级之前,这是一个典型的答案:

<SoftwareProductResponse xmlns="http://w3.ibm.com/xmlns/ibmww/expt/ProductTaxonomyInformation/v1.0">
  <softwareProducts>
    <productName>WebSphere Application Server</productName>
    <productSynonym>
      <productSource>masterSoftwareIndex</productSource>
      <productName>WebSphere Application Server</productName>
    </productSynonym>...
    ...
    ..
    .

在WAS升级后,我得到以下内容,请注意前缀&#34; a:&#34;在某些标签中:

<a:SoftwareProductResponse xmlns:a="http://w3.ibm.com/xmlns/ibmww/expt/ProductTaxonomyInformation/v1.0">
  <softwareProducts>
    <a:productName>WebSphere Application Server</a:productName>
    <productSynonym>
      <a:productSource>masterSoftwareIndex</a:productSource>
      <a:productName>WebSphere Application Server</a:productName>
    </productSynonym>...
    ...
    ..

此响应的消费者太多,我不能要求他们修改他们的客户端来处理这个新的前缀,所以我尝试了几个尝试完全删除任何前缀但没有成功的事情。我知道这是因为我有两个不同的命名空间,似乎WAS 8自动创建a和b前缀。但是,为什么在WAS 7之前没有前缀让我烦恼?

一个重要的问题是:当多个名称空间存在问题时,是否有可能摆脱任何前缀?

XSD片段:

&#13;
&#13;
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	targetNamespace="http://w3.ibm.com/xmlns/ibmww/expt/ProductTaxonomyInformation/v3.0"
	xmlns:pti="http://w3.ibm.com/xmlns/ibmww/expt/ProductTaxonomyInformation/v3.0"
	elementFormDefault="qualified">
	

	<!-- Indicates schema version, which can be used by server to dictate client 
		responses; format is X.YY.ZZ where YY and ZZ can be 00-99 (00 is assumed 
		if there is a single 0) -->
	<simpleType name="PTISchemaVersion">
		<restriction base="string">
			<enumeration value="v1.0.10" />
		</restriction>
	</simpleType>

	<!--============================================================ -->
	<!-- Response related -->
	<!--============================================================ -->

	<!-- Defining responses as elements allows them to be an XML root node for 
		JAXB. -->


	<element name="SoftwareProductResponse" nillable="true"
		type="pti:SoftwareProductResponse" />
	<complexType name="SoftwareProductResponse">
		<sequence>
			<element name="softwareProducts" nillable="true"
				type="pti:SoftwareProduct" minOccurs="0" maxOccurs="unbounded" />
		</sequence>
	</complexType>

	<complexType name="SoftwareProduct">
		<complexContent>
			<extension base="pti:Product">
				<sequence>
					<element name="productName" nillable="true" type="string"
						minOccurs="0" />
					<!-- Describes primary product names from other "software product name" 
						data sources -->
					<element name="productSynonym" nillable="true"
						type="pti:SoftwareProductSynonym" minOccurs="0" maxOccurs="unbounded" />
					<!-- Aliases for the product name -->
					<element name="aliases" nillable="true" type="pti:NameAlias"
						minOccurs="0" maxOccurs="unbounded" />
					<!-- Human-readable description of the SSP -->
					<element name="description" nillable="true" type="string"
						minOccurs="0" />

					<!-- Associated product codes -->
					<element name="offeringClassificationCode" nillable="true"
						type="pti:OfferingClassificationCode" minOccurs="0" />
					<element name="masterSoftwareIndexSynKey" nillable="true"
						type="string" minOccurs="0" />
					<element name="questCode" nillable="true" type="pti:QuestCode"
						minOccurs="0" />
					<element name="originalBrandQuestCode" nillable="true"
						type="pti:QuestCode" minOccurs="0" />
					<element name="relatedSearchOfferingClassificationCodes"
						nillable="true" type="pti:OfferingClassificationCode" minOccurs="0"
						maxOccurs="unbounded" />

					<!-- Associated miscellaneous properties -->
					<!-- primary brand (generally used for reporting and metrics) -->
					<element name="primaryBrand" nillable="true" type="pti:Brand"
						minOccurs="0" />
					<!-- secondary brands (generally used for on-the-glass organizational 
						purposes) -->
					<element name="secondaryBrands" nillable="true" type="pti:Brand"
						minOccurs="0" maxOccurs="unbounded" />
					<element name="owningDivision" nillable="true" type="string"
						minOccurs="0" />
					<element name="productType" nillable="true" type="string"
						minOccurs="0" />
					<element name="masterSoftwareIndexWebShortName" nillable="true"
						type="string" minOccurs="0" />
					<!-- Deprecated as of v1.0.10; instead use productType -->
					<element name="masterSoftwareIndexProductType" nillable="true"
						type="string" minOccurs="0" />
					<element name="supportAToZ" nillable="true" type="boolean"
						minOccurs="0" />
					<!-- i.e., indicates the presence of a Q115A IConS template -->
					<element name="supportContentAvailable" nillable="true"
						type="boolean" minOccurs="0" />
					<element name="myNotificationsSupport" nillable="true"
						type="boolean" minOccurs="0" />
					<!-- Indicates whether this software product is considered to be a ServiceableSoftwareProduct 
						(SSP) -->
					<element name="ssp" nillable="true" type="boolean"
						minOccurs="0" />
					<!-- Indicates whether this software product is considered to be in 
						preview mode -->
					<element name="preview" nillable="true" type="boolean"
						minOccurs="0" />
					<!-- Indicates whether this software product is expandable (only applicable 
						for SSPs) -->
					<element name="expandable" nillable="true" type="boolean"
						minOccurs="0" />
					<element name="supportURL" nillable="true" type="pti:ReferenceURI"
						minOccurs="0" />

					<!-- Associated VRMs -->
					<element name="vrms" nillable="true" type="pti:SoftwareProductVRM"
						minOccurs="0" maxOccurs="unbounded" />

					<!-- Associated ContentComponents (i.e., DCF components) -->
					<element name="contentComponents" nillable="true"
						type="pti:ContentComponent" minOccurs="0" maxOccurs="unbounded" />

					<!-- Defines child software products; only applicable for SSPs -->
					<element name="softwareProductChildren" nillable="true"
						type="pti:SoftwareProduct" minOccurs="0" maxOccurs="unbounded" />

				</sequence>
			</extension>
		</complexContent>
	</complexType>

	<!-- Indicates software product synonyms -->
	<complexType name="SoftwareProductSynonym">
		<complexContent>
			<extension base="pti:PTIBaseType">

				<sequence>
					<element name="productSource" nillable="true"
						type="pti:SoftwareProductSource" minOccurs="0" />
					<element name="productName" nillable="true" type="string"
						minOccurs="0" />
				</sequence>
			</extension>
		</complexContent>
	</complexType>
&#13;
&#13;
&#13;

&#13;
&#13;
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
	targetNamespace="http://w3.ibm.com/xmlns/ibmww/expt/ProductTaxonomyInformation/v1.0"
	xmlns:pti="http://w3.ibm.com/xmlns/ibmww/expt/ProductTaxonomyInformation/v1.0"
	elementFormDefault="qualified">
	
	<!-- Indicates schema version; can be used by server to dictate client responses -->
	<simpleType name="PTISchemaVersion">
		<restriction base="string">
			<enumeration value="v1.0.0" />
		</restriction>
	</simpleType>
	

	<element name="SoftwareProductResponse" nillable="true" type="pti:SoftwareProductResponse"/>
	<complexType name="SoftwareProductResponse">
		<sequence>
			<element name="softwareProducts" nillable="true" type="pti:SoftwareProduct" minOccurs="0" maxOccurs="unbounded"/>
		</sequence>
	</complexType>
	
	
	<complexType name="SoftwareProduct">
		<complexContent>
			<extension base="pti:Product">
				<sequence>
					<element name="productName" nillable="true" type="string" minOccurs="0"/>
					<element name="productSynonym" nillable="true" type="pti:SoftwareProductSynonym" minOccurs="0" maxOccurs="unbounded"/>
					
					<!-- Associated product codes -->
					<element name="offeringClassificationCode" nillable="true" type="pti:OfferingClassificationCode" minOccurs="0"/>
					<element name="masterSoftwareIndexSynKey" nillable="true" type="string" minOccurs="0"/>
					<element name="questCode" nillable="true" type="pti:QuestCode" minOccurs="0"/>
					<element name="relatedSearchOfferingClassificationCodes" nillable="true" type="pti:OfferingClassificationCode" minOccurs="0" maxOccurs="unbounded"/>
					
					<!-- Associated miscellaneous properties -->
					<element name="owningDivision" nillable="true" type="string" minOccurs="0"/>
					<element name="masterSoftwareIndexProductType" nillable="true" type="string" minOccurs="0"/>
					<element name="supportAToZ" nillable="true" type="boolean" minOccurs="0"/>
					<!-- i.e., indicates the presence of a Q115A IConS template -->
					<element name="supportContentAvailable" nillable="true" type="boolean" minOccurs="0"/>
					<element name="myNotificationsSupport" nillable="true" type="boolean" minOccurs="0"/>
					<element name="supportURL" nillable="true" type="pti:ReferenceURI" minOccurs="0"/>
					
					<!-- Associated VRMs -->
					<element name="vrms" nillable="true" type="pti:SoftwareProductVRM" minOccurs="0" maxOccurs="unbounded"/>
					
					<!-- Associated ContentComponents (i.e., DCF components) -->
					<element name="contentComponents" nillable="true" type="pti:ContentComponent" minOccurs="0" maxOccurs="unbounded"/>
				</sequence>
			</extension>
		</complexContent>
	</complexType>
	<!-- Indicates software product synonyms -->
	<complexType name="SoftwareProductSynonym">
		<sequence>
			<element name="productSource" nillable="true" type="pti:SoftwareProductSource" minOccurs="0"/>
			<element name="productName" nillable="true" type="string" minOccurs="0"/>
		</sequence>
	</complexType>
	
&#13;
&#13;
&#13;

SoftwareProductResponse.java:

@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name =&#34; SoftwareProductResponse&#34;,propOrder = {     &#34; softwareProducts&#34; }) 公共类SoftwareProductResponse {

@XmlElement(nillable = true)
protected List<SoftwareProduct> softwareProducts;

/**
 * Gets the value of the softwareProducts property.
 * 
 * <p>
 * This accessor method returns a reference to the live list,
 * not a snapshot. Therefore any modification you make to the
 * returned list will be present inside the JAXB object.
 * This is why there is not a <CODE>set</CODE> method for the softwareProducts property.
 * 
 * <p>
 * For example, to add a new item, do as follows:
 * <pre>
 *    getSoftwareProducts().add(newItem);
 * </pre>
 * 
 * 
 * <p>
 * Objects of the following type(s) are allowed in the list
 * {@link SoftwareProduct }
 * 
 * 
 */
public List<SoftwareProduct> getSoftwareProducts() {
    if (softwareProducts == null) {
        softwareProducts = new ArrayList<SoftwareProduct>();
    }
    return this.softwareProducts;
}

}

如何删除所有前缀?

谢谢!

0 个答案:

没有答案