2012-10-20 3 views
2

통화에 대해 netsuite API를 쿼리하려고합니다. SOAP UI 클라이언트에서 다음 SOAP 요청이 작동합니다. 그러나 나는 루비의 savon gem version 0.9.7에서 같은 작업을하려고 힘들게 노력하고있다.savon soap 속성

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:messages_2012_2.platform.webservices.netsuite.com" xmlns:urn1="urn:core_2012_2.platform.webservices.netsuite.com"> 
    <soapenv:Header> 
     <urn:passport> 
     <urn1:email>[email protected]</urn1:email> 
     <urn1:password>xxx</urn1:password> 
     <urn1:account>xxx</urn1:account> 
     </urn:passport> 
    </soapenv:Header> 
    <soapenv:Body> 
     <urn:getAll> 
     <urn:record recordType="currency"/> 
     </urn:getAll> 
    </soapenv:Body> 
</soapenv:Envelope> 

기본적으로 나는 urn : record 요소에 속성을 설정할 수 없습니다. 다음 작동하지 않습니다.

response = client.request :urn, :get_all do 
    soap.body = { "urn:record" => { :attributes! => { "recordType" => "currency" } } } 
end 

알려주세요.

답변

2

http://savonrb.com에 설명 된대로 attributes! 해시의 키가 XML 태그와 일치해야합니다. 다음과 같이 작성 하시겠습니까?

 
response = client.request :urn, :get_all do 
    soap.body = {'urn:record'=>'', 
       :attributes!=>{'urn:record'=>{'recordType'=>'currency'}} 
       } 
end 

이 방법으로 문제가 해결되는지 알려주세요. 당신이 배치 할 수 있습니다 savon의 새로운 versioin에서

+1

감사합니다. Steffen, 앞으로 얻은 것 같습니다. 하지만 지금은 "enap :"대신 Header 및 Body 태그의 접두사로 "soapenv :"가 필요하다고 생각하기 때문에 실패합니다. 그 접두어를 어떻게 사용하는지 알고 있습니까? –

+0

그것의'soap.env_namespace = "soapenv"'하지만 그것은 비누 헤더를 보내지 않는 것으로 도움이되지 못했습니다. –

+0

마지막으로'soap.header = passport_header' 설정으로 작업했습니다. { ': 여권 항아리'=> { '항아리 : 이메일'=> NETSUITE_EMAIL, '항아리 : 비밀번호'=> NETSUITE_PWD, '항아리 : 계정'=> NETSUITE_ACCT } 은} passport_header은 어디 –

1

원시 비누 요청을 다시 확인하십시오. : get_all은 savon이 당신을 문자 그대로 받아들이게하려면 "getAll"이어야합니다; 그것은 변경 될 수 있습니다 GetAll

+0

기본값은 Savon이': get_all'을'getAll'로 변환한다는 것입니다. http://savonrb.com의 문서를 참조하십시오. –

0

가 : 동작 태그의 로컬 컨텍스트 속성 :이 경우

@interaction_client.call(:retrieve_interaction, message: message_hash, :attributes => { 'attachmentInfo' => include_attachments.to_s }) 

attachmentInfo 속성에, 작업과 연결된 주요 작업 태그에 배치됩니다 이 예는 ns:RetrieveInteractionRequest 태그입니다.

느낌표는 구문에 포함되어 있지 않으므로 유의하십시오.