I have a WSDL file for a service implemented in .NET. I also have the same file with some "customizations" made by a 3rd-party to make the file tolerable to wsimport
, mostly of the form:
<s:annotation>
<s:appinfo>
<jaxb:property name="result"/>
</s:appinfo>
</s:annotation>
I'd like to be able to process the original WSDL from the vendor plus these overrides, but I'd like to specify them externally. I see that I can use the -b
option for wsimport
for "binding files" and I've tried to write an override file that currently looks like this:
<jxb:bindings version="1.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<jxb:bindings node="//xs:element[@name='MyElementResult']">
<jxb:property name="result"/>
</jxb:bindings>
</jxb:bindings>
I've verified that "MyElementName" does in fact exist, in an element found here:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="vendor-uri"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s2="http://microsoft.com/wsdl/types/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="vendor-namespace"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
[...]
<s:element name="MyElementResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="MyElementResult" type="tns:Result" />
I'm getting this warning (and therefore no changes) from wsimport
:
[ERROR] XPath evaluation of "//xs:element[@name='MyElementResult']" results in empty target node
line 4 of file:/Users/..../wsdl/custom-bindings.xjb
Am I missing something in my declaration(s)? Do I have my XPath expression incorrect? If I get my XPath/overrides working, is it formatted correctly in order to achieve the same result as if I had edited the original WSDL?
Is this even possible using external files, or will I have to re-modify any future versions of the WSDL with these same changes?
You need to give the schema location in your bindings XML file.
The
#types?schema1
after the WSDL file name will specify which schema in the WSDL you are binding, starting at 1.