0

I am able to create the attributes with all the xmlns, however not able to create the attributes below which are non xmlns like ft:record="true" ft:status=""...I scanned the java doc and the whole web but cannot find the solution or approach for adding the non xmlns attributes to the schema header using JAX-B. Do JAX-B have any provision?

<myaccount str:strns="true" ft:record="true" ft:status="" ft:num="0" xmlns:str="urn:ins.com:qmodel:wcpsstructs:v1">
</myaccount>

Below is my package-info.java:

@XmlSchema(namespace = "urn:ins.com:qmodel:wcpsstructs:v1",
    elementFormDefault = XmlNsForm.QUALIFIED,
    xmlns={
         @XmlNs(namespaceURI="urn:ins.com:qmodel:wcpsstructs:v1", prefix = "str")
})
package com.mypackage.domain.outputspec;
import javax.xml.bind.annotation.*;

My Maven dependencies:

<dependency>
    <groupId>javax.xml</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.1</version>
</dependency>
<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
    <version>2.2.7</version>
</dependency>
Joe
  • 15
  • 5
  • So you are saying that these prefixes cannot be set in the header? In other words, there is no provision to set the prefixes or attributes like str:strns="true" ft:record="true" ft:status="" ft:num="0" in the header while marshalling? – Joe Oct 21 '16 at 02:45
  • Yes you got it. Though I am setting the namespaces starting with xmlns under the package-info.java (posted above), but the prefixes which are not part of the namespaces in other words are independent of the namespaces, seems like there is no provision to set in the header. By the way I am using this as a soap request to invoke a web service, so I am constructing the request or CDATA and these attributes are part of the request as per the sample given to us by the client or web service owner.. :) – Joe Oct 21 '16 at 15:06
  • I have resolved this issue on the question I have asked. Using the Xml Attribute annotation did the trick.. Thanks anyway. – Joe Oct 25 '16 at 16:21

0 Answers0