Hi, Li.
Thank you for trying it out. Please see my comments below.
Raymond
----- Original Message -----
From: "Li Shen" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, October 17, 2006 11:29 PM
Subject: RE: Question on JAXB data binding
Hi Raymond, I added the annotation to an interface method like this:
@DataType(name = "javax.xml.bind.JAXBElement", context = {
@DataContext(key
= "jaxb.contextPath", value = "foo.jaxb") })
void foo(FooType fooType);
Sounds good.
However, the NPE still occurred as before. Not sure whether I miss
anything,
but I don't figure out how you put the metadata defined in annotation into
DataType, and it was still "null" through calling DataType.getMetaData()
in
JAXBContextHelper. I just saw the metadata was put into service contract
or
operation and I could print it out at runtime. Would you please clarify?
I'll check the code. Is it possible that you open a JIRA and attach your
test case there? I would be glad to make it work.
In addition, I am curious about why the JAXB configuration should be
defined
using annotation while the SDO stuff is defined in SCDL? I feel they could
both be global configuration in a composite? And specifying @DataContext
on
each individual interface or operation is an ugly work if they have the
same
set of packages?
It's work in progress. We're planning to have a consistent SCDL extensions
at the assembly level to deal with databindings.
Also, could it be possible to do automatic detection for the
contextPath/classes? For example, when introspecting interface or
operation
annotated with JAXB DataType annotation, is it feasible to directly add
package names of the parameters and return value to contextPath if they
are
of complex types?
Good point. That was what I have been thinking of. We can try to use the
physical type for the DataType as the JAXB class as the last resort. I'll
add some code to do so and see how it goes. But please keep in mind,
sometimes it's not possible to detect it if the parameter is directly typed
as a JAXB class.
Thanks!
Li
-----Original Message-----
From: Raymond Feng [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 18, 2006 7:40 AM
To: [email protected]
Subject: Re: Question on JAXB data binding
Hi,
When you annote the java interface with JAXB binding, you can set extra
context as @DataContext(key="...", value="...").
Can you give that a try?
Thanks,
Raymond
----- Original Message -----
From: "Li Shen" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, October 17, 2006 12:06 AM
Subject: Question on JAXB data binding
> Hi Raymond,
>
> How can I specify the "contextPath" or "classes" when using JAXB data
> binding in binding.ws? Without them NPE was thrown from the code below
> since
> JAXBContext does not allow pass null to newInstance():
>
> String contextPath = (String)
> bindingContext.getMetadata(JAXB_CONTEXT_PATH);
> JAXBContext context = null;
> if (contextPath != null)
> context = JAXBContext.newInstance(contextPath);
> else {
> Class[] classes = (Class[])
> bindingContext.getMetadata(JAXB_CLASSES);
> context = JAXBContext.newInstance(classes);
> }
>
> In your test code, I saw you used this:
>
> targetDataType.setMetadata(JAXBContextHelper.JAXB_CONTEXT_PATH,
> contextPath);
>
> But how can I configure it when using binding.ws? Or you can do
automatic
> detection?
>
> Thanks!
>
> Li
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]