[ 
https://issues.apache.org/jira/browse/CXF-2183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12790844#action_12790844
 ] 

Frode Nerbråten commented on CXF-2183:
--------------------------------------

We have had this problem for a while. Every time a wsdl contained more than one 
schema, wsdl2java would fail when we tried to apply the attached binding 
customization: date_binding_notworking.xml (try it on dateservice.wsdl)
It seems that the globalbindings element is applied to all schemas, causing the 
"only one global bindings customization is allowed".

There is a paragraph at the bottom of the "Global Binding Declarations" in the 
jaxb tutorial that says: "<globalBindings> declarations are only valid in the 
annotation element of the top-level schema element" 
http://java.sun.com/webservices/docs/1.5/tutorial/doc/JAXBUsing4.html#wp148515
I found that changing the xpath of the node attribute of the jaxws:bindings 
element from
<jaxws:bindings node="wsdl:definitions/wsdl:types/xs:schema">
to
<jaxws:bindings node="wsdl:definitions/wsdl:types/xsd:schema[1]">
made the date_binding.xml work on the dateservice.wsdl

So it seems that wsdl2java is working fine as long as you get the external 
binding applied to the correct element(s) in the wsdl.

> wsdl2java "only one global bindings customization is allowed" with embedded 
> imported schema namespace
> -----------------------------------------------------------------------------------------------------
>
>                 Key: CXF-2183
>                 URL: https://issues.apache.org/jira/browse/CXF-2183
>             Project: CXF
>          Issue Type: Bug
>          Components: Tooling
>    Affects Versions: 2.1.4
>         Environment: CXF 2.1.4, JDK build 1.5.0_12-b04, Windows XP-64
>            Reporter: Bob Fields
>            Assignee: Daniel Kulp
>         Attachments: bindingsError.zip
>
>
> Error "WSDLToJava Error: Thrown by JAXB : only one globalBindings 
> customization is allowed in a whole compilation" is returned when using a 
> databinding xjb file against a wsdl with embedded referenced schema 
> namespace. There is only one globalBindings customization, despite what the 
> error says. The same wsdl2java process works fine when the schema is 
> extracted to an external file and referenced in the wsdl through 
> schemaLocation, no other difference in the bindings or wsdl2java parameters.
> Example attached: wsdl2.log shows the error. Bindings are meant to change 
> XMLGregorianCalendar to Date. GregService.wsdl and GregService.xjb were 
> generated by java2ws from working java code, and return the error. 
> GregServiceA3.wsdl and .xjb work perfectly fine. The only difference in the 
> wsdl files is:
> DOES NOT WORK
>    <xs:import namespace="http://valueobject.wdpr.com/"; />
> ...
>   <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
>    xmlns:tns="http://valueobject.wdpr.com/"; attributeFormDefault="unqualified"
>    elementFormDefault="qualified" 
> targetNamespace="http://valueobject.wdpr.com/";>
>    <xs:element name="dates" type="tns:Dates" />
>    <xs:complexType name="Dates">
>     <xs:sequence />
>     <xs:attribute name="startDate" type="xs:date" use="required" />
>     <xs:attribute name="endDate" type="xs:date" use="required" />
>    </xs:complexType>
>   </xs:schema>
> WORKS
>         <xs:import namespace="http://valueobject.wdpr.com/"; 
> xmlns="http://www.w3.org/2001/XMLSchema";  
> schemaLocation="xsd/valueobject.wdpr.com.xsd"/>
> ...
> Same namespace information above in an external xsd/valueobject.wdpr.com.xsd 
> schema file.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to