MCPcopy
hub / github.com/vpulim/node-soap / postProcess

Method postProcess

src/wsdl/elements.ts:597–712  ·  view source on GitHub ↗
(definitions: DefinitionsElement)

Source from the content-addressed store, hash-verified

595 public parts = null;
596
597 public postProcess(definitions: DefinitionsElement) {
598 let part: any = null;
599 const children = this.children || [];
600
601 for (const child of children) {
602 if (child.name === 'part') {
603 part = child;
604 break;
605 }
606 }
607
608 if (!part) {
609 return;
610 }
611
612 if (part.$element) {
613 let lookupTypes: any[] = [];
614
615 delete this.parts;
616
617 const nsName = splitQName(part.$element);
618 const ns = findNs(nsName.prefix, this.definitionsXmlns, definitions.xmlns);
619 let schema = definitions.schemas[ns];
620 this.element = schema.elements[nsName.name];
621 if (!this.element) {
622 debug(nsName.name + ' is not present in wsdl and cannot be processed correctly.');
623 return;
624 }
625 this.element.targetNSAlias = nsName.prefix;
626 this.element.targetNamespace = ns;
627
628 // set the optional $lookupType to be used within `client#_invoke()` when
629 // calling `wsdl#objectToDocumentXML()
630 this.element.$lookupType = part.$element;
631
632 const elementChildren = this.element.children;
633
634 // get all nested lookup types (only complex types are followed)
635 if (elementChildren.length > 0) {
636 for (const child of elementChildren) {
637 lookupTypes.push(this._getNestedLookupTypeString(child));
638 }
639 }
640
641 // if nested lookup types where found, prepare them for furter usage
642 if (lookupTypes.length > 0) {
643 lookupTypes = lookupTypes
644 .join('_')
645 .split('_')
646 .filter(function removeEmptyLookupTypes(type) {
647 return type !== '^';
648 });
649
650 const schemaXmlns = definitions.schemas[this.element.targetNamespace].xmlns;
651
652 for (let i = 0; i < lookupTypes.length; i++) {
653 lookupTypes[i] = this._createLookupTypeObject(lookupTypes[i], schemaXmlns);
654 }

Callers

nothing calls this directly

Calls 6

splitQNameFunction · 0.90
findNsFunction · 0.85
deleteFixedAttrsMethod · 0.80
descriptionMethod · 0.45

Tested by

no test coverage detected