jaxb

Cannot resolve the name 'xenc:EncryptionMethodType' to a(n) 'type definition' component.

Hello, I am trying to deploy a war file in JBOSS 5.1 with CXF-JAXB schema validation. I have a XSD which has imports as <xs:import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/xmldsig-core-schema.xsd"/&gt; <xs:import namespace="http://www.w3.org/2001...

Does XML Schema Inheritance work in the same sense as OOP Inheritance?

I am working on a schema file that I intend to use with JAXB for a project of mine. In Java, I have the following sort of code structure public interface Condition { ... } public class AndCondition implements Condition { public AndCondition(List<Condition> conditions){ ... } } public class StateCondition implements Con...

JAXB inconsistency between 1 IDREF and more than 1

So I've been reading up on using IDs and IDREFs in JAXB here, and in the example presented they make use of 1 IDREF element, which appears as an Object in the generated Java code. I include both the XML Schema... <xsd:complexType name="CustomerType"> <xsd:sequence> <xsd:element name="id" type="xsd:ID"/> <xsd:element name="n...

Jersey - JaxB: Should I send the stack trace for Bad XML?

For any bad XML, by default the Jersey - JaxB throws the following: Method failed: HTTP/1.1 400 Bad Request My client(REST ws user) is insisting on giving a full blown info about the problem in the XML. Is it wise to give the stack trace of the problem in the XML? ...

JAXB: Empty string does not produce empty element

Hello, I'm using JAXB 2.1.10 from Sun's JDK 1.6.0_18: D:\apps\jdk160_18\bin>xjc.exe -version xjc version "JAXB 2.1.10 in JDK 6" JavaTM Architecture for XML Binding(JAXB) Reference Implementation, (build JAXB 2.1.10 in JDK 6) I need to have JAXB's marshaller produce an empty element (e.g. <someStringField></someStringField> or <someStr...

JAXB - Example of following a keyref when unmarshalling

According to this, you can make use of xs:key and xs:keyref when marshalling and unmarshalling data in JAXB 2.x. However, I can't find a working example of this being done anywhere. What we're doing is setting a lookup section in each XML message containing the details for the reference/code values (id, name, description, etc), and the...

Nexus repository contains artifact but only makes POM available

I have a Nexus instance with Maven 2 repositories hosted on a non-Internet-connected corporate development domain. I need to use the maven-jaxb-schemagen plugin from Sun, however, it was only available in Maven 1 format (along with many other Maven 1 dependencies, so this is not a one-off edge case). I made a new Maven 1 hosted reposit...

Can I have Object type as a parameter of @WebMethod?

I've tried to create a web method which has parameter of java.lang.Object but I receive error similar to: http://community.jboss.org/message/532500 One guy answered to this saying that: "You can pass only JAXB supported types web method parameters. java.lang.Object cannot be passed as web method parameter." And indeed, when I changed ...

Get Package Name of Generic Type Argument

Hi all How can I get the package name (in general, the class) of a generic type argument? I have a class similar to this: public class MyClass<T> {} What I'd like to do is something like this (non-working pseudo-Java): return T.class.getPackage().getName(); I need this, since JAXB needs this as the context path (JAXBContext.newIns...

How to use JAXB annotations in the client side for GWT?

I wanted to use the JaxB annotation in my class like this: @XmlRootElement public class ItemExtension implements Serializable { But GWT complains when I put it in the client side. [ERROR] Line 4: The import javax.xml.bind cannot be resolved [ERROR] Line 14: XmlRootElement cannot be resolved to a type Is there a workaround...

JAXB - how to unmarshall this XML?

Theres some pretty nasty XML that i'd like to unmarshall to a java object using JaxB. Most of it has seemed quite straightforward so far - but I am kinda stuck on this: <assets> <asset type="fixed">74,414</asset> <asset type="current">1,022,069</asset> <asset type="other">0</a...

Problem implementing GET REST service due to JAXBException: IllegalAnnotationExceptions

I am having a really strange problem implementing Java REST service. I am trying receive the following model: @Data @EqualsAndHashCode(callSuper=false, of={"primaryKey"}) @Entity @Table(name = "T_UNIQUE_IDENT_TYPE") @Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) @XmlRootElement(name="UniqueIdentifierType") @XmlAccessorType...

filter/remove invalid xml characters from stream

First things first, I can not change the output of the xml, it is being produced by a third party. They are inserting invalid characters in the the xml. I am given a InputStream of the byte stream representation of the xml. Is their a cleaner way to filter out the offending characters besides consuming the stream into a String and proces...

System wide adapter in Jersey?

I'm trying configure a "system wide" custom javax.xml.bind.annotation.adapters.XmlAdapter for the java.util.Locale type in Jersey. It's easy enough to use @XmlJavaTypeAdapter on classes I control but that's not always the case (3rd party code that I can't annotate). It seems like it would be a pretty common problem but I can't find any...

wsimport - Imported schema with no namespace ==> package with name 'generated'

I created a Web Service which has a WSDL importing a schema(let's call it SCHEMA A) file which has no target namespace in it. It defines it's own types but also imports other schemas. So when the JAXB bindings were created the package given to the types coming from SCHEMA A was "generated". For the schemas imported the packages were fin...

JAXB substitution of complex type with primitive type

In my schema I have some types that simply extend a simple XSD type (int or string). JAXB creates a separate java class per such type. I want to drop this intermediate class and configure JAXB to use primitives where possible (e.g. substitute CountryType with java.lang.String and DocumentType with int or lava.lang.Integer). For example, ...

JAXB unmarshalling does not work for complex object containing collection

Hi, I am trying to unmarshall a XML document created from jersey JAXB annotated class. JAXBContext jaxbCtx = JAXBContext.newInstance(MyClass.class); Unmarshaller m = jaxbCtx.createUnmarshaller(); MyClass result = (MyClass) m.unmarshal(in) MyClass looks something like: @XmlRootElement(name = "my-class") @XmlSeeAlso(SomeOther.class) pu...

Web services and hibernate - how would you combine these two?

I would like to use hibernate for persisting objects through web services and am thinking of using hyperjaxb3 with Apache CXF. Do you have any other suggestion for this purpose? Edit: To clarify my question a little bit... I am using eclipse and wsgen, wsimport ant tasks to generate my service and client classes respectively. I am using...

JAXB Exception: Class not known to this context

When I call a particular restful service method, which is built using CXF, I get the following error, anyone know why and how to resolve it? JAXBException occurred : class com.octory.ws.dto.ProfileDto nor any of its super class is known to this context... Following are the service method and relevant DTOs: public class Servi...

Why are names returned with @ in JSON using Jersey

I am using the JAXB that is part of the Jersey JAX-RS. When I request JSON for my output type, all my attribute names start with an asterisk like this, This object; package com.ups.crd.data.objects; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; @XmlType public class ResponseDetails { @Xm...