Ho il seguente tipo di dati definito in un wsdl:cambiamento pacchetto di generato classe JAXB
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="myService" targetNamespace="http://example.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://example.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="example.com" targetNamespace="example.com" version="1.0">
<xs:simpleType name="MyEnum">
<xs:restriction base="xs:string">
<xs:enumeration value="one"/>
<xs:enumeration value="two"/>
</xs:restriction>
</xs:simpleType>
<!-- SNIP other data types -->
</xs:schema>
</wsdl:types>
</wsdl:definitions>
voglio MyEnum a cadere in un suo pacchetto. Così, ho usato un jaxws file di collegamento, e utilizzato XPath per attraversare le associazioni dello schema e JAXB per impostare il pacchetto, come segue:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxws:bindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://java.sun.com/xml/ns/jaxws">
<jaxws:bindings node="wsdl:definitions/wsdl:types/xs:schema[@targetNamespace='example.com']">
<jxb:schemaBindings>
<jxb:package name="abra.ca.dabra" /> <!-- this works, and changes package of all classes in the namespace-->
</jxb:schemaBindings>
<jxb:bindings node="//xs:simpleType[@name='MyEnum']">
<jxb:package name="a.b.c"/> <!-- this does not work -->
</jxb:bindings>
</jaxws:bindings>
<!-- SNIP - other functional jaxws bindings -->
</jaxws:bindings>
Ora, il percorso impostato in schemaBindings prende - e mette tutti i tipi di dati da quella schema/targetnamespace nel pacchetto abra.ca.dabra. Tuttavia, non riesco a impostare il pacchetto di solo MyEnum - che è quello che voglio.
Uso il file wsdl2java di cxf per fornire il file di bind. Mi sto perdendo qualcosa?
ho incontrato lo stesso problema. Hai risolto il tuo? – Rudy
Il file di bind non è corretto: il prefisso dello spazio dei nomi 'jaxws' non è associato ad alcun namespace. – whaefelinger
Simile, il prefisso 'xs' non è associato. – whaefelinger