Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Soap web service schema location can't be found in wsdl

My web service is as a jar file and being used as a plugin from another web application, so I have only one web.xml in the main web app and give referance to my dispatcher servlet, and it works good, but my problem is when I want to use it by using its wsdl file by a soap client(soapUI can not find the schemas in the wsdl)

this is how my servlet.xml looks like in the jar file;

<bean id="schema" class="org.springframework.xml.xsd.SimpleXsdSchema">
    <property name="xsd" value="classpath:/resources/xwebservice/schemas/Request.xsd" />
</bean>

<bean id="mwsid"
    class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition">
    <constructor-arg value="classpath:/resources/xwebservice/spring-ws.wsdl"/>
</bean>

And this is how my wsdl file looks like it's name is spring-ws.wsdl

<wsdl:types>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <xsd:import namespace="http://www.mywebsite.com/xml/webservice"                      
            schemaLocation="/resources/xwebservice/schemas/Request.xsd"/>
    </xsd:schema>

This can not find the request.xsd schema when I try to access my webservice using a soap client(soapUI) by showing my wsdl url address, which is;

http://localhost:8080/mwp/mws/mwsid.wsdl

The wsdl and schema files are on different folders in my web service plugin jar, where is my mistake? I can expose the wsdl in browser by the url above, but soap client cant find the schemas in the path.

Thanks

like image 493
Spring Avatar asked Jan 24 '26 14:01

Spring


1 Answers

The SimpleXsdSchema exposes the schema as the name of the bean plus .xsd (in this case schema.xsd). So you have to update the WSDL to point to it:

schemaLocation="schema.xsd"
like image 200
Pau Giner Avatar answered Jan 26 '26 03:01

Pau Giner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!