java - Specify JAXB Packages in SLSB and JAX-WS -
i creating simple soap web service using slsb , jax-ws annotations. objects pass jaxb generated ogc schemas, ogc project @ java.net. 1 particular method having trouble (which causes deployment fail) situation field (eventtime) of request object (getresult) in different package request object. objectfactory type different , there problem when marshalling/unmarshalling.
a subset of errors i'm getting:
there's no objectfactory @xmlelementdecl element {http://www.opengis.net/ogc}temporalops. problem related following location: @ protected javax.xml.bind.jaxbelement net.opengis.sos.v_1_0_0.getresult$eventtime.temporalops @ net.opengis.sos.v_1_0_0.getresult$eventtime @ protected java.util.list net.opengis.sos.v_1_0_0.getresult.eventtime @ net.opengis.sos.v_1_0_0.getresult @ public net.opengis.sos.v_1_0_0.getresult net.opengis.sos.v_1_0_0.objectfactory.creategetresult() @ net.opengis.sos.v_1_0_0.objectfactory
in standard se application, when initialize jaxbcontext below, works well.
jaxbcontext context = jaxbcontext.newinstance("net.opengis.sos.v_1_0_0:net.opengis.sensorml.v_1_0_1:net.opengis.sos.v_1_0_0.filter.v_1_1_0"); how set jaxb packages in jax-ws context?
my app server/environment gf 3.1.
thanks help!
steve
i got working @usesjaxbcontext - had little trouble @ first because nb 6.9 , 7.0b wanted link com.sun.internal.* versions of usesjaxbcontext , related, of course isn't jax-ws ri looking for. once fixed these, , added dependency jaxws-rt, version 2.2.3, worked great.
@webservice(servicename = "sos")//, targetnamespace = "http://www.opengis.net/sos/1.0") @usesjaxbcontext(value = sosservices.sosjaxbcontext.class) //@xmlseealso({net.opengis.sos.v_1_0_0.filter.v_1_1_0.objectfactory.class, net.opengis.sensorml.v_1_0_1.objectfactory.class}) public class sosservices { @webmethod(operationname = "getresult") public getresultresponse getresult(getresult request) { throw new unsupportedoperationexception(); } public static class sosjaxbcontext implements jaxbcontextfactory { @override public jaxbricontext createjaxbcontext(seimodel sei, list<class> classestobind, list<typereference> typereferences) throws jaxbexception { list<class> classlist = new arraylist<class>(); classlist.addall(classestobind); classlist.add(temporalopstype.class); list<typereference> reflist = new arraylist<typereference>(); reflist.addall(typereferences); reflist.add(new typereference(new qname("http://www.opengis.net/ogc", "temporalops"), temporalopstype.class)); return jaxbricontext.newinstance(classlist.toarray(new class[classlist.size()]), reflist, null, sei.gettargetnamespace(), false, null); } } } thanks aleksei valikov on ogc (java.net project) mailing list pointer @usesjaxbcontext!
Comments
Post a Comment