SOAP Web 服务结果 returns 500 错误代码

SOAP Webservice result returns 500 error code

我通过 Nodejs 使用了 SOAP Web 服务:

$(document).ready(function() {

    $.ajax({
            url: "/track/vehicule/getWebserviceRetourKYC",
            type: "POST",
            success : function(data, status, xhr) {
              console.dir(data);
            },
            error : function(xhr, status, error) {
              console.dir(error);
            }
          });

  });

var express = require('express');
var request = require("request");
var fs = require('fs');
var path = require('path');
var async = require('async');
var router = express.Router();
var db = require('./db');
var utils = require('./utils');
var connexion = db.getConnexion();

router.post("/getWebserviceRetourKYC", function(req, res) {
    var soap = require('strong-soap').soap;
    // wsdl of the web service this client is going to invoke. For local wsdl you can use, url = './wsdls/stockquote.wsdl'
    var url = "https://www.telma.net/sentimsa/mvola/wsdl.php?module=jWSDL&action=WSDL:wsdl&service=mvola~WSMVolaGetInfosKYC";

    var requestArgs = {
        module:'jWSDL',
        action:'WSDL:wsdl',
        service:'mvola~WSMVolaGetInfosKYC'
    };

    var options = {};
    soap.createClient(url, options, function(err, client) {
        var method = client['WSMVolaGetInfosKYCCtrl']['WSMVolaGetInfosKYCCtrlPort']['getInfosKYC'];
        console.dir(client);//here
        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));
        });
    });
    res.send();
});

module.exports = router;

运行时返回结果为:

{
    "statusCode": 500,
    "body": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>SOAP-ENV:Client<\/faultcode><faultstring>Error cannot find parameter<\/faultstring><\/SOAP-ENV:Fault><\/SOAP-ENV:Body><\/SOAP-ENV:Envelope>\n",
    "headers": 
    {
        "date": "Thu, 04 Jul 2019 05:51:26 GMT",
        "server": "Apache/2.2.3 (Red Hat)",
        "content-length": "294",
        "content-type": "text/xml; charset=utf-8",
        "content-language": "en",
        "connection": "close"
    },
    "request": 
    {
        "uri": 
        {
            "protocol": "https:",
            "slashes": true,
            "auth": null,
            "host": "www.telma.net",
            "port": 443,
            "hostname": "www.telma.net",
            "hash": null,
            "search": "?service=mvola%7EWSMVolaGetInfosKYC",
            "query": "service=mvola%7EWSMVolaGetInfosKYC",
            "pathname": "/sentimsa/mvola/soap.php",
            "path": "/sentimsa/mvola/soap.php?service=mvola%7EWSMVolaGetInfosKYC",
            "href": "https://www.telma.net/sentimsa/mvola/soap.php?service=mvola%7EWSMVolaGetInfosKYC"
        },
        "method": "POST",
        "headers": 
        {
            "User-Agent": "strong-soap/1.20.0",
            "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": "www.telma.net",
            "Content-Length": 396,
            "Content-Type": "text/xml; charset=utf-8",
            "SOAPAction": "\"https://www.telma.net/sentimsa/mvola/soap.php?service=mvola%7EWSMVolaGetInfosKYC&method=getInfosKYC\""
        }
    }
}

那么我的代码有什么问题?

------ 编辑 ------ :

这是信封的示例和所需的结果:

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mvol="https://www.telma.net/sentimsa/mvola/">

   <soapenv:Header/>

   <soapenv:Body>

      <mvol:getInfosKYC soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">

         <zSubscriberId xsi:type="xsd:string"> 0340017729</zSubscriberId>

      </mvol:getInfosKYC>

   </soapenv:Body>

</soapenv:Envelope>

回复:

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="https://www.telma.net/sentimsa/mvola/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">

   <SOAP-ENV:Body>

      <ns1:getInfosKYCResponse>

         <getInfosKYCReturn xsi:type="ns1:CCodeReponse">

            <oDataKYC xsi:nil="true" xsi:type="ns1:CKycInfos"/>

            <status_Code xsi:type="xsd:string">101</status_Code>

            <status_Reason xsi:type="xsd:string">Le numéro 0340017728 n’existe pas dans Sentinel.</status_Reason>

         </getInfosKYCReturn>

      </ns1:getInfosKYCResponse>

   </SOAP-ENV:Body>

</SOAP-ENV:Envelope>

错误:

<faultstring>Error cannot find parameter<\/faultstring>

表明您的请求中缺少一个必需的参数。您有正在使用的 SOAP 服务的文档吗? moduleactionservice 是唯一需要的参数吗?

此外,您还在 URL 字符串中包含了这些参数:

var url = "https://www.telma.net/sentimsa/mvola/wsdl.php?module=jWSDL&action=WSDL:wsdl&service=mvola~WSMVolaGetInfosKYC";

不确定这是否会导致问题,但至少不需要这样做。我会尝试从 URL 字符串中删除这些参数。