2

Is it required that each schema must have a unique namespace in a wsdl? For an example consider the below WSDL snippet which does not have a namespace for the schemas.

<wsdl:types>
 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:import namespace="http://example.com/WSDL/service/1.0.0/" schemaLocation="GetFilterValuesRequest.xsd"/>
 </xsd:schema>
 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:import namespace="http://example.com/WSDL/service/1.0.0/" schemaLocation="GetFilterValuesReply.xsd"/>
 </xsd:schema>
 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:import namespace="http://example.com/WSDL/service/1.0.0/" schemaLocation="IRequest.xsd"/>
 </xsd:schema>
 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:import namespace="http://example.com/WSDL/service/1.0.0/" schemaLocation="IReply.xsd"/>
 </xsd:schema>
</wsdl:types>

The reason I am asking is because, I am using node-soap library for writing a WSDL service, and the library service does not work when there are either conflicting namespaces in schema or no namespaces at all.

It gives an error saying Cannot read property 'input' of undefined, when the SOAP request is sent, as it builds a map of schemas by their namespace and then later fails to find unique schema for a given request.

I do not want to go in much details of error or its fix, but, wanted to understand that is it something required for a WSDL to be a valid one?

prasun
  • 7,073
  • 9
  • 41
  • 59

1 Answers1

0

Yes namespaces are required for a SOAP server to function properly with most clients.

Your schemas are all in the same namespace, so if you have data structures defined with the same name, this will be a problem.

Namespaces in XML are just like namespaces in programming languages. They prevent datatypes of the same name from colliding with each other.

Note that the namespace does not have to be a URL. That is just a convention. It can be anything, it just needs to be unique.

Kris Peeling
  • 1,025
  • 8
  • 18