Comments (5)
Can you uncomment the wsdl property and set it to:
http://api.daft.ie/v2/wsdl.xml?wsdl
Thanks,
Raymond Feng
Co-Founder and Architect @ StrongLoop, Inc.
StrongLoop http://strongloop.com/ makes it easy to develop APIs http://strongloop.com/mobile-application-development/loopback/ in Node, plus get DevOps capabilities http://strongloop.com/node-js-performance/strongops/ like monitoring, debugging and clustering.
On Oct 20, 2014, at 4:20 PM, Gianfranco Palumbo [email protected] wrote:
var soap = require('soap');
var url = 'http://api.daft.ie/v2/wsdl.xml';soap.createClient(url, function(err, client) {
var args = {
'api_key': '...', // i can send this via email if needed
};
client['search_sale'](args, function%28err, result%29 {
if %28err%29 {
console.log%28err%29;
return;
}
console.log%28result%29;
});
});
$ node soap.js
{ results:
{ search_sentence: 'properties for sale anywhere in Ireland entered by',
pagination:
{ total_results: 35,
results_per_page: 10,
num_pages: 4,
current_page: 1,
first_on_page: 1,
last_on_page: 10 },
ads:
[ [Object],
[Object],
...
[Object],
[Object] ] } }
var loopback = require('loopback');
var path = require('path');var ds = loopback.createDataSource('soap', {
connector: 'loopback-connector-soap',
// remotingEnabled: true,
url: 'http://api.daft.ie/v2/wsdl.xml',
// wsdl: 'http://api.daft.ie/v2/wsdl.xml',
operations: {
searchSale: {
service: 'DaftAPIService',
port: 'DaftAPIService',
operation: 'search_sale'
}
}
});var args = {'api_key': '...'}; // i can send this via email if needed
// Unfortunately, the methods from the connector are mixed in asynchronously
// This is a hack to wait for the methods to be injected
ds.once('connected', function () {
// Create the model
var DaftService = ds.createModel('DaftAPIService', {});DaftService.searchSale(args, function (err, response) {
if (err) {
console.log('error: %j', err);
return;
}
console.log('response: %j', response);
});});
$ node daft.ie.soap.js
Connection fails: [Error: Invalid WSDL URL: http://api.daft.ie/v2/wsdl.xml?wsdlCode: 404
Response Body: <!DOCTYPE html
—
Reply to this email directly or view it on GitHub #6.
from loopback-connector-soap.
Hi Ray,
thanks for the quick reply. That didn't work.
It seems it's not reading the xml definitions and instead getting the html from daft.ie
I tried also downloading the wsdl.xml file and loading it as a file.
In this case I get:
error: {
"response": {
"statusCode": 301,
"body": "",
"headers": {
"server": "Varnish",
"retry-after": "0",
"location": "http://www.daft.ie/v2/wsdl.xml",
"date": "Mon, 20 Oct 2014 23:33:54 GMT",
"x-varnish": "2053246842",
"age": "0",
"via": "1.1 varnish",
"connection": "close",
"x-varnish-cache-result": "Miss"
},
"request": {
"uri": {
"protocol": "http:",
"slashes": true,
"auth": null,
"host": "api.daft.ie",
"port": 80,
"hostname": "api.daft.ie",
"hash": null,
"search": null,
"query": null,
"pathname": "/v2/wsdl.xml",
"path": "/v2/wsdl.xml",
"href": "http://api.daft.ie/v2/wsdl.xml"
},
"method": "POST",
"headers": {
"User-Agent": "node-soap/0.4.7",
"Accept": "text/html,application/xhtml+xml,application/xml,text/xml;q=0.9,*/*;q=0.8",
"Accept-Encoding": "none",
"Accept-Charset": "utf-8",
"Connection": "close",
"Host": "api.daft.ie:80",
"Content-Length": 0,
"Content-Type": "text/xml; charset=utf-8",
"SOAPAction": "\"DaftAPIService#agent_info\""
}
}
},
"body": ""
}
So i'm getting a 301 instead of 200 and there is no API key.
But if I don't put an API key in the first soap example, i get an error 500.
from loopback-connector-soap.
I assume there are two issues:
- Having trouble loading the wsdl from http://api.daft.ie/v2/wsdl.xml?wsdl
- Failing to pass in the api key. How should the api key be passed in? Via a header?
from loopback-connector-soap.
Yes. I think the first you're right. But the second I don't think it's the API. As there HTTP code does not change if you send the API or not.
If there is no API key it should return error 500.
But in either case, the api_key
should be passed as an argument of the service along side with the query
.
Would it be better if I send you my API key via email?
Thanks
from loopback-connector-soap.
Closing due to inactivity. If you are still running into problems, please feel free to leave a comment and I will reopen the issue.
from loopback-connector-soap.
Related Issues (20)
- Bump debug dependency to v4 HOT 4
- Nested Header XML Blocks HOT 1
- RangeError: Maximum call stack size exceeded HOT 5
- How to send dynamic values in soap headers? HOT 2
- Dependency Dashboard
- CI failure due to external site issue HOT 4
- CI: Re-enable 3 tests in loopback-connector-soap HOT 1
- Back port issue #67 to 3.x HOT 1
- set timeout HOT 2
- SOAP connector - correct examples, etc, in README HOT 7
- Unexpected Element generated (__cachedRelations included in payload message) HOT 13
- The `ModelDefinition` instance is not valid; `name` is invalid HOT 2
- CI failed due to missing .travis.yml HOT 4
- soap headers HOT 3
- Use local wsdl for tests HOT 2
- TypeError: Cannot read property 'pfx' of null HOT 2
- wsdl_options property not being used HOT 6
- WSDL url http auth HOT 6
- Unit tests failed (Invalid WSDL URL) HOT 4
- application does not start if a wsdl is down HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from loopback-connector-soap.