Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/369.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
Java Axis生成的wsdl不包括所有类型定义_Java_Web Services_Wsdl_Axis_Java1.4 - Fatal编程技术网

Java Axis生成的wsdl不包括所有类型定义

Java Axis生成的wsdl不包括所有类型定义,java,web-services,wsdl,axis,java1.4,Java,Web Services,Wsdl,Axis,Java1.4,我正在使用Axis1.1和Java1.4。我的代码正在集成到一个大型的现成系统中,我无法升级这两个组件 我有以下类,并通过Axis web服务公开UpdateChartOfcounts方法 public class ChartOfAccountsWebService { public WSResponse[] UpdateChartOfAccounts(WSCostCenter[] costCenters) throws Exception{ WSRespons

我正在使用Axis1.1和Java1.4。我的代码正在集成到一个大型的现成系统中,我无法升级这两个组件

我有以下类,并通过Axis web服务公开UpdateChartOfcounts方法

public class ChartOfAccountsWebService
{
    public WSResponse[] UpdateChartOfAccounts(WSCostCenter[] costCenters) throws Exception{     
        WSResponse[] responses = new WSResponse[costCenters.length];

            //logic removed

        return responses;
    }

    public class WSCostCenter{
        public String costCenter;
        public String costCenterDesc;
        public String approver;
        public String companyNumber;
        public String inactiveFlag; 
    }

    public class WSResponse{
        public String ID;
        public String col;
        public String colValue;
        public String[] errors;
        public int lineNum;
        public int recNum;
    }
}
在我的server-config.wsdd中,我添加了以下块,它允许我查看服务并请求其wsdl:

 <service name="ChartOfAccountsWebService" provider="java:RPC">
  <parameter name="allowedMethods" value="UpdateChartOfAccounts"/>
  <parameter name="className" value="com.integration.webservices.ChartOfAccountsWebService"/>
  <parameter name="scope" value="Application"/>
 </service>

这将生成以下WSDL,其中没有WSCostCenter或WSResponse的定义:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://localhost:7001/services/ChartOfAccountsWebService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:7001/services/ChartOfAccountsWebService" xmlns:intf="http://localhost:7001/services/ChartOfAccountsWebService" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <wsdl:types>
        <schema targetNamespace="http://localhost:7001/services/ChartOfAccountsWebService" xmlns="http://www.w3.org/2001/XMLSchema">
            <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
            <complexType name="ArrayOf_tns1_ChartOfAccountsWebService_WSCostCenter">
                <complexContent>
                    <restriction base="soapenc:Array">
                        <attribute ref="soapenc:arrayType" wsdl:arrayType="tns1:ChartOfAccountsWebService_WSCostCenter[]"/>
                    </restriction>
                </complexContent>
            </complexType>
            <complexType name="ArrayOf_tns1_ChartOfAccountsWebService_WSResponse">
                <complexContent>
                    <restriction base="soapenc:Array">
                        <attribute ref="soapenc:arrayType" wsdl:arrayType="tns1:ChartOfAccountsWebService_WSResponse[]"/>
                    </restriction>
                </complexContent>
            </complexType>
        </schema>
    </wsdl:types>
    <wsdl:message name="UpdateChartOfAccountsResponse">
        <wsdl:part name="UpdateChartOfAccountsReturn" type="impl:ArrayOf_tns1_ChartOfAccountsWebService_WSResponse"/>
    </wsdl:message>
    <wsdl:message name="UpdateChartOfAccountsRequest">
        <wsdl:part name="costCenters" type="impl:ArrayOf_tns1_ChartOfAccountsWebService_WSCostCenter"/>
    </wsdl:message>
    <wsdl:portType name="ChartOfAccountsWebService">
        <wsdl:operation name="UpdateChartOfAccounts" parameterOrder="costCenters">
            <wsdl:input message="impl:UpdateChartOfAccountsRequest" name="UpdateChartOfAccountsRequest"/>
            <wsdl:output message="impl:UpdateChartOfAccountsResponse" name="UpdateChartOfAccountsResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="ChartOfAccountsWebServiceSoapBinding" type="impl:ChartOfAccountsWebService">
        <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="UpdateChartOfAccounts">
            <wsdlsoap:operation soapAction=""/>
            <wsdl:input name="UpdateChartOfAccountsRequest">
                <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://webservices.integration" use="encoded"/>
            </wsdl:input>
            <wsdl:output name="UpdateChartOfAccountsResponse">
                <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:7001/services/ChartOfAccountsWebService" use="encoded"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="ChartOfAccountsWebServiceService">
        <wsdl:port binding="impl:ChartOfAccountsWebServiceSoapBinding" name="ChartOfAccountsWebService">
            <wsdlsoap:address location="http://localhost:7001/services/ChartOfAccountsWebService"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>


为什么WSConstCenter和WSResponse缺少类型定义?如果您尝试使用此服务,它不会生成正确的代码。

Axis不喜欢我的嵌套类。当我将两个内部类提取到它们自己的java文件中时,WSDL正确生成:

public class ChartOfAccountsWebService
{
    public WSResponse[] UpdateChartOfAccounts(WSCostCenter[] costCenters) throws Exception{     
        WSResponse[] responses = new WSResponse[costCenters.length];

            //logic removed

        return responses;
    }
}

public class WSCostCenter{
    public String costCenter;
    public String costCenterDesc;
    public String approver;
    public String companyNumber;
    public String inactiveFlag; 
}

public class WSResponse{
    public String ID;
    public String col;
    public String colValue;
    public String[] errors;
    public int lineNum;
    public int recNum;
}