Nodejs:npm SOAP:body中的意外标记,args

时间:2015-08-24 23:27:11

标签: node.js git soap wsdl soap-client

“已解决”:BUG IN GITHUB PACKAGE

我使用了node-soap git的read-me,但是我遇到了一个意想不到的问题:请参阅下面的'RequestContext'标签。

var args = {ReadEnterpriseByPhoneme: {"Phoneme":"a", "TypeOfEnterprise": "EPP", "ActiveFilter":"true"}};
var url = 'http://kbopub-acc.economie.fgov.be/kbopubws030000/services/wsKBOPub?wsdl';
soap.createClient(url,function(err, client){
  client.setSecurity(new soap.WSSecurity('USERNAME', 'PASSWORD', 'PasswordDigest'));
  client.addSoapHeader({'Id': 'c1576d0a-e762-40fe-abf9-ec3f2102650b', 'Language': 'nl'});
  console.log('LOG:');
  console.log(client.describe().WSKBOPubService.WSKBOPub.ReadEnterpriseByPhoneme);
  client.WSKBOPubService.WSKBOPub.ReadEnterpriseByPhoneme(args, function(err, response){
    if(err){
        console.log('SOAP ERROR!');
        //console.log(err);
    }else{
        console.log('SOAP SUCCESS!');
        console.log(response);
    }
  });
});

使用控制台响应(手动标记意外标记):

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:tns="http://economie.fgov.be/kbopub/webservices/v1" xmlns:messages="http://economie.fgov.be/kbopub/webservices/v1/messages">
  <soap:Header>
    <Id>c1576d0a-e762-40fe-abf9-ec3f2102650b</Id>
    <Language>nl</Language>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
      <wsu:Timestamp wsu:Id="Timestamp-2015-08-24T22:45:18Z">
        <wsu:Created>2015-08-24T22:45:18Z</wsu:Created>
        <wsu:Expires>2015-08-24T22:55:18Z</wsu:Expires>
      </wsu:Timestamp>
      <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="SecurityToken-2015-08-24T22:45:18Z">
        <wsse:Username>USERNAME</wsse:Username>
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">PASSWOPAPASSWORD</wsse:Password>
        <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">y5aP7wCA16hcLuV0N2Weepumaqw=</wsse:Nonce>
        <wsu:Created>2015-08-24T22:45:18Z</wsu:Created>
      </wsse:UsernameToken>
    </wsse:Security>
  </soap:Header>
  <soap:Body>
    **<messages:RequestContext xmlns:messages="http://economie.fgov.be/kbopub/webservices/v1/messages" xmlns="http://economie.fgov.be/kbopub/webservices/v1/messages">**
      <messages:ReadEnterpriseByPhoneme>
        <messages:Phoneme>a</messages:Phoneme>
        <messages:TypeOfEnterprise>EPP</messages:TypeOfEnterprise>
        <messages:ActiveFilter>true</messages:ActiveFilter>
      </messages:ReadEnterpriseByPhoneme>
    **</messages:RequestContext>**
  </soap:Body>
</soap:Envelope>

有没有人知道这些出现的原因以及如何避免这些?

1 个答案:

答案 0 :(得分:0)

你确定这是一个问题吗?也许这个节点是根据wsdl生成的?我无法确定,你提供的wsdl地址无效。