0

I am using wsimport

I need to rename a xs:complextype name=Address to prevent some build conflicts.

Here is a snippet of the WSDL:

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns="http://fedex.com/ws/rate/v13" xmlns:s1="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://fedex.com/ws/rate/v13" name="RateServiceDefinitions">
  <types>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://fedex.com/ws/rate/v13">
      <xs:complexType name="Address">…</xs:complexType>
    ....
   </types>
   ....
</definitions>

I am using an external binding file:

<jxb:bindings 
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:ns="http://fedex.com/ws/rate/v13"
    xmlns:s1="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
    xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="2.1"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    >

    <jxb:globalBindings>
        <jxb:javaType name="java.util.Calendar" xmlType="xs:dateTime" parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime" printMethod="javax.xml.bind.DatatypeConverter.printDateTime" />
    </jxb:globalBindings>
   <jxb:bindings node="definitions/types/xs:schema/xs:complexType[@name='Address']/xs:complexType">
        <!-- change java method name from addNumbers() to add() -->
        <jxb:class name="FedExAddress"/>
    </jxb:bindings>
</jxb:bindings>

When I execute the build I get the following message:

[wsimport] [ERROR] XPath evaluation of "definitions/types/xs:schema/xs:complexType[@name='Address']/xs:complexType" results in empty target node
 [wsimport]   line 14 of file:/Users/davidboyd/projects/heritage/hybris/bin/custom/cpdeliveryservice/fedex_binding.xml

I have looked at the following postings here, here and a couple of references as well reference 1 and reference 2

But do not understand as to why this is not working.

Community
  • 1
  • 1
boyd4715
  • 2,701
  • 10
  • 48
  • 75

1 Answers1

1

After taking a breather I was able to solve the issue my taking a second look at this.

So my resulting binding is:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<jaxws:bindings 
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
    xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="2.1"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    wsdlLocation="/RateService_v13.wsdl"
    >

    <enableWrapperStyle>true</enableWrapperStyle>
    <enableAsyncMapping>false</enableAsyncMapping>

    <!-- convert all xs:dateTime to java type of Calendar -->
    <jaxws:globalBindings>
        <jxb:javaType name="java.util.Calendar" xmlType="xs:dateTime" parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime" printMethod="javax.xml.bind.DatatypeConverter.printDateTime" />
    </jaxws:globalBindings>

    <!-- Rename Address to FedExAddress -->
    <jaxws:bindings node="//xs:complexType[@name='Address']">
        <jxb:class name="FedExAddress"/>
    </jaxws:bindings>

</jaxws:bindings>
Community
  • 1
  • 1
boyd4715
  • 2,701
  • 10
  • 48
  • 75