3

I'm making a soap call to a service, but can't figure out how to correctly format and send arguments/parameters for the client.method that I want to use.

The client.describe() gives me this:

{ SysGestAgentApi: 
   { SysGestAgentApiSoapPort: 
      { EXECSQL: [Object]

....and a lot more, but this EXECSQL is the method I want to use. This method takes an SQL query as the only parameter as a string.

What I tried is this:

var soap = require('soap');
var url = 'http://ipaddress:port/sysgestagentapi/SysGestAgentApi.WSDL';
var args = 'SELECT * FROM _33NWEB';

soap.createClient(url, function(err, client) {
    client.SysGestAgentApi.SysGestAgentApiSoapPort.EXECSQL(args, function(err, result) {
        console.log(result.toJSON());
    });
});

It keeps responding with an error XML, which is this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<SOAP-ENV:Envelope
    xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"
    xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <SOAP-ENV:Fault>
            <faultcode>SOAP-ENV:Server</faultcode>
            <faultstring>WSDLReader:None of the matching operations for soapAction http://tempuri.org/SysGestAgentApi/action/SysGestAgentApi.VERSIUNE could successfully load the incoming request. Potential typemapper problem</faultstring>
            <detail>
                <mserror:errorInfo
                    xmlns:mserror="http://schemas.microsoft.com/soap-toolkit/faultdetail/error/">
                    <mserror:returnCode>-2147024809 : The parameter is incorrect.\r\n</mserror:returnCode>
                    <mserror:serverErrorInfo>
                        <mserror:description>WSDLReader:None of the matching operations for soapAction http://tempuri.org/SysGestAgentApi/action/SysGestAgentApi.VERSIUNE could successfully load the incoming request. Potential typemapper problem HRESULT=0x80070057: The parameter is incorrect.\r\n - Server:One of the parameters supplied is invalid. HRESULT=0x80070057: The parameter is incorrect.\r\n</mserror:description>
                        <mserror:source>WSDLReader</mserror:source>
                    </mserror:serverErrorInfo>
                    <mserror:callStack>
                        <mserror:callElement>
                            <mserror:component>WSDLReader</mserror:component>
                            <mserror:description>None of the matching operations for soapAction http://tempuri.org/SysGestAgentApi/action/SysGestAgentApi.VERSIUNE could successfully load the incoming request. Potential typemapper problem</mserror:description>
                            <mserror:returnCode>-2147024809 : The parameter is incorrect.\r\n</mserror:returnCode>
                        </mserror:callElement>
                        <mserror:callElement>
                            <mserror:component>Server</mserror:component>
                            <mserror:description>One of the parameters supplied is invalid.</mserror:description>
                            <mserror:returnCode>-2147024809 : The parameter is incorrect.\r\n</mserror:returnCode>
                        </mserror:callElement>
                    </mserror:callStack>
                </mserror:errorInfo>
            </detail>
        </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

P.S. In PHP I did it extremely simple:

$client = new SoapClient($url);
$response_xml_2 = $client->EXECSQL("SELECT * FROM _33NWEB");

and it responds with an xml containing the result of the query.

I can't figure out what am I doing wrong or how to correctly send the parameters for the EXECSQL method.

Any help would be very much appreciated!

Aaron Marton
  • 131
  • 1
  • 5
  • you should get request and response structure, print like this console.log(JSON.stringify(client.describe())); – suraj.tripathi Sep 22 '16 at 18:21
  • I did get this structure and I posted a part of it at the beginning of this question. It responds like this: { SysGestAgentApi: { SysGestAgentApiSoapPort: { EXECSQL: [Object]... The problem is that it does not accept the string parameter I'm sending to the method I'm using from the client service. It keeps responding with an error saying that "Parameter format is incorrect". I don't know what am I missing when creating the parameter object. – Aaron Marton Sep 22 '16 at 18:23
  • but Object is not expanded here, use JSON.stringify and print – suraj.tripathi Sep 22 '16 at 18:26
  • also why input string is in Curly brackets? it wont compile – suraj.tripathi Sep 22 '16 at 18:29
  • I tried it without curly brackets too, and it gave me the same error. The error is in the XML I pasted above. I'm absolutely positive, that is communicating with the client, and the problem is the args formatting. It keeps giving me "2147024809 : The parameter is incorrect." – Aaron Marton Sep 22 '16 at 18:36

0 Answers0