-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
AssertionError: Invalid child type when WSDL contains imports or includes #322
Conversation
Fix "AssertionError: Invalid child type" caused by any WSDL containing imports or includes.
Sample WSDL containing an import. ```xml ... <wsdl:import location="https://192.168.2.2:8080/soap/Konto?wsdl=KontoService.wsdl" namespace="http://service.soap.hbci.jameica.willuhn.de/"></wsdl:import> ... ```
@boustanihani looks good. The travis build failed though https://travis-ci.org/vpulim/node-soap/jobs/22829904#L366 |
It says WSDL Parser (strict) should parse and describe reproduce_issues_125_and_312.wsdl: |
@boustanihani did you run |
no I did not :) |
I am new to using Git and this was my first Pull Request ever... The main issue is that node-soap has no logic to handle includes & imports. So an "AssertionError: Invalid child type" is automatically thrown when such an element is found... I thought it is good to ignore those elements temporarily until node-soap has logic to handle them... |
@boustanihani glad I could be here for your first Pull Request! What happens when you comment out your fix? Do you get a different error? |
Before the fix I was getting "AssertionError: Invalid child type" and after I put my fix there were no more errors... You know, WSDLs sometimes have "import" elements like in the sample I posted and node-soap has no logic to deal with such elements and for this reason node-soap regards such elements as invalid and thows the error above! Check: http://www.w3.org/TR/wsdl#_document-n <definitions .... >
<import namespace="uri" location="uri"/> *
</definitions> |
It is exactly this function which fails when AssertionError: Invalid child type //...
DefinitionsElement.prototype.addChild = function(child) {
var self = this;
if (child instanceof TypesElement) {
self.schemas = child.schemas;
}
else if (child instanceof MessageElement) {
self.messages[child.$name] = child;
}
else if (child instanceof PortTypeElement) {
self.portTypes[child.$name] = child;
}
else if (child instanceof BindingElement) {
if (child.transport === 'http://schemas.xmlsoap.org/soap/http' ||
child.transport === 'http://www.w3.org/2003/05/soap/bindings/HTTP/')
self.bindings[child.$name] = child;
}
else if (child instanceof ServiceElement) {
self.services[child.$name] = child;
}
else if (child instanceof DocumentationElement) {
}
else {
assert(false, "Invalid child type");
}
this.children.pop();
};
//... |
Another test case: |
Umm, I think I may have fixed this see: commit. Although, I don't think it is quite right, semantic-wise but I don't really know much about XML orSOAP or WSDL so please let me know if you have any suggestion on how to improve it… I also added a test case using http://api.temando.com/schema/2009_06/server.wsdl and it seems to work correctly, with OK, I made a new PR #337 |
Any WSDL containing imports or includes will cause following error => "AssertionError: Invalid child type"
Sample WSDL to reproduce the issue => test/wsdl/strict/reproduce_issues_125_and_312.wsdl
Check: https://github.com/vpulim/node-soap/issues/125 (Almost a year ago)
Also Check : https://github.com/vpulim/node-soap/issues/312
I suggest those types of elements are ignored temporary until node-soap has some logic to handle them.