node-soap icon indicating copy to clipboard operation
node-soap copied to clipboard

TypeError: Cannot set property 'targetNSAlias' of undefined

Open andrewkro opened this issue 14 years ago • 14 comments

Hey Guys,

After finally getting expat compiled and installed on windows, i've tried loading a wsdl into node-soap to create a web service server.

Ive loaded into SoapUI tool to test wsdl/xsd compliance and sent test request/response ok.

when i start a simple node http server, i get the following:

C:\Documents and Settings\Administrator\My Documents\Web Service Current\node_modules\soap\lib\wsdl.js:346 this.element.targetNSAlias = ns; ^ TypeError: Cannot set property 'targetNSAlias' of undefined at [object Object].postProcess (C:\Documents and Settings\Administrator\My Documents\Web Service Current\node_modules\soap\lib\wsdl.js:346:36) at [object Object].postProcess (C:\Documents and Settings\Administrator\My Documents\Web Service Current\node_modules\soap\lib\wsdl.js:378:17) at [object Object].postProcess (C:\Documents and Settings\Administrator\My Documents\Web Service Current\node_modules\soap\lib\wsdl.js:395:15) at [object Object].postProcess (C:\Documents and Settings\Administrator\My Documents\Web Service Current\node_modules\soap\lib\wsdl.js:408:14) at [object Object].postProcess (C:\Documents and Settings\Administrator\My Documents\Web Service Current\node_modules\soap\lib\wsdl.js:440:21) at C:\Documents and Settings\Administrator\My Documents\Web Service Current\node_modules\soap\lib\wsdl.js:594:36 at C:\Documents and Settings\Administrator\My Documents\Web Service Current\node_modules\soap\lib\wsdl.js:641:13 at C:\Documents and Settings\Administrator\My Documents\Web Service Current\node_modules\soap\lib\wsdl.js:641:13 at [object Object]._processNextInclude (C:\Documents and Settings\Administrator\My Documents\Web Service Current\node_modules\soap\lib\wsdl.js:635:26) at [object Object].callback (C:\Documents and Settings\Administrator\My Documents\Web Service Current\node_modules\soap\lib\wsdl.js:640:14)

The WSDL being loaded is here: http://pastebin.com/iECgpUJs The first import schema which is loaded (aidx/IATA_AIDX_FlightLegNotifRQ.xsd) is here: http://pastebin.com/5V0r3eYM

Any help would be greatly appreciated!

Andrew

andrewkro avatar Jun 25 '12 10:06 andrewkro

Was a NS issue, not sure if it was with node or the WSDL, but moving imported xsds into the wsdl was my workaround.

andrewkro avatar Jun 27 '12 00:06 andrewkro

still reproducible without any import. wsdl http://pastebin.com/YCkPMBUB

skarbovskiy avatar Dec 05 '13 09:12 skarbovskiy

Same problem here...

andreiashu avatar Dec 05 '13 19:12 andreiashu

+1

samccone avatar Jan 30 '14 01:01 samccone

I'm working on this one. The pastes have been removed from pastebin. What are the wsdl documents that I can use to reproduce your error?

christiaanwesterbeek avatar Feb 01 '14 13:02 christiaanwesterbeek

Same issue. For me this dirty workarround solved it:

wsdl.js line 409 add

if (!this.element) return; 

after

  this.element = definitions.schemas[definitions.xmlns[ns]].elements[nsName.name];

WSDL i am working with is http://product-api.affili.net/Authentication/Logon.svc?wsdl

sfakir avatar Feb 18 '14 23:02 sfakir

@sfakir See CONTRIBUTING.md. Can you issue a pull request with the fix, and a generic version of the WSDL under test/wsdl?

jsdevel avatar Feb 19 '14 01:02 jsdevel

I'm seeing the exact same behavior with this WSDL. http://explorit-test.jonesegloballibrary.com/strata_egl-test/services/searchService.wsdl

It does use import and include, but they are in the same directories. Not sure if that is the problem.

I did use the if (!this.element) return; hack, but when I try to use the client, there are a number of undefined elements.

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"  xmlns:impl="http://deepwebtech.com/assistant/search/" xmlns:query="http://deepwebtech.com/assistant/query/" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"><soap:Header></soap:Header><soap:Body><searchRequest xmlns:undefined="undefined" xmlns="undefined"><synchronousResults></synchronousResults><query></query></searchRequest></soap:Body></soap:Envelope>

Still scratching my head on this one.

shanestillwell avatar Mar 06 '14 22:03 shanestillwell

Having the same issue here. I'm no WSDL expert whatsoever, but what I've noticed is that the parsing breaks on the very first element; the element named IssueVAN.

The parser attempts to access the definition linked to the namespace tns, which is http://schemas.datacontract.org/2004/07/eNett.PublicServices.vNett.Host.ViewModels.v2 at the moment the error occurs. In the WSDL I see that tns gets defined in the root <wsdl:definitions> node, as well as in an <xs:schema> node.

Is this something you can work with? Again, I'm no WSDL expert, I might be completely wrong.

WSDL: http://pastebin.com/69vRaRNm

edorivai avatar Mar 21 '14 11:03 edorivai

I don't have time to actually try to debug and see where it's going wrong right now, but could you try and change line 76 in lib/wsdl.js and see if parsing the WSDL works?

Change it from

if (obj.hasOwnProperty(key)) {

to

if (obj.hasOwnProperty(key) && !base[key]) {

christiaanwesterbeek avatar Mar 21 '14 12:03 christiaanwesterbeek

Hi all.

I'm having the same problems as above, and I can confirm that the fix from @devotis works in my case. My WSDLs are generated by Asp.net WCF 4.0 and hosted on IIS7.

dotnetdummy avatar Apr 11 '14 14:04 dotnetdummy

@Himanshu4, are you going to submit a pull request? It’d be nice to see some progress here. This is keeping me from upgrading my project to use io.js.

andrewbranch avatar Feb 10 '15 00:02 andrewbranch

I have submitted a new pull request for the same issue.

Himanshu4 avatar Feb 10 '15 05:02 Himanshu4

Since @Himanshu4 s PR is merged in now, this should be solved.

herom avatar Feb 10 '15 19:02 herom