services.xml build.xml无法生成存根

时间:2015-03-29 13:55:51

标签: java xml ant axis2 stub

构建xml文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project>
<project name="3500259" basedir="." default="generate.stubs">
    <property environment="env"/>
    <property file="build.properties"/>
    <property name="build.dir" value="build"/>
    <path id="axis2.classpath">
        <!-- pick up log4j.properties in the project root -->
        <pathelement location="./src"/>
        <fileset dir="F:\axisServiceHome\axis2-1.6.2/lib">
            <include name="*.jar"/>
        </fileset>
    </path>
    <target name="generate.stubs">
        <!-- modified and commented by 3500259 -->
        <java classname="org.apache.axis2.wsdl.WSDL2Java"   classpathref="axis2.classpath">
            <!-- the location of the wsdl (which is automatically generated 
            by Axis) -->
            <arg line="-uri ${librarywsdl.uri}"/>
            <!-- overwrite existing generated code (if it exists) -->
            <arg line="-or"/>
            <!-- Generate Java stub (since axis is multi-language) -->
            <arg line="-l java"/>
            <!-- unwrap paramaters to java types -->
            <arg line="-uw"/>
            <!-- specifiy destination package -->
            <arg line="-p stubs"/>
            <!-- databinding technique between SOAP and Java (ADB=proprietry 
            Axis data binding) -->
            <arg line="-d adb"/>
        </java>
    </target>
</project>

构建属性文件

librarywsdl.uri=http://localhost:8080/axis2/services/Library?wsdl
axis2.home=F:/axisServiceHome/axis2-1.6.2

服务xml文件

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
 <servicegroup>
<service name="AccommodationServiceImpl"class="accommodation.AccommodationServiceImpl"scope="application" targetNamespace="http://AccommodationServiceImpl/">
    <description>AccommodationService</description>
    <messageReceivers>
        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
            class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"  />
        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
            class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
    </messageReceivers>
    <schema schemaNamespace="http://AccommodationServiceImpl/xsd" />
    <parameter    name="AccommodationServiceImpl">AccommodationServiceImpl</parameter>
</service>
<service name="AirlineServiceImpl" class="airline.AirlineServiceImpl"  scope="application" targetNamespace="http://AirlineServiceImpl/">
    <description>AirlineService</description>
    <messageReceivers>
        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
            class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
        <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
            class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
    </messageReceivers>
    <schema schemaNamespace="http://AirlineServiceImpl/xsd" />
    <parameter name="AirlineServiceImpl">AirlineServiceImpl</parameter>
</service>
</servicegroup>

错误被抛弃

Retrieving document at '${librarywsdl.uri}'.
 [java] org.apache.axis2.wsdl.codegen.CodeGenerationException: Error parsing WSDL

这三个文件有什么问题吗?我无法生成.arr文件。这三个文件来自我正在处理的Web服务项目。

1 个答案:

答案 0 :(得分:0)

我想通了,我需要创建服务来获取.arr然后使用这个.arr来获取构建存根的WSDL。我创建了一个服务构建并生成了一个.arr文件,但是在我将它上传到服务器后,它会抛出一个错误,这使得我无法获得WSDL。 错误如下: 错误:org.apache.axis2.deployment.DeploymentException:在org.apache.axis2.deployment.ServiceDeployer的org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader.java:150)中找到无效的services.xml .deploy(ServiceDeployer.java:82)atg.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:813) )org.apache.axis.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)位于org.apache.axis上的org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)。 deploy.RepositoryListener.checkServices(RepositoryListener.java:254)org.apache.axis2.deployment.RepositoryListener.startListener(RepositoryListener.java:371)org.apache.axis2.deployment.scheduler.SchedulerTask.checkRepository(SchedulerTask.java: 73)在org.apache的org.apache.axis2.deployment.scheduler.SchedulerTask.run(SchedulerTask.java:94) java.util.TimerThread.run(未知来源)中java.util.TimerThread.mainLoop(未知来源)的.axis2.deployment.scheduler.Scheduler $ SchedulerTimerTask.run(Scheduler.java:93)引起:org.apache。 axis2.AxisFault:org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:111)中org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader)中找到的无效services.xml .java:143)... 12更多