jaxb

JAXB 2.1 - Customize xs:any binding

孤人 提交于 2020-01-10 19:29:55
问题 I want to generate java code from xsd using JAXB 2.1 XJC. I have an xsd schema provided and I can't change it. I would like to use xjc:simple mode while generating java classes from xml schema. In the xsd there are elements: <xs:any namespace="##other" processContents="lax"/> As it is stated here: http://jaxb.java.net/guide/Mapping_of__xs_any___.html I expected that these elements will be binded to: @XmlAnyElement(lax=true) public Object any; but when I use simple binding mode xjc:simple I

wsimport doesnt generate code related to soap headers

ぐ巨炮叔叔 提交于 2020-01-10 08:46:19
问题 I'm generating client java code from a wsdl using 'wsimport'. The wsdl has soap:header in the operation definitions like this <?xml version="1.0" encoding="utf-8"?> <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.test.com/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http:/

How to customize namespace prefixes on Jersey(JAX-WS)

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-10 04:10:35
问题 when serializing my resources on Jersey, I want to use namespaces in some cases. Is there any way to customize the namespace prefixes on jersey? Default: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <order xmlns:ns2="http://www.w3.org/2005/Atom"> <price>123</price> <ns2:link rel="duh" href="/abc/123"/> <ns2:link rel="abc" href="/def/234"/> </order> I want something like: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <order xmlns:atom="http://www.w3.org/2005/Atom"> <price

JAXBContext.newInstance memory leak

こ雲淡風輕ζ 提交于 2020-01-09 19:50:14
问题 After a recent deployment in system test, one of our servlets was getting hit much harder than usual and we noticed memory started climbing and weblogic would eventually die. My intern, I was very proud, discovered the source of the memory leak. Whenever a request comes in, this line gets called: JAXBContext jc = JAXBContext.newInstance(“ruby.oracle_servlet.schemas”); For some reason, the object never gets garbage collected. Once we made it static and moved where we initialized it, our memory

java class using jaxb api failing in jira with : Provider com.sun.xml.bind.v2.ContextFactory not found

最后都变了- 提交于 2020-01-09 11:18:34
问题 I am writing a plugin for Jira which involves parsing of XML documents. I am using JAXB to do so (XML to pojos and vice versa) So have a class which generates XML from pojos using JAXB. it looks like... import javax.xml.bind.*; Class Parser { public void m1() { ... // code which uses classes in javax.xml.bind.* } public static void main(String args[]){ Parser p=new Parser(); p.m1(); } } The mentioned packages will come with JDK distribution (rt.jar). so i haven't relayed on anything else to

Using JAXB to extract inner text of XML element

旧巷老猫 提交于 2020-01-09 05:28:05
问题 Problem Given the following XML configuration file: <main> <name>JET</name> <maxInstances>5</maxInstances> <parameters> <a>1</a> <b> <b1>test1</b1> <b2>test2</b2> </b> </parameters> </main> I need to extract the value of the name and maxInstances elements and then the whole inner text of the parameters element. e.g. name = "JET" maxInstances = 5 parameters = "<a>1</a><b><b1>test1</b1><b2>test2</b2></b>" Ultimately the parameters block can contain any well formed XML. Attempted Solution The

XML Schema to validate XML Schemas?

夙愿已清 提交于 2020-01-09 05:26:10
问题 Does anyone know if its possible to validate an XML schema with another XML schema? If so, is there a reference implementation out there? I would like to parse a Schema doc using JAXB. 回答1: Of course. Most of the time you can just point your browser to the URL that serves as the namespace for the XML document. This also works with XML Schema: http://www.w3.org/2001/XMLSchema The XSD is linked from there. 回答2: Also check XSOM. This is what JAXB RI uses to load and process XSDs. 回答3: There are

How to make generated classes contain Javadoc from XML Schema documentation

我只是一个虾纸丫 提交于 2020-01-09 04:38:05
问题 I'm currently working with an XML Schema that has <xsd:annotation> / <xsd:documentation> on most types and elements. When I generate Java Beans from this XML Schema, then the Javadoc of those Beans only contains some generic generated information about the allowed content of the type/element. I'd like to see the content of the <xsd:documentation> tag in the relevant places (for example the content of that tag for a complextType should show up in the Javadoc of the class generated to represent

Jaxb classes from schema generates getter setter method in uppercase

Deadly 提交于 2020-01-07 02:24:28
问题 I'm generating a top down web service with JAX-WS. In the wsdl I'm importing a xsd containing all necessary elements. I need all the xml nodes to be displayed in uppercase in soap request and hence I kept the element names in the xsd to upper case. But while generating the classes from the wsdl, I am able to see the getter and setter method are named in upper case as well but not the variables. For ex., if I use 'SOURCE' as an element in xsd, i'm getting the corresponding getter method as

Spring WS unavailable upon requesting connection

不问归期 提交于 2020-01-07 02:22:11
问题 I've got a Spring WS which I'm able to call successfully for 2 requests. Here is the output: 2011-07-20 18:25:33,743 DEBUG [org.springframework.ws.client.core.WebServiceTemplate] - Opening [org.springframework.ws.transport.http.HttpUrlConnection@1696452] to [http://mymachine:8080/test-service/HistoryService] 2011-07-20 18:25:33,868 DEBUG [org.springframework.ws.soap.saaj.support.SaajUtils] - SOAPElement [com.sun.xml.internal.messaging.saaj.soap.ver1_1.Envelope1_1Impl] implements SAAJ 1.3 2011