Closed yuvanesh10 closed 6 years ago
this.http.get('../assets/check_username.wsdl').subscribe(response => ...
I believe it should be:
this.http.get('/assets/check_username.wsdl').subscribe(response => ...
let url = operation.url.replace("http://192.168.74.266","");
Host replacement should be done only in case your have cors problems, and in this case you have to replace the url with the proxied one and start ionic with the proxy, as mentioned in the readme.
The server file what I am using has been tested with client in Node.js. It works fine there. If you dont mind can you have a look at it. serverfile.js `var soap = require('strong-soap').soap; var http = require('http');
var myService = {
CheckUserName_Service: {
CheckUserName_Port: {
checkUserName: function(args, soapCallback) {
console.log('checkUserName: Entering function..');
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "X-Requested-With");
db.query(aqlQuery`
LET startVertex = (FOR doc IN spec
FILTER doc.serial_no == '"123456abcde"'
LIMIT 2
RETURN doc
)[0]
FOR v IN 1 ANY startVertex belongs_to
RETURN v.ip`,
{
bindVar1: 'value',
bindVar2: 'value',
}
).then(function(response) {
console.log(`Retrieved documents.`, response._result);
soapCallback(JSON.stringify(response._result));
})
.catch(function(error) {
console.error('Error getting document', error);
soapCallback('Error getting document' + error.message);
});
}
}
}
};
var xml = require('fs').readFileSync('check_username.wsdl', 'utf8');
var server = http.createServer(function(request,response) {
response.end("404: Not Found: " + request.url);
});
var port = 8080;
server.listen(port);
var soapServer = soap.listen(server, '/test', myService, xml);
soapServer.log = function(type, data) {
console.log('Type: ' + type + ' data: ' + data);
};
console.log('SOAP service listening on port ' + port);
`
this was my client file in node.js
"use strict";
var soap = require('strong-soap').soap;
var url = 'http://192.168.72.237:8000/test?wsdl';(//location of my check_username.wsdl file)
var options = { endpoint: 'http://192.168.72.237:8000/test'};
var requestArgs = { userName: "TEST_USER" };
soap.createClient(url, options, function(err, client) {
if (err) {
console.error("An error has occurred creating SOAP client: " , err);
} else {
var description = client.describe();
console.log("Client description:" , description);
var method = client.checkUserName;
method(requestArgs, function(err, result, envelope, soapHeader) {
//response envelope
console.log('Response Envelope: \n' + envelope);
//'result' is the response body
console.log('Result: \n' + JSON.stringify(result));
});
}
});
Well I never used strong-loop so I can't be of much help here. The error states you cannot call POST method (404 Not found), so it seems the endpoint you are calling does not exist.
You mean proxy in the sense of replacing the url with something like(""www.examples.com")
You have to replace it with what you have configured in your proxy.conf.json. However, you have to do that only in case you have cors problems. In your case you have control of your server and you can configure (as you did) the allowed origin.
EDIT
Sorry reopened by mistake.
@lula is there no way that you can be able to help ? Is there any other working hlep ? I have been working on this for a week now
I'm sorry but I have no knowledge of strong-soap. Try to call you ws with SoapUI rather than creating a node client with the same strong-soap lib. Check what is the content of the wsdl after this.http.get('../assets/check_username.wsdl').subscribe(...
, see what is the URL of the operation and use the operation in the subsequent call.
If you could setup a repository with the server already working I might clone it and have a look.
@lula That would be a big help..Thank you. Give me a moment, I will upload it in github
@lula I have created a public gist and I have uploaded all the server side files. Please have a look https://gist.github.com/yuvanesh10/2a8c9cf6af659d95dd3cc8ccebfa52c4
Just quickly checked. I cannot even load the wsdl you provided with a test app.
that is the working file actually..,I am able to receive the query result from the db.
@yuvanesh10 is this a joke ahah? Or are you just trying to have me build the test case for you?
The wsdl in the gist is broken:
And BTW, operation url is not even pointing to your soap service.
You have the 404 error because you always respond with the 404:
You use a res
object inside the soap web service without even having it anywhere in the code, so even after solving all other errors the web service throw a 500:
After solving all those things up there, and having set cors correctly on the server, ngx-soap should work as expected, as no problem of this issue was ever related to it.
Please remember this is an issue repository, not a teaching community. Next time you open an issue, be sure it's a real issue and not some general help about anything.
@lula 1.Oh no..,don't think of that way..,seriously the code what I have posted over there was real working code. 2.That was a mistake at the gist.I have changed it. I have added my .ts file too. I am just looking for some help, thats all. 3.I have removed the response header from servicefile as well Sorry to bother you in this way.
@yuvanesh10 I'm sorry I've been harsh. Hope at least you can achieve what you want to do. Cheers!
@lula I get it..,because the problem is so vague and I have been pestering !! sorry for that
@lula I just have one doubt..,why does the url keep pointing to different one. But it is accessing the serverfile.js in (192.168.72.221) ..,but I have stored the file in (192.168.72.236)
I have already created both client and server file in node js and it works super fine. But I would like to create a client in angular 4. I have solved most of the errors concering to it. But now I am stuck to this body error and the URL is pointing to the host. Please can you have a look There are no help available from stackoverflow or other ##forum.
app.component.ts
@lula @sonicos