soapUI:org.apache.xmlbeans.XmlException中的xsd:include异常:org.apache.xmlbeans.XmlException:错误:null后文件意外结束 [英] xsd:include exception in soapUI:org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: error: Unexpected end of file after null

查看:541
本文介绍了soapUI:org.apache.xmlbeans.XmlException中的xsd:include异常:org.apache.xmlbeans.XmlException:错误:null后文件意外结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在soapUI中创建新项目并从URL导入wsdl文件时遇到问题,它给了我下面的异常

I have a problem while creating new project in soapUI and importing wsdl file from URL.It gives me the below exception

加载[ http://localhost:8080/WS/PersonalDetails.xsd] :org.apache.xmlbeans.XmlException:org.apache.xmlbeans.XmlException:错误:null后文件意外结束

Error loading [http://localhost:8080/WS/PersonalDetails.xsd]: org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: error: Unexpected end of file after null

我的xsd包含

<xsd:include schemaLocation="PersonalDetails.xsd" />
<xsd:include schemaLocation="PersonalRequest.xsd" />

xsd的实际位置

WS/src/main/webapp/schemas/PersonalDetails.xsd

WS/src/main/webapp/schemas/PersonalRequest.xsd

我的spring-ws.xml

My spring-ws.xml

<bean id="MyWSService" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition" lazy-init="true">
    <property name="schemaCollection">
        <bean class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
            <property name="inline" value="false" />
            <property name="xsds">
                <list>
                    <value>schemas/PersonalDetailsServiceOperations.xsd</value>
                </list>
            </property>
        </bean>
    </property>
    <property name="portTypeName" value="MyWSEndpoint"/>
    <property name="serviceName" value="MyWS" />
    <property name="locationUri" value="/"/>
</bean>

我的PersonalDetailsS​​erviceOperations.xsd

My PersonalDetailsServiceOperations.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:person="http://MyWS.com/"
targetNamespace="http://MyWS.com/"
elementFormDefault="qualified">
<xsd:include schemaLocation="PersonalDetails.xsd" />
<xsd:include schemaLocation="PersonalRequest.xsd" />
</xsd:schema>

我正在使用spring + Maven + xsd + jaxb

I'm using spring+Maven+xsd+jaxb

请帮助

非常感谢

推荐答案

通常会发生这种情况,因为您没有将WSDL的正确位置粘贴到SOAP UI中.当您在浏览器中浏览到WSDL时,spring-ws将在几乎所有的url上提供它,只要它以XYZService.wsdl(或您配置为它的任何东西)结尾即可.不利的一面是,当您使用某个模式中的相对路径导入XSD时,SOAP UI会尝试根据您提供的路径来解析相对路径,但是就像我说的那样,这实际上并不是真正的路径. WSDL.

Often this happens because you're not pasting in the correct location to the WSDL into SOAP UI. When you browse to your WSDL in a browser, spring-ws will serve it up on almost any url, so long as it ends in XYZService.wsdl (or whatever you have configured it to be). The downside to this is, when you have XSD imported using relative paths inside your schema somewhere, SOAP UI tries to to resolve the relative path based on the path you gave it, but like I said, that may not actually be the real path to the WSDL.

例如,在我们的应用程序中,我们有一个Spring-ws Web服务,称为ProcessService.它在 http://localhost:11000/ws/service/process/ProcessService.wsdl中提供,它包含使用相对路径导入的XSD.如果将此URL粘贴到SOAP UI中并运行它,它将正确解析XSD的路径.但是,您可以浏览到 http://localhost:11000/hello-world/ProcessService.wsdl ,即使URL不正确,它仍将为您提供WSDL服务.现在,如果您使用 http://localhost:11000/hello-world/ProcessService.wsdl 并将其粘贴到SOAP UI中,将无法正确解析导入的XSD的相对路径,因为这不是实际的URL.在这种情况下,SOAP UI会为您提供确切的错误.

For example, in our application we have a Spring-ws web service call ProcessService. It's served up at http://localhost:11000/ws/service/process/ProcessService.wsdl and it contains an imported XSD using relative paths. If you paste this URL into SOAP UI and run it, it correctly resolves the path to XSD. However, you can browse to http://localhost:11000/hello-world/ProcessService.wsdl and it will still serve you up the WSDL even though the URL is not correct. Now if you take http://localhost:11000/hello-world/ProcessService.wsdl and paste it into SOAP UI it won't be able to resolve the relative path to imported XSD correctly because that's not the actual URL. In this case SOAP UI gives you that exact error.

我将在浏览器中浏览到您的XSD,并确保可以看到它.然后,我将检查您要粘贴到SOAP UI中的URL,并从相对URL中查看是否可以正确解析.如果不是,则需要为SOAP UI提供正确的路径.

I would browse to your XSD in the browser and make sure you can see it. Then I would check the URL you are pasting into SOAP UI and see if from the relative URLs actually resolve correctly. If not, you need to give the correct path to SOAP UI.

这篇关于soapUI:org.apache.xmlbeans.XmlException中的xsd:include异常:org.apache.xmlbeans.XmlException:错误:null后文件意外结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆