holidayextras / wsdl2.js

A NodeJS tool to consume a WSDL file and output a neat, manageable Javascript library.
GNU General Public License v3.0
25 stars 17 forks source link

Not Getting Types, Elements & Methods in Service #2

Closed lkatney closed 10 years ago

lkatney commented 11 years ago

I am simply parsing my WSDL file with wsdl.js.. it creates all types and elements in folders but while accessing , it shows null..

I am using below code:

var Service = require('itemQuery'); console.log('someRequest: '+JSON.stringify(Service));

If , I print Service through console.log..it shows :

someRequest: {"Types":{},"Elements":{},"Settings":{"debugSoap":false,"benchmark":true,"createMock":false,"useMock":false ,"modeler":{"debug":false}},"HTTP_Port":{},"HTTPS_Port":{}}

In this, I am not getting any types+ elements.HTTP_Port is my binding, but not getting method names...

I have checked my servicedefinition.js, it is fine with right structure.

As per my understanding, it is conflicting somewhere in index.js..

Does anyone ever faced this issue..Any help will be appreciated!!

lkatney commented 11 years ago

I think, this part in index.js is not working:

parent[properties.input.replace("Element", "")] = function(json) { var newObject = new models[properties.input](json, this); this.request = function(callback) { doSoapRequest(url, functionName, properties.soapAction, this, properties.input, properties.output, namespace, callback); }; Object.defineProperty(this, "request", { enumerable: false }); this.preview = function() { return "<"+functionName+">"+jsonToXml(this)+"</"+functionName+">"; }; Object.defineProperty(this, "preview", { enumerable: false }); this.debug = function() { console.log("----", functionName+" Request", "----"); console.log("JSON:", JSON.stringify(this, null, 2)); console.log("XML: ", this.preview()); console.log("Validates:", this.validate()); console.log("------------------------"); }; Object.defineProperty(this, "debug", { enumerable: false }); Object.preventExtensions(this);

hxoliverrumbelow commented 11 years ago

index.js is working fine.

This is how your filesystem should look after generating some code:

├── MyServiceName
│   ├── Element
│   │   ├── SomeElementName1.js
│   │   └── SomeElementName2.js
│   ├── index.js
│   ├── Modeler.js
│   ├── ServiceDefinition.js
│   └── Type
│       ├── SomeTypeName1.js
│       └── SomeTypeName2.js

The elements and types are loaded in index.js like this:

var includeList = fs.readdirSync(__dirname+"/Element");
...
var includeList = fs.readdirSync(__dirname+"/Type");

I expect you've moved the files/folders around and they're simply not in the correct place anymore.

lkatney commented 11 years ago

Thanks for replying..

I haven't changed or moved files.. it is in same structure...if I use console.log to check include list , it prints all types and elements..but printing Service variable shows both type and elements null

hxoliverrumbelow commented 11 years ago

Something is stopping your node process from reading from those folders. Try checking the permissions on them, maybe you generated the code as a different user (root maybe?) and no longer have permission to read from them?

Beyond that, I can't help. It's a system issue. Sorry.

lkatney commented 11 years ago

it is processing everything except for that particular section in index.js..Not creating any error as well...

I am system admin and have access to read files as well...I don't think that is a problem...

Anyways, thanks for your help..