jaxb2

Why CXF / JAXB read whole InputStream into memory before marshalling to SOAP message

浪子不回头ぞ 提交于 2019-12-19 14:03:11
问题 INFO - Sample code I've set up sample code (SSCCE) for you to help track the problem: https://github.com/ljader/test-cxf-base64-marshall The problem I'm integrating with 3rd party JAX-WS service, so I cannot change the WSDL. The 3rd party webservice expects Base64 encoded bytes to perform some operation on them - they expect that client sends whole bytes in SOAP message. They don't want to change to MTOM / XOP, so I'm stuck with current requirements. I decided to use CXF to easily set up

Reading the Custom XML Processing Instruction through JAXB Unmarshelling

◇◆丶佛笑我妖孽 提交于 2019-12-19 10:07:27
问题 Is there a way to read the custom xml processing instruction when unmarshelling through JAXB. Example, <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <customer > <id>100</id> <age>40</age> <name>Sachin</name> </customer> <?CustomExtn Number="AC7654321" LastName="Szychlinski"?> In the above xml when unmarshelling, the CustomExtn is not present after unmarshelling. Is there a way i can read this in the Java Class? 回答1: You can use JAXB with StAX to get the Processing Instruction data:

Using JAXB to support schemas with minor variations

依然范特西╮ 提交于 2019-12-17 23:23:22
问题 The Situation I need to support generating XML documents based on schemas that vary only slightly between each other. Specifically, the schemas that I need to support are based on industry standards that change slightly over time and vendors may make their own customized version of them. The Problem I was intending to use JAXB 2 (from Metro) with inheritance as a solution. I expected the package structure to end up something like this: com.company.xml.schema.v1 com.company.xml.schema.v2 com

jax-ws vs axis2 - help needed

限于喜欢 提交于 2019-12-14 02:26:11
问题 I need help with the following : Q.1) Performance comparison between - 1) lot of war files containing jax-ws based web services deployed on Jetty 2) lot of web services deployed on axis2 running on Jetty Q.2) Also, if there are many types of clients, like .net, java, c++ based, which are gonna use these web services then which approach should I go with - axis2 as SOAP engine or jax-ws?? Q.3) if I am not interested in WS-* standards then what should I use axis2 or jax-ws? Q.4) In general why

How to generate java class with @XmlRootElement from WSDL using xjc in command prompt

纵饮孤独 提交于 2019-12-13 17:21:53
问题 The xjc way of creating java package is xjc -wsdl myWsdl.wsdl This creates package like com Then for generation of jar jar cvf myJar.jar com/* Any way to generate the java classes with @XmlRootElement because my java class does not have it. PS: using command prompt only 回答1: To force generating @XmlRootElement , refer How to generate @XmlRootElement Classes for Base Types in XSD? please. However, I think you don't need to use @XmlRootElement . The post, No @XmlRootElement generated by JAXB

Can't get JAXB to handle interfaces with simple example

主宰稳场 提交于 2019-12-13 15:19:24
问题 I'm trying the simple example for JAXB Interfaces shown at Unofficial JAXB Guide - Mapping interfaces — Project Kenai, section 3.2.1 and it won't work for me. I'm in latest JDK 1.8_70 and not using any special libraries. Code for completeness sake: @XmlRootElement class Zoo { @XmlAnyElement public List<Animal> animals; } interface Animal { void sleep(); void eat(); ... } @XmlRootElement class Dog implements Animal { ... } @XmlRootElement class Lion implements Animal { ... } Any help on this?

jaxb unmarshalling returns null

吃可爱长大的小学妹 提交于 2019-12-13 02:17:24
问题 I'm unmarshalling a response for soap message like the following <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <SOAP-ENV:Body> <m:soResponse SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:m="urn:tec"> <Error/> <Order> <Number>6</Number> </Order> </m:soResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope> and i'm binding the jaxb annotation as

Inheritance mapping throwing an exception with MOXy

℡╲_俬逩灬. 提交于 2019-12-12 23:52:49
问题 I followed the second option mentioned in JAXB inheritance in MOXY to map my parent class and child class listed below. MOXy is throwing the below exception and not sure what the issue is Parent class public class UnitedStatesAddressData extends AbstractAddress implements UnitedStatesAddress, Serializable, Cloneable { private String primaryAddress; public String getPrimaryAddress() { return primaryAddress; } public void setPrimaryAddress(final String primaryAddress) { this.primaryAddress =

`@XmlRootElement` and `nillable`

五迷三道 提交于 2019-12-12 20:44:01
问题 Is there any way to let JAXB properly prints xmlns:xsi and xsi:nill on nillable @XmlRootElement ? public class XmlValueTest { public static void main(final String[] args) throws JAXBException { final JAXBContext context = JAXBContext.newInstance(Wrapper.class, Value.class); final Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); marshaller.marshal(Value.newInstance(null), System.out); marshaller.marshal(Value

Is it possible to @XmlElement annotate a method with non-stardard name?

早过忘川 提交于 2019-12-12 10:55:51
问题 This is what I'm doing: @XmlType(name = "foo") @XmlAccessorType(XmlAccessType.NONE) public final class Foo { @XmlElement(name = "title") public String title() { return "hello, world!"; } } JAXB complains: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions JAXB annotation is placed on a method that is not a JAXB property this problem is related to the following location: at @javax.xml.bind.annotation.XmlElement(nillable=false, name=title, required