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

15,438

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.

Share:
15,438
senthil raja
Author by

senthil raja

Updated on June 04, 2022

Comments

  • senthil raja
    senthil raja almost 2 years

    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