Чем отличается PHP-SOAP от NODEJS-SOAP в моем коде? - PullRequest
0 голосов
/ 08 октября 2019

Я пробовал с PHP, и он работает отлично, но он не работает с кодом nodejs. Есть ли проблема, что мне делать?

PHP CODE

 $client = new SoapClient( "http://www.niso.org/schemas/sushi/counter_sushi4_1.wsdl", array(
            'location' => 'http://sushi4.scholarlyiq.com/SushiService.svc',
        ));

 $result = $client->GetReport(array
            (
                'Requestor' => array
                (
                    'ID' => '',
                    'Name' => '',
                    'Email' => '',
                ),
                'CustomerReference' => array
                (
                    'ID' => '',
                ),
                'ReportDefinition'  => array
                (
                    'Filters' => array
                    (
                        'UsageDateRange' => array
                        (
                            'Begin' => '2018-01-01',
                            'End' => '2018-01-31'
                        )
                    ),
                    'Name' => 'JR1',
                    'Release' => '4'
                ),
            )
        );

NODEJS CODE


const COUNTER4_URL = 'http://www.niso.org/schemas/sushi/counter_sushi4_1.wsdl';
  let sendData = {
        'ReportRequest' : {
            'Requestor' : {
                'ID' : '',
                'Name' : '',
                'Email' : '',
            },
            'CustomerReference' : {
                'ID' : '',
            },
            'ReportDefinition' : {
                'Filters' : {
                    'UsageDateRange' : {
                        'Begin' : '2018-01-01',
                        'End' : '2018-01-31',
                    }
                },
                'attributes' : {
                    'Name' : 'JR1',
                    'Release' : 4,
                }
            },
        },
    };

    let soapArgs = {
        'endpoint' : 'http://sushi4.scholarlyiq.com/SushiService.svc',
    };

    soap.createClient(COUNTER4_URL, soapArgs, function(err, client) {
        client.GetReport(sendData, async function(err, result) {
           // return;
            if(err){
                console.error(err);
            }

            console.log(result);
});
});

Результат PHP (я хочу это в скрипте nodejs)

{#918 ▼
  +"Exception": {#919 ▼
    +"Number": 1000
    +"Severity": "Info"
    +"Message": "Unrecognized Guid format."
    +"HelpUrl": "http://www.scholarlyiq.com/Sushi.aspx"
    +"Data": null
  }
  +"Requestor": {#920 ▶}
  +"CustomerReference": {#921 ▶}
  +"ReportDefinition": {#922 ▶}
  +"Created": "2019-10-08T16:09:17"
  +"ID": "234870eb-f5c0-433b-94d0-691594d85690"
  +"Report": null
}

Результат Nodejs

{
....
    "body": "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Body><s:Fault><faultcode xmlns:a=\"http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher\">a:InternalServiceFault</faultcode><faultstring xml:lang=\"en-AU\">The server was unable to process the request due to an internal error.  For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the &lt;serviceDebug&gt; configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs.</faultstring></s:Fault></s:Body></s:Envelope>"
}

Поэтому я хочу получить результат в nodejs, который возвращается мылом php. параметров можно решить?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...