xsd:include exception in soapUI:org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException: error: Unexpected end of file after null

為{幸葍}努か 提交于 2020-06-16 07:51:25

问题


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

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

My xsd include

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

Actual Location of the xsd

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

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

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>

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>

I'm using spring+Maven+xsd+jaxb

Please help

Many Thanks


回答1:


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.

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.

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.



来源:https://stackoverflow.com/questions/31779004/xsdinclude-exception-in-soapuiorg-apache-xmlbeans-xmlexception-org-apache-xml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!