2017-11-15 7 views
1

노드 js에서 SOAP 요청을 호출하기 위해 node-soap 라이브러리를 사용하고 있습니다. I은 인수를 작성한 이것node-soap을 사용하여 soap 요청에 중복 된 이름 공간이 생성되었습니다.

<soapenv:Envelope > 
    <soapenv:Header/> 
    <soapenv:Body> 
     <typ:uploadFileToUcm> 
     <typ:document> 
      <erp:Content></erp:Content> 
      <erp:FileName>?</erp:FileName> 
      <!--Optional:--> 
      <erp:ContentType>?</erp:ContentType> 
      <!--Optional:--> 
      <erp:DocumentTitle>?</erp:DocumentTitle> 
      <!--Optional:--> 
      <erp:DocumentAuthor>?</erp:DocumentAuthor> 
      <!--Optional:--> 
      <erp:DocumentSecurityGroup>?</erp:DocumentSecurityGroup> 
      <!--Optional:--> 
      <erp:DocumentAccount>?</erp:DocumentAccount> 
      <!--Optional:--> 
      <erp:DocumentName>?</erp:DocumentName> 
      <!--Optional:--> 
      <erp:DocumentId>?</erp:DocumentId> 
     </typ:document> 
     </typ:uploadFileToUcm> 
    </soapenv:Body> 
</soapenv:Envelope> 

:

var args = { 
    document : { 
    Content: byteArray, //create byte array to assign content 
    FileName: 'Abc12341', 
    ContentType: 'zip', 
    DocumentTitle: 'Abc12341', 
    DocumentAuthor: 'Abc12341', 
    DocumentSecurityGroup: 'abc', 
    DocumentAccount: 'c/c/c', 
    DocumentName: 'Abc12341' 
    //DocumentId : //no data available in java file 
    } 
} 

하고 전달하기 :

client.method(args, function (err, result) { 

}); 

하지만 client.lastrequest 인쇄에 요청 페이로드 포맷은 다음있다

페이로드에 중복 된 네임 스페이스가 있습니다 :

<soap:Body> 
<types:uploadFileToUcm 
    xmlns:types="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/" 
    xmlns="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/types/"> 
    <types:document> 
     <ns0:Content xmlns:ns0="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/">UEsDBBQAAAAIAAuEaEue7VBfgQAAAGoBAAAcAAAASW52VHJhbnNhY3Rpb25zSW50ZXJmYWNlLmNzdvPMK0vNK8kvqlTwL0pXCA021AEBIBlgYGBsYGQK5ASXJnnmlcGkMICljmsikDIyMDTXNzTUNzBWMDCwAiMdHd/M4uTUnJzEvNT80mKFoNTk1MyCEuzG6OhYgAhfN3cdI3NLc2MDQ0MdY1MDIwMzM0McNiMBYx0jhLZBB1z9XHi5AFBLAQIUABQAAAAIAAuEaEue7VBfgQAAAGoBAAAcAAAAAAAAAAEAIAAAAAAAAABJbnZUcmFuc2FjdGlvbnNJbnRlcmZhY2UuY3N2UEsFBgAAAAABAAEASgAAALsAAAAAAA==</ns0:Content> 
     <ns0:FileName 
      xmlns:ns0="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/" 
      xmlns:ns0="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/">Abc12341</ns0:FileName> 
     <ns0:ContentType 
      xmlns:ns0="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/" 
      xmlns:ns0="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/">zip</ns0:ContentType> 
     <ns0:DocumentTitle 
      xmlns:ns0="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/" 
      xmlns:ns0="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/">Abc12341</ns0:DocumentTitle> 
     <ns0:DocumentAuthor 
      xmlns:ns0="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/" 
      xmlns:ns0="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/">Abc12341</ns0:DocumentAuthor> 
     <ns0:DocumentSecurityGroup 
      xmlns:ns0="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/" 
      xmlns:ns0="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/">FAFusionImportExport</ns0:DocumentSecurityGroup> 
     <ns0:DocumentAccount 
      xmlns:ns0="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/" 
      xmlns:ns0="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/">scm/inventoryTransaction/import</ns0:DocumentAccount> 
     <ns0:DocumentName 
      xmlns:ns0="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/" 
      xmlns:ns0="http://xmlns.oracle.com/apps/financials/commonModules/shared/model/erpIntegrationService/">Abc12341</ns0:DocumentName> 
    </types:document> 
    </types:uploadFileToUcm> 
</soap:Body> 

여기서 ns0은 모든 매개 변수에서 반복됩니다.

문제는 내가 args를 전달하는 방식 일 수 있습니다.

이 문제를 해결하는 방법은 무엇입니까?

답변

0

나는 node-soap과 동일한 문제가있어서 다른 노드 라이브러리를 사용했으며 완벽하게 작동합니다. 노드 비누를 기반으로 한 강력한 비누를 사용해보십시오. 그러나 분명히 완전히 다시 작성되었으며 많은 기여자가 동일합니다 : https://github.com/strongloop/strong-soap. 아래 그림과 같이

npm install strong-soap 

코드

는 오라클 ERP 통합의 SOAP API의 호출 (importBulkData을 uploadFileToUcm 등) 허가를 제외하고 기본적으로 동일하다.

var soap = require('strong-soap').soap; 

var data = {}; 
//code to build base64 zip file goes here 

var url = 'https://<host>/publicFinancialCommonErpIntegration/ErpIntegrationService?WSDL'; 
var args = { 
    "document": { 
     "Content": data, 
     "FileName": "glBudgetData.zip", 
     "ContentType": "zip", 
     "DocumentTitle": "glBudgetData.zip", 
     "DocumentAuthor": "casey.brown", 
     "DocumentSecurityGroup": "FAFusionImportExport", 
     "DocumentAccount": "fin$/budgetBalance$/import$", 
     "DocumentName": "UCM91004" 
    } 
}; 

var options = {}; 

soap.createClient(url, options, function(err, client) { 
    client.setSecurity(new soap.BasicAuthSecurity('casey.brown', '<your password here>')); 
    client.uploadFileToUcm(args, function(err, result) { 
     console.log(result); 
}); 

커맨드 라인에서 실행하고 출력한다 {결과 '2047316'} 임포트 파일 (들)의 UCM 문서 ID이다.

행운을 빈다.

+0

이 질문에 대한 답변을 제공하지 않습니다. 충분한 [평판] (https://stackoverflow.com/help/whats-reputation)이 있으면 [모든 게시물에 주석 달기] (https://stackoverflow.com/help/privileges/comment) 할 수 있습니다. 대신, [질문자의 설명이 필요없는 답변을 제공하십시오] (https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can- i-do- 대신). - [리뷰에서] (리뷰/저품절 포스트/18505097) – ndmeiri

+0

이것은 실제로 질문에 대답하지 않습니다. 다른 질문이있는 경우 [질문하기] (https://stackoverflow.com/questions/ask)를 클릭하여 질문 할 수 있습니다. [평판] (https://stackoverflow.com/help/privileges/set-bounties)을 충분히 확보하면 [현상금 추가] (https://stackoverflow.com/help/privileges/set-bounties)를 통해이 질문에 더 집중할 수 있습니다. 평판). - [검토 중] (리뷰/저품절 게시물/18505097) – Michal

+0

죄송합니다. 위의 수정 사항을 충분히 답변 해 주시기 바랍니다. –