Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法从UPS Void wsdl生成java文件:Void是java关键字_Java_Maven_Soap_Wsdl_Ups - Fatal编程技术网

无法从UPS Void wsdl生成java文件:Void是java关键字

无法从UPS Void wsdl生成java文件:Void是java关键字,java,maven,soap,wsdl,ups,Java,Maven,Soap,Wsdl,Ups,我正在从upsvoidwsdl生成Java代码。但是,此wsdl使用以下包生成java类: 包com.ups.wsdl.xoltws.void.v1_1 它不能编译。Void是Java中的一个保留关键字 我正在使用Maven cxf codegen插件 这似乎是任何从这个wsdl生成Java代码的人都会遇到的问题。以前是否有人这样做并找到解决此问题的方法 以下是wsdl: <?xml version="1.0" encoding="UTF-8"?> <!-- UPS Void

我正在从upsvoidwsdl生成Java代码。但是,此wsdl使用以下包生成java类:

包com.ups.wsdl.xoltws.void.v1_1

它不能编译。Void是Java中的一个保留关键字

我正在使用Maven cxf codegen插件

这似乎是任何从这个wsdl生成Java代码的人都会遇到的问题。以前是否有人这样做并找到解决此问题的方法

以下是wsdl:

<?xml version="1.0" encoding="UTF-8"?>
<!-- UPS Void Shipment Service WSDL Release Date Mar 11, 2008 -->
<!-- Copyright 2007-2008 United Parcel Service of America, Inc. All rights reserved.   -->
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:error="http://www.ups.com/XMLSchema/XOLTWS/Error/v1.1" xmlns:upss="http://www.ups.com/XMLSchema/XOLTWS/UPSS/v1.0" xmlns:common="http://www.ups.com/XMLSchema/XOLTWS/Common/v1.0" xmlns:voida="http://www.ups.com/XMLSchema/XOLTWS/Void/v1.1" xmlns:tns="http://www.ups.com/WSDL/XOLTWS/Void/v1.1" targetNamespace="http://www.ups.com/WSDL/XOLTWS/Void/v1.1">
    <wsdl:types>
        <xsd:schema>
            <!-- This schema defines the UPS Security header used for authorization purposes -->
            <xsd:import namespace="http://www.ups.com/XMLSchema/XOLTWS/UPSS/v1.0" schemaLocation="UPSSecurity.xsd"/>
            <!--  This schema defines the error detail data types returned within SOAPFaults to provide more specific information pertaining to the problem. -->
            <xsd:import namespace="http://www.ups.com/XMLSchema/XOLTWS/Error/v1.1" schemaLocation="Error1.1.xsd"/>
            <!-- This schema defines the Void Shipment service data types -->
            <xsd:import namespace="http://www.ups.com/XMLSchema/XOLTWS/Void/v1.1" schemaLocation="VoidWebServiceSchema.xsd"/>
        </xsd:schema>
    </wsdl:types>
    <wsdl:message name="VoidRequestMessage">
        <wsdl:part name="Body" element="voida:VoidShipmentRequest"/>
        <wsdl:part name="UPSSecurity" element="upss:UPSSecurity"/>
    </wsdl:message>
    <wsdl:message name="VoidResponseMessage">
        <wsdl:part name="Body" element="voida:VoidShipmentResponse"/>
    </wsdl:message>
    <wsdl:message name="VoidErrorMessage">
        <wsdl:part name="VoidError" element="error:Errors"/>
    </wsdl:message>
    <wsdl:portType name="VoidPortType">
        <wsdl:operation name="ProcessVoid">
            <wsdl:input name="VoidShipmentRequest" message="tns:VoidRequestMessage"/>
            <wsdl:output name="VoidShipmentResponse" message="tns:VoidResponseMessage"/>
            <wsdl:fault name="VoidError" message="tns:VoidErrorMessage"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="VoidBinding" type="tns:VoidPortType">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="ProcessVoid">
            <soap:operation soapAction="http://onlinetools.ups.com/webservices/VoidBinding/v1.1" style="document"/>
            <wsdl:input name="VoidShipmentRequest">
                <soap:body parts="Body" use="literal"/>
                <soap:header message="tns:VoidRequestMessage" part="UPSSecurity" use="literal">
                    <soap:headerfault message="tns:VoidErrorMessage" part="VoidError" use="literal"/>
                </soap:header>
            </wsdl:input>
            <wsdl:output name="VoidShipmentResponse">
                <soap:body parts="Body" use="literal"/>
            </wsdl:output>
            <wsdl:fault name="VoidError">
                <soap:fault name="VoidError" use="literal"/>
            </wsdl:fault>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="VoidService">
        <wsdl:port name="VoidPort" binding="tns:VoidBinding">
            <!-- Production URL -->
            <!-- <soap:address location="https://onlinetools.ups.com/webservices/Void"/> -->
            <!-- CIE (Customer Integration Environment) URL -->
            <soap:address location="https://wwwcie.ups.com/webservices/Void"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

我可以通过Maven配置中的一些标志来解决这个问题:

<wsdlOption>
    <wsdl>${project.basedir}/src/main/resources/wsdl/ups/ship/Void.wsdl</wsdl>
    <extraargs>
        <extraarg>-client</extraarg>
        <extraarg>-verbose</extraarg>
        <extraarg>-compile</extraarg>
        <extraarg>-p</extraarg>
        <extraarg>com.ups.wsdl.xoltws.voidservice</extraarg>
        <extraarg>-autoNameResolution</extraarg>
    </extraargs>
</wsdlOption>

${project.basedir}/src/main/resources/wsdl/ups/ship/Void.wsdl
-客户
-冗长的
-编撰
-p
com.ups.wsdl.xoltws.voidservice
-自动命名解析

有关此问题的更多详细信息,请参见:

我可以通过Maven配置中的一些标志来解决此问题:

<wsdlOption>
    <wsdl>${project.basedir}/src/main/resources/wsdl/ups/ship/Void.wsdl</wsdl>
    <extraargs>
        <extraarg>-client</extraarg>
        <extraarg>-verbose</extraarg>
        <extraarg>-compile</extraarg>
        <extraarg>-p</extraarg>
        <extraarg>com.ups.wsdl.xoltws.voidservice</extraarg>
        <extraarg>-autoNameResolution</extraarg>
    </extraargs>
</wsdlOption>

${project.basedir}/src/main/resources/wsdl/ups/ship/Void.wsdl
-客户
-冗长的
-编撰
-p
com.ups.wsdl.xoltws.voidservice
-自动命名解析

有关这方面的更多详细信息,请参见:

您可以使用
-p
选项指定生成代码的包名称。更多信息请访问。感谢您的快速回复。这很有效,尽管我不得不加入一个自动命名决议。谢谢您可以使用
-p
选项指定生成代码的包名称。更多信息请访问。感谢您的快速回复。这很有效,尽管我不得不加入一个自动命名决议。谢谢