Not sure if I understand the question clearly or I am probably missing
something:
Are you trying to use JAX-WS to send a SOAP message and an URI is part of
this message?
OR
You're trying to marshal/unmarshal using JAXB?
In the first case, regardless of the type of the object you plan to send you
can use
javax.xml.ws.HolderH
older<YOUR_OBJECT
_TO_SEND_OVER_SOAP>
to hold your object
and send it via SOAP.
In second case, I don't see the relation between URI and the schema really.
Arash
-----Original Message-----
From: [address removed] [mailto:[address removed]] On
Behalf Of Jim Tivy
Sent: Wednesday, December 03, 2008 10:58 AM
To: VanJug Meetup; VanJugDeprecated
Subject: [vanjug] Mine field of marshallable types in Sun's JaxWs 2.1
We are finding things like URI and String[] do not automatically marshall
across the Sun implemenation of JaxWs 2.1. Are other people finding this,
or is nobody using the Sun implementation.
Incidently, I think the annotations stuff is brilliant and the interweaving
of JaxB. But the implementation is catching up...
Looks like there is user defineable primitive type mechanism. But I am not
sure why they don't ship with these done for URI.
See this post from seajug
Although I haven't verified this completely, I think you should be able to
go either way. For instance, this mapping that I had in my XML schema:
<xs:annotation>
<xs:appinfo>
<jaxb:globalBindi
ngs>
<jaxb:serializabl
e/>
<xjc:javaType name="java.sql.Times
tamp"
xmlType="TimestampSt
ringType" adapter="TimeConvert
er"/>
</jaxb:globalBind
ings>
</xs:appinfo>
</xs:annotation>
<xs:simpleType name="TimestampStrin
gType">
<xs:annotation>
<xs:documentation
>W3C Schema date-time constrained to
Zulu.</xs:documen
tation>
</xs:annotation>
<xs:restriction base="xs:dateTime">
<xs:pattern value=".+Z"/>
</xs:restriction>
</xs:simpleType>
mapped to this in the generated JAXB object:
...
@XmlElement(name = "Timestamp", required = true, type = String.class)
@XmlJavaTypeAdapter(
TimeConverter.class)
protected Timestamp timestamp;
...
where TimeConverter is:
package com.ticomgeo.mtops.adapters;
import java.sql.Timestamp;
import java.util.TimeZone;
import javax.xml.bind.annot
ation.adapters.XmlAdapter;
public class TimeConverter extends XmlAdapter<String
, Timestamp> {
static {
TimeZone.setDefault(
TimeZone.getTimeZone
("Zulu"));
}
@Override
public Timestamp unmarshal(String value) {
if (value == null) {
return null;
}
value = value.replace("T"," ").replaceFirst("[Zz
]","");
Timestamp t = Timestamp.valueOf(va
lue);
return t;
}
@Override
public String marshal(Timestamp value) {
if (value == null) {
return null;
}
String datetime = value.toString().rep
lace(" ","T")+"Z";
return datetime;
}
public static void main(String args[]) {
Timestamp t = new Timestamp(System.cur
rentTimeMillis());
System.out.println(t
.toString());
TimeConverter tc = new TimeConverter();
System.out.println(t
c.marshal(t));
Timestamp t1 = tc.unmarshal(tc.mars
hal(t));
System.out.println(t
1);
if (t1.equals(t)) {
System.out.println("
Passed");
}
}
}
www.bluestream.com
Jim Tivy
[masked] x116
____________________
____________________
_______
Posted via the VanJug mailing list
[address removed]
http://www.openro...