Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not import base namespaces #94

Open
iurisilvio opened this issue Mar 26, 2017 · 5 comments
Open

Do not import base namespaces #94

iurisilvio opened this issue Mar 26, 2017 · 5 comments

Comments

@iurisilvio
Copy link
Contributor

Some schemas import XSD namespaces, like http://schemas.xmlsoap.org/soap/envelope/ and http://schemas.xmlsoap.org/soap/encoding/.

What is the right way to avoid import these URLs? Per domain? Any URL in namespaces module? Only these two hard-coded?

<xs:import
    namespace="http://schemas.xmlsoap.org/soap/envelope/"
    schemaLocation="http://schemas.xmlsoap.org/soap/envelope/" />
<xs:import
    namespace="http://schemas.xmlsoap.org/soap/encoding/"
    schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />

As a side note, xsd2py generate broken code with them.

@ngnpope ngnpope added this to the 0.6.0 milestone May 4, 2017
@ngnpope
Copy link
Member

ngnpope commented May 8, 2017

@oskrkal: might this be addressed by your xsd-resolver branch?

@oskrkal
Copy link
Contributor

oskrkal commented May 25, 2017

@pope1ni: I'm sorry for late response, I somehow missed your comment.

I'm not sure if I understand the problem correctly. Is it that the schemaLocation attribute is not mandatory and only the namespace is sometimes specified in the import attribute? If so, the XSDCachedSchemaResolver indeed could address this issue. It allows to pre-define schema location for specific namespaces and is then able to resolve the schema purely by the namespace, if location is not specified.

Another feature of the resolver is that it caches all schemas, so it can save some time when, for example, a WSDL file imports a lot of schemas, most of which import a common set of other schemas.

The branch should be ready for merging into upstream. I just thought I would go through it and fix some of the constructions that you fixed in my last pull request, but I have been quite busy at work recently.

@ngnpope
Copy link
Member

ngnpope commented May 25, 2017

@iurisilvio: can you clarify - my understanding from what you have written was that these shouldn't be imported at all?

@iurisilvio
Copy link
Contributor Author

Yes, I think soap/envelope and soap/encoding should be ignored. We implement them internally.

I have some third-party WSDLs with these imports, I can't use soapfish with them. Even if the generated code is not broken, it is still a lot of useless code.

These namespaces are in https://github.com/soapteam/soapfish/blob/master/soapfish/namespaces.py#L22, maybe we can use it to define these "ignored schemas".

@oskrkal
Copy link
Contributor

oskrkal commented May 31, 2017

All right, thanks for clarification. Then I think XSDSchemaResolver/XSDCachedSchemaResolver in my xsd-resolver branch is not the right place to address this problem. Its purpose is simply to load a schema file from correct location, parse it and return it to the caller, or to return a cached xsdspec.Schema instance if the schema has already been processed.

We probably need to somehow preload internally implemented schemas into known_paths list and ensure that get_type function returns correct module and class name.

@ngnpope ngnpope modified the milestones: 0.6.0, 0.7.0 May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants