Hello,

I am using xfire-1.2.4 on a JDK150_b6 and tomcat-5.5.20
The request and resonse of our webservice contains a list of objects
of a main class A with subclasses B, C, D.

The service is generated from a WSDL that was provided from our client.

The first thing we noticed was, that the marshalling on the client,
which is also generated with the exclipse-plugin did not work.
In JaxbType.writeObject the whole object hierarchiy went into the 
call to 

   m.marshal(object, ((ElementWriter) writer).getXMLStreamWriter());

and objects of type C, D where marshalled as A.

I have found the description at http://xfire.codehaus.org/JAXB+2.0
and we managed to fix the marshalling on the client by setting

  List list = new ArrayList();
  list.add("com.mycompany.mypackage");
  service0.setProperty(JaxbType.SEARCH_PACKAGES, list);

at the client side.

But now the unmarshalling at the server side still does not work.
The SOAP-Envelope now contains the correct classes C, D but 
the unmarshalling process gives A, A.

I did not find a way to set the property JaxbType.SEARCH_PACKAGES 
programmatically on the serverside. The only way to get this done seems 
to be via the services.xml described at http://xfire.codehaus.org/JAXB+2.0.

The first syntax: 
1)
<service>
    ...
    <property name="jaxb.search.packages">
      <list>
       <entry>com.mycompany.mypackage</entry>
      </list>
    </property>
</service>

gives an initialisation error

=> java.lang.ClassNotFoundException: list...

we also tried 
2)
<service>
    ...
    <property name="jaxb.search.packages">
      <list xmlns="">
       <entry xmlns="">com.mycompany.mypackage</entry>
      </list>
    </property>
</service>

=> Unknown property sub-element: <entry>

and 

3)
<service>
    ...
    <property name="jaxb.search.packages">
      <list xmlns="">
       <value>com.mycompany.mypackage</value>
      </list>
    </property>
</service>

=> org.springframework.beans.NotWritablePropertyException: Invalid property
'jaxb.search.packages' of bean class [org.codehaus.xfire.spring.ServiceBean]:
Nested property in path 'jaxb.search.packages' does not exist; nested exception
is org.springframework.beans.NotReadablePropertyException: Invalid property
'jaxb' of bean class
 
and 

4)
<service>
    ...
    <property xmlns="" name="jaxb.search.packages">
      <list xmlns="">
       <value>com.mycompany.mypackage</value>
      </list>
    </property>
</service>

=> org.springframework.beans.NotWritablePropertyException: Invalid property
'jaxb.search.packages' of bean class [org.codehaus.xfire.spring.ServiceBean]:
Nested property in path 'jaxb.search.packages' does not exist; nested exception
is org.springframework.beans.NotReadablePropertyException: Invalid property
'jaxb' of bean class

With the second syntax: 

<property xmlns="" name="properties">
    <map xmlns="">
        <entry xmlns="" key="jaxb.search.packages">
            <value xmlns="">
                <list xmlns="">
                  <value xmlns="">com.mycompany.mypackage</value>
                </list>
            </value>
        </entry>
    </map>
</property>     

the initialisation works fine, but then I get an error 

java.lang.ClassCastException: java.lang.String
  at org.codehaus.xfire.jaxb2.JaxbType.getJAXBContext(JaxbType.java:274)

when the configuration is read during the unmarshalling phase.
In the debugger the content of mc.service.properties before the exception
has a funny entry for jaxb.search.packages with a string of spaces and tabs
instead of a list of packagenames.
The ClassCastException is a result of 

    Collection extraPackages = 
        (Collection) mc.getContextualProperty(SEARCH_PACKAGES);

where getContextualProperty is returning the funny looking string.

Does anyone have a working services.xml with a "jaxb.search.packages"
entry or any other workaround ?

Best regards,

Steve


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to