【问题标题】:services.xml build.xml cannot generate the stubsservices.xml build.xml 无法生成存根
【发布时间】:2015-03-29 13:55:51
【问题描述】:

构建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 服务项目。

【问题讨论】:

  • 您的 wsdl uri 是否正确,您的网络/应用服务器是否已启动并运行?
  • 在哪里可以找到我的 uri?我的服务器已启动并正在运行
  • 它由您通过属性librarywsdl.uri定义?
  • 但是“librarywsdl.uri=localhost:8080/axis2/services/Library?wsdl”是我从另一个项目复制的,我不确定在这种情况下正确的 uri 是什么?知道我怎么能找到它吗?
  • build.xml中的注释说

标签: java xml ant axis2 stub


【解决方案1】:

我想通了,我需要创建服务来获取 .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) 在 org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136) 在 org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:813 ) 在 org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377) 在 org.apache.axis2 的 org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)。 deployment.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.axis2.deployment.scheduler.SchedulerTask.run(SchedulerTask.java:94) 在 org.apache .axis2.deployment.scheduler.Scheduler$SchedulerTimerTask.run(Scheduler.java:93) at java.util.TimerThread.mainLoop(Unknown Source) at java.util.TimerThread.run(Unknown Source) 原因:org.apache。 axis2.AxisFault:在 org.apache.axis2.deployment.repository.util.ArchiveReader.processServiceGroup(ArchiveReader) 的 org.apache.axis2.deployment.repository.util.ArchiveReader.buildServiceGroup(ArchiveReader.java:111) 中发现无效的 services.xml .java:143) ... 12 个以上

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-13
    • 2015-11-03
    • 1970-01-01
    • 2021-06-27
    • 1970-01-01
    相关资源
    最近更新 更多