wsimport客户端 - 自定义包名称

时间:2017-02-08 10:04:53

标签: xml jaxb wsdl wsimport

我正在使用wsdl和绑定文件运行wsimport(版本2.2.9),看起来像....

WSDL文件看起来像(我已经更改了元素名称,因此请忽略大小写错误):

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:tns="http://my.com/web/app/inbound/types"
             xmlns:app_types="http://my.com/web/app/inbound/types"
             xmlns:kid="http://my.com/common/types/aid"
             xmlns:bktns="http://my.com/web/basetypes"
             xmlns:IsAlive="my.com/common/types/IsAlive"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
             xmlns="http://schemas.xmlsoap.org/wsdl/"
             targetNamespace="http://my.com/web/app/inbound/types">

    <import namespace="my.com/common/types/IsAlive" location="IsAlive.wsdl"/>

    <types>

    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns:tns="http://my.com/web/app/inbound/types"
                xmlns:btns="http://my.com/common/basetype"
                xmlns:app_ea_types="http://my.com/web/app/inst/sin/types"
                xmlns:app_types="http://my.com/web/app/inbound/types"
                xmlns:kid="http://my.com/common/types/aid"
                xmlns:bktns="http://my.com/web/basetypes"
                targetNamespace="http://my.com/web/app/inbound/types">
        <xsd:import namespace="http://my.com/web/basetypes" schemaLocation="web_common/BaseTypes_web.xsd"/>
        <xsd:import namespace="http://my.com/web/basetypes" schemaLocation="web_common/webErrors.xsd"/>
        <xsd:import namespace="http://my.com/common/basetype" schemaLocation="web_common/BaseTypes.xsd"/>
        <xsd:import namespace="http://my.com/web/app/inst/sin/types" schemaLocation="web_types/appsininstTypes.xsd"/>
        <xsd:include schemaLocation="web_types/appTypes.xsd"/>
        <xsd:import namespace="http://my.com/common/types/aid" schemaLocation="web_common/aid.xsd"/>

       <xsd:element name="InstListQuery">
           <xsd:complexType>
               <xsd:sequence>
                   <xsd:element name="MessageHeader"                type="bktns:MessageHeader"/>
                   <xsd:element name="Nr"                 type="xsd:int"                      minOccurs="0"/>
                   <xsd:element name="accountId"                      type="kid:aid"               minOccurs="0"/>
                   <xsd:element name="Context"            type="bktns:Context"      minOccurs="0"/>
                   <xsd:element name="Cat"              type="app_types:Filter"            minOccurs="0"/>
               </xsd:sequence>
           </xsd:complexType>
       </xsd:element>
       <xsd:element name="InstListQuery_Res">
           <xsd:complexType>
               <xsd:sequence>
                   <xsd:element name="More"                         type="xsd:boolean"                  />
                   <xsd:element name="Context"            type="bktns:Context"      minOccurs="0"/>
                   <xsd:element name="Add"               type="bktns:Add"          maxOccurs="3"/>
                   <xsd:element name="instsList"                type="app_types:inst"           nillable="true" minOccurs="0" maxOccurs="180"/>
               </xsd:sequence>
           </xsd:complexType>
       </xsd:element>

       <xsd:element name="PerminstListQuery">
           <xsd:complexType>
               <xsd:sequence>

...
...


       </xsd:schema>
    </types>

    <message name="instListQuery">
       <part name="parameters" element="tns:instListQuery"/>
    </message>
    <message name="instListQueryResponse">
        <part name="parameters" element="tns:instListQuery_Res"/>
    </message>
    <message name="PerminstListQuery">
       <part name="parameters" element="tns:PerminstListQuery"/>
    </message>
 ...
 ...

    <portType name="instServicesPort">

         <!-- .................................................................................................................. -->
         <operation name="instListQuery">
             <input message="tns:instListQuery"/>
             <output message="tns:instListQueryResponse"/>
             <fault name="AAAAException"  message="tns:AAAAException"/>
             <fault name="ServiceTimeoutException"      message="tns:ServiceTimeoutException"/>
             <fault name="BBBBException"   message="tns:BBBBException"/>
             <fault name="CCCCException"          message="tns:CCCCException"/>
        </operation>

 ...
 ...
 ...

    </portType>

    <binding name="InstServicesPort" type="tns:InstServicesPort">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

        <!-- .................................................................................................................. -->
        <operation name="instListQuery">
            <soap:operation soapAction="" style="document"/>
            <input><soap:body use="literal"/></input>
            <output><soap:body use="literal"/></output>
            <fault name="AAAAException"><soap:fault name="AAAAException" use="literal"/></fault>
            <fault name="ServiceTimeoutException"><soap:fault name="ServiceTimeoutException" use="literal"/></fault>
            <fault name="BBBBException"><soap:fault name="BBBBException" use="literal"/></fault>
            <fault name="CCCCException"><soap:fault name="CCCCException" use="literal"/></fault>
        </operation>

...
...
...

    </binding>

    <service name="InstServices">
        <port name="InstServicesPort" binding="tns:InstServicesPort">
            <soap:address location="https://web-host:7002/web/inst/instServices"/>  
        </port>
    </service>

</definitions>

,绑定文件类似于:

<jxb:bindings>
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
    version="1.0">
    <jxb:bindings schemaLocation="my.wsdl#types?schema2">
        <jxb:schemaBindings>
            <jxb:package name="inbound.types"/>
        </jxb:schemaBindings>        
    </jxb:bindings> 
    <jxb:bindings schemaLocation="web_common/BaseTypes_web.xsd">
        <jxb:schemaBindings>
            <jxb:package name="basetypes"/>
        </jxb:schemaBindings>        
    </jxb:bindings>
    <jxb:bindings schemaLocation="web_common/webErrors.xsd">
        <jxb:schemaBindings>
            <jxb:package name="sing.types"/>
        </jxb:schemaBindings>        
    </jxb:bindings>   
    <jxb:bindings schemaLocation="web_common/BaseTypes.xsd">
        <jxb:schemaBindings>
            <jxb:package name="b.inbound.types"/>
        </jxb:schemaBindings>        
    </jxb:bindings>                             
</jxb:bindings>

问题是我无法解决如何将生成的InstServicesPort.class和InstServices.class放入包inbound.types

非常感谢任何帮助。

罗恩

0 个答案:

没有答案