Я использую Следующий код для вызова Soap API В узле js Но я не получаю ответ назад, но когда я использую этот api в java, я вернусь правильно с данными выше xml * .Below это мой код, который я использую. пожалуйста suggst мне правильный код .My код ниже, я использую модуль НПМ мыло работать на немЗвонок SOAP API в узле js и получение ошибки
var Client = require('node-rest-client').Client;
var client = new Client();
// request and response additional configuration
var args = {
headers: { "test-header": "client-api" },
data: "<xml><NMFIIService><service_request><appln_id>MFS37314 </appln_id><broker_code>ARN-37314</broker_code><password>QC1RA3CJ</password><user_type>Broker</user_type><broker_loc_code>M3</broker_loc_code><iin>5011164069</iin><sub_trxn_type>N</sub_trxn_type><poa>Y</poa><trxn_acceptance>OL</trxn_acceptance><demat_user>N</demat_user><dp_id></dp_id><bank>ICI</bank><ac_no>017701520489</ac_no><ifsc_code>ICIC0000177</ifsc_code><sub_broker_arn_code></sub_broker_arn_code><sub_broker_code></sub_broker_code><euin_opted>Y</euin_opted><euin>E049164</euin><trxn_execution>Y</trxn_execution><remarks>test</remarks><payment_mode>OL</payment_mode><billdesk_bank>ICI</billdesk_bank><instrm_bank></instrm_bank><instrm_ac_no></instrm_ac_no><instrm_no></instrm_no><instrm_amount>1</instrm_amount><instrm_date></instrm_date><instrm_branch></instrm_branch><instrm_charges></instrm_charges><micr></micr><rtgs_code></rtgs_code><neft_ifsc></neft_ifsc><advisory_charge></advisory_charge><dd_charge></dd_charge><cheque_deposit_mode></cheque_deposit_mode><debit_amount_type></debit_amount_type><nominee_flag>C</nominee_flag><no_of_nominee>1</no_of_nominee><nominee1_name>BHAVNA KHATRI</nominee1_name><nominee1_dob></nominee1_dob><nominee1_addr1>C-5/5 SCOND FLOOR ARCEE CITY SECTOR 52 GURGAON</nominee1_addr1><nominee1_addr2></nominee1_addr2><nominee1_addr3></nominee1_addr3><nominee1_city>GURGAON</nominee1_city><nominee1_state></nominee1_state><nominee1_pincode></nominee1_pincode><nominee1_relation>SPOUSE</nominee1_relation><nominee1_percent>100</nominee1_percent><nominee1_guard_name></nominee1_guard_name><nominee1_guard_pan></nominee1_guard_pan><nominee2_name></nominee2_name><nominee2_dob></nominee2_dob><nominee2_relation></nominee2_relation><nominee2_percent></nominee2_percent><nominee2_guard_name></nominee2_guard_name><nominee2_guard_pan></nominee2_guard_pan><nominee3_Name></nominee3_Name><nominee3_dob></nominee3_dob><nominee3_relation></nominee3_relation><nominee3_percent></nominee3_percent><nominee3_guard_name></nominee3_guard_name><nominee3_guard_pan></nominee3_guard_pan><sip_paymech></sip_paymech><sip_micr_no></sip_micr_no><sip_bank></sip_bank><sip_branch></sip_branch><sip_instrm_no></sip_instrm_no><sip_acc_no></sip_acc_no><sip_ac_type></sip_ac_type><sip_ifsc_code></sip_ifsc_code><umrn></umrn><ach_amt></ach_amt><ach_fromdate></ach_fromdate><ach_enddate></ach_enddate><until_cancelled></until_cancelled><Return_paymnt_flag>Y</Return_paymnt_flag><Client_callback_url>http://m.investwell.in/hcver3b/pages/netbanking.jsp</Client_callback_url><trans_count>1</trans_count></service_request><childtrans><amc>128</amc><folio></folio><product_code>EFGPGGR</product_code><reinvest>Z</reinvest><amount>1</amount><sip_from_date></sip_from_date><sip_end_date></sip_end_date><sip_freq></sip_freq><sip_amount>1</sip_amount><sip_period_day></sip_period_day></childtrans></NMFIIService></xml>",
requestConfig: {
timeout: 1000, //request timeout in milliseconds
noDelay: true, //Enable/disable the Nagle algorithm
keepAlive: true, //Enable/disable keep-alive functionalityidle socket.
keepAliveDelay: 1000 //and optionally set the initial delay before the first keepalive probe is sent
},
responseConfig: {
timeout: 1000 //response timeout
}
};
client.get("https://www.nsenmf.com/NMFIITrxnService/NMFTrxnService/PURCHASETRXN", args, function (data, response) {
// parsed response body as js object
console.log(data);
// raw response
console.log(response);
});
** И я не получаю ответа от их сайта, какой метод я должен попробовать, пожалуйста, предложить мне И я я получаю ниже ошибки **
<Buffer ef bb bf 3c 3f 78 6d 6c 20 76 65 72 73 69 6f 6e 3d 22 31 2e 30 22 20 65 6e 63 6f 64 69 6e 67 3d 22 75 74 66 2d 38 22 3f 3e 0d 0a 3c 21 44 4f 43 54 59 ... >
IncomingMessage {
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: false,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: false,
domain: null,
_events:
{ end: [ [Function: responseOnEnd], [Function] ],
timeout: [Function],
data: [Function],
error: [Function] },
_eventsCount: 4,
_maxListeners: undefined,
socket:
TLSSocket {
_tlsOptions:
{ pipe: null,
secureContext: [Object],
isServer: false,
requestCert: true,
rejectUnauthorized: true,
session: undefined,
NPNProtocols: undefined,
ALPNProtocols: undefined,
requestOCSP: undefined },
_secureEstablished: true,
_securePending: false,
_newSessionPending: false,
_controlReleased: true,
_SNICallback: null,
servername: null,
npnProtocol: undefined,
alpnProtocol: false,
authorized: true,
authorizationError: null,
encrypted: true,
_events:
{ close: [Object],
end: [Object],
finish: [Function: onSocketFinish],
_socketEnd: [Function: onSocketEnd],
secure: [Function],
free: [Function: onFree],
agentRemove: [Function: onRemove],
drain: [Function: ondrain],
error: [Function: socketErrorListener],
timeout: [Object] },
_eventsCount: 10,
connecting: false,
_hadError: false,
_handle: null,
_parent: null,
_host: 'www.nsenmf.com',
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: [Object],
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: false,
endEmitted: false,
reading: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
defaultEncoding: 'utf8',
ranOut: false,
awaitDrain: 0,
readingMore: true,
decoder: null,
encoding: null },
readable: false,
domain: null,
_maxListeners: undefined,
_writableState:
WritableState {
objectMode: false,
highWaterMark: 16384,
needDrain: false,
ending: true,
ended: true,
finished: true,
decodeStrings: false,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: true,
errorEmitted: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object] },
writable: false,
allowHalfOpen: false,
destroyed: true,
_bytesDispatched: 3021,
_sockname: null,
_pendingData: null,
_pendingEncoding: '',
server: undefined,
_server: null,
ssl: null,
_requestCert: true,
_rejectUnauthorized: true,
parser: null,
_httpMessage:
responseUrl: 'https://www.nsenmf.com',
read: [Function] }
I am not trying other code . Please suggest me right way to achieve it
Сэр, я тоже пробовал этот вариант. Но такая же ошибка возникает –
Не зная больше о службе, которую вы вызываете, трудно узнать, куда вы идете неправильно, кроме того, что вам определенно нужно выполнить POST, а не GET , Вы используете клиент REST для вызова службы SOAP, поэтому, если требуется заголовок SOAPAction, вам нужно добавить это, возможно, внешний тег не требуется, возможно, есть другие заголовки, которые вам нужны. Возможно, неплохо было бы переключить компонент, который вы используете, на SOAP, например [node-soap] (https://github.com/vpulim/node-soap) и перейти оттуда. –