2011-08-11 106 views
3

我必須自定義JAXB外部映射文件。 已經是紅色的tutorial關於這個,並且找不到任何合適的JAXB自定義示例。我的場景是我有兩個WSDL文件主要的WSDL和輔助的WSDL,它包含在主要的WSDL中。在輔助WSDL文件中有一個complexType定義,它有一個我想要定製的名稱。該complexType的BTW名稱是objectFactory。所以現在你知道我真的需要外部定製。ws jaxb自定義外部映射

到目前爲止我來了,當我運行wsimport path-to-my-main-wsdl -b customBindings.jaxb 輸出類似

[ERROR] XPath evaluation of "//xs:complexType[@name='objectFactory']" results in empty target node 
line 2 of file:/customBindings.jaxb 

文件customBindings.jaxb看起來像

<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="path-to-my-secondary-wsdl#types?schema1" node="//xs:complexType[@name='objectFactory']"> 
     <jxb:class name="MyObjectFactory" /> 
    </jxb:bindings> 
</jxb:bindings> 

在我customBindings.jaxb文件的第二行是兩個性質schemaLocationnode。屬性schemaLocation需要指向主WSDL還是輔助WSDl?並且屬性node是精確的路徑(XPath)想要complexType還是像這樣好?什麼是XPath中的命名空間(node屬性),它必須是xs還是什麼?而實際上這個typesschema1代表schemaLocation

thx

回答