xjc

Applying external JAXB binding file to schema elements imported from WSDL

萝らか妹 提交于 2019-12-05 00:46:16
The XPath expression in my external binding files can't target the elements in my XML schemas which are imported into my WSDL. Everything runs if I do inline binding customization but I really wanted to have external binding files that way I never accidentally overwrite(refresh) the files containing my customizations. The start of my binding file: <jaxb:bindings xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" version=

Why does wsimport have trouble with server object having @XmlRootElement annotation?

眉间皱痕 提交于 2019-12-04 18:36:18
I was completing work on a web service using JAX-WS on the server side. In many of the domain objects I used @XmlRootElement to help facilitate the unmarshaling of XML files into the service using JAXB. All went well and the output was what I expected to see using SoapUI. However, when I used wsimport to create the client (as a convenience DAO for other developers), I started encountering NullPointerExceptions in my client integration-test class. The call to the webservice worked correctly, and a response was received by the client, but my more-complex objects were null. Simple attributes,

JAXB :: xjc 2.2 not recognizing bindings for simple types

家住魔仙堡 提交于 2019-12-04 18:05:11
I have a bunch of xsd schemas some of which import others. So, whenever I invoke xjc (either the Ant task or the command line tool) on some xsd files which import others, I pass along a bindings file to ensure that the imported classes are not generated again (since they have already been generated for the "upstread" schema). This solution is described in this SO post (answer by Blaise Doughan) . While this approach does work for xsd:complexType types, it does not seem to work for xsd:simpleType types. Here's a narrowed down example to demonstrate this. Say we have two dead-simple schemas one

JAXB generated classes of certain types implementing a custom interface

纵然是瞬间 提交于 2019-12-04 12:19:08
问题 I am working on an application that uses XJC to generate Java POJOs from XSDs. There are dozens of schemas, and that number will grow. The application also needs to be able to handle different versions of the same schema, which means that I will have multiple schemas defining common types. I am trying to customize the bindings so that certain core types implement a common interface. The Inheritance plugin of JAXB2 Basics seems to do what I need, but I can't seem to nail the right syntax. Here

How to write an external binding file for xjc?

为君一笑 提交于 2019-12-04 09:04:19
问题 The documentation of JAXB xjc says: -b Specify one or more external binding files to process. (Each binding file must have it's own "-b" switch.) The syntax of the external binding files is extremely flexible. You may have a single binding file that contains customizations for multiple schemas or you can break the customizations into multiple bindings files: xjc schema1.xsd schema2.xsd schema3.xsd -b bindings123.xjb xjc schema1.xsd schema2.xsd schema3.xsd -b bindings1.xjb -b bindings2.xjb -b

Getting “compiler was unable to honor this javaType customization” with “xs:any”

非 Y 不嫁゛ 提交于 2019-12-04 08:13:53
I have the following xsd: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="root"> <xs:complexType> <xs:sequence> <xs:any processContents="skip" /> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> and the following bindings: <jxb:bindings xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" version="2.1"> <jxb:bindings schemaLocation="format.xsd"> <jxb:bindings node="//xs:any"> <jxb:property> <jxb:baseType> <jxb:javaType name="org.w3c.dom.Element" parseMethod="leif.ElementFormatter

JAXB maven plugin not generating classes

拈花ヽ惹草 提交于 2019-12-04 02:53:04
I am trying to generate the java files from the XSD, but the below code doesn't generate. If I uncomment outputDirectory, it works but delete the folder first. adding clearOutputDir = false is also not generating anything. <build> <plugins> <!-- JAXB xjc plugin that invokes the xjc compiler to compile XML schema into Java classes.--> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxb2-maven-plugin</artifactId> <executions> <execution> <goals> <goal>xjc</goal> </goals> </execution> </executions> <configuration> <!-- The package in which the source files will be generated. -->

maven-jaxb2-plugin reusing commons XSD within same project

青春壹個敷衍的年華 提交于 2019-12-03 20:19:29
问题 I have a project which has a schema A and B, both within the same namespace. Both import schema C which also uses the same namespace. How can I generate JAXB classes for A and B to separate packages, while reusing the JAXB classes from C generated to a commons package? I already know I should probably be using episodes and use the episode generated for schema C as bindings file for the separate executions of schema's A and B. Problem is I don't know how to refer to this generated episode file

JAXB Bindings to schemas in a JAR

只谈情不闲聊 提交于 2019-12-03 16:14:17
I'm using the maven jaxb2 plugin to generate Java classes, built from schemas in a jar. However, I'm not sure how to correctly locate to these schemas from a bindings file. If Iextract the schemas from the jar and drop them in the same directory as the bindings, all is well. However, this isn't a practical long term solution. pom.xml: <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId>maven-jaxb2-plugin</artifactId> <version>0.8.1</version> <executions> <execution> <goals> <goal>generate</goal> </goals> </execution> </executions> <configuration> <schemas> <schema>

Partial-unmarshalling with JAXB

邮差的信 提交于 2019-12-03 14:44:02
I want do partial unmarshaling of big XML. XML has following structure: <Records> <Contract> ... </Contract> <Contract> ... </Contract> ... <Contract> ... </Contract> <Contract> ... </Contract> </Records> And result class generated with XJC: - Records |- Contract If i follow these (sample from jaxb-ri), i get error: Exception in thread "main" javax.xml.bind.UnmarshalException: unexpected element (uri:"http://somedomain.com", local:"Contract"). Expected elements are <{http://somedomain.com}Records> If i use: <jaxb:globalBindings localScoping="toplevel"/> I get error: org.xml.sax