cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Web service generation problem - WSDL2Java
Date Fri, 01 Oct 2010 14:20:07 GMT


A  JAXB/JAX-WS customization file can be used to have certains parts of the 
schema generated as DOM's instead of types.   The problem will come if you 
have a LOT of elements that need this as it's usually applied xpath based.   
You might be able to write an xslt transform or something to generate the 
binding file.  

It would look something like:

<jxb:bindings version="1.0"
              xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
              xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <jxb:bindings schemaLocation="foo.xsd" 
          node="/xs:schema/xs:element[name='MyElement']/xs:element[name='field']">
             <jxb:dom/>
    </jxb:bindings>

</jxb:bindings>


Dan





On Friday 01 October 2010 3:49:12 am Inmaculada Marín wrote:
> Hi all,
> 
> 
> 
> I developed a web service with an old version of JDeveloper some time ago,
> but now I have to migrate it to CXF. The WSDL  uses elements from an schema
> (as operation parameters), but in the implementation the type of the
> parameters are org.w3c.dom.Element (that is because of the JDeveloper
> version used then).
> 
> 
> 
> When I try to generate the service skeleton (using the same WSDL that the
> old web service has) using WSDL2Java tool, classes from the schema are
> generated, and the web service operations have parameters of these classes
> (classes from the schema). Then, several tests has been accomplished:
> 
> -          if I try to change the type of these parameters to type
> org.w3c.dom.Element (so as to include all the web service implementation I
> already have, ‘as-is’), I have an error when invoking that service, as the
> input parameter type is not the one expected.
> 
> -          If I keep the type of these parameters as generated by WSDL2Java
> tool, I marshall the input parameters, so as to obtain an object of type
> org.w3c.dom.Element, then I include all my web service implementation, and
> then I turn the result (an object of type org.w3c.dom.Element) into an
> object of the expected type (from the schema) by unmarshalling the
> org.w3c.dom.Element. However, some values of XML elements are lost, and the
> object returned is not correct (besides, the prefix namespaces are changed
> to ns2, ns3 and so).
> 
> 
> 
> Is there is a way of indicating WSDL2Java tool a mapping from schema
> elements to java classes, so as to telling which classes has to use for
> specific schema element (that is, if an operation has a parameter of type
> x:ParameterType defined in the used schema, maybe I could say the WSDL2Java
> tool not to generate this element java class, but to use an existing java
> class instead)?
> 
> 
> 
> I have to keep all the implementation of my ‘old’ web service, as is a huge
> one and it is very expensive to use java classes generated by WSDL2Java
> tool within that implementation.
> 
> 
> 
> Can you be so kind as to help me, please?
> 
> 
> 
> Thank you very much in advance.
> 
> 
> 
> Regards,
> 
> Inma.

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Mime
View raw message