인증을 통해 Ruby on Rails에서 웹 서비스를 사용해야합니다. 성공적인 통신은 :Ruby on Rails에서 웹 서비스를 사용하면서 XML 태그 및 인증을 변경하는 방법은 무엇입니까?
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pag="https://pagosinteligentes.com/">
<soapenv:Header>
<pag:Autenticacion>
<!--Optional:-->
<pag:User>aUser</pag:User>
<!--Optional:-->
<pag:Password>aPassword</pag:Password>
</pag:Autenticacion>
</soapenv:Header>
<soapenv:Body>
<pag:UserCheck>
<!--Optional:-->
<pag:account>anAccount</pag:account>
<!--Optional:-->
<pag:user>aUser</pag:user>
</pag:UserCheck>
</soapenv:Body>
</soapenv:Envelope>
는 사용자 계정과 함께 (스페인 Autenticacion) 인증 헤더와 본체를 갖는다. 내가 가진 :
WSDL_URL = 'https://dev.pagosinteligentes.com/webservices/AMS/MovementsCardSWV1.asmx?WSDL'
realm = Base64.strict_encode64("aUser:aPassword")
client = Savon.client(wsdl: WSDL_URL,
soap_header: { 'Autenticacion:' => "BasiC#{realm}"},
log: true, # set true to switch on logging
log_level: :debug,
pretty_print_xml: true)
response = client.call(:user_check, message: {"account" => "anAccount", "user" => "aUser"})
print response
내 출력은 다음과 같습니다
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="https://pagosinteligentes.com/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header>
<Autenticacion:>Basic V1NQcnVlYmE6MTIzNDU2</Autenticacion:>
</env:Header>
<env:Body>
<tns:UserCheck>
<tns:account>anAccount</tns:account>
<tns:user>aUser</tns:user>
</tns:UserCheck>
</env:Body>
</env:Envelope>
가 어떻게 <soapenv:
에 대한 <env:
태그를 변경하고 <pag:
에 대한 <tns:
수 있습니까?
DO가 여전히 인증이 코드로 제대로 작동하지 않는 태그를 변경하더라도 :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pag="https://pagosinteligentes.com/">
<soapenv:Header>
<Autenticacion:>Basic V1NQcnVlYmE6MTIzNDU2</Autenticacion:>
</soapenv:Header>
<soapenv:Body>
<pag:UserCheck>
<!--Optional:-->
<pag:account>anAccount</pag:account>
<!--Optional:-->
<pag:user>aUser</pag:user>
</pag:UserCheck>
</soapenv:Body>
</soapenv:Envelope>
가 SoapUI 나쁜 요청을 제공합니다. 이러한 태그의 차이점은 무엇입니까? 미리 감사드립니다.
답변 해 주셔서 감사합니다. 실제로 태그는 중요하지 않습니다. 해결책은 토큰을 제거하고 다음과 같이 헤더를 작성하는 것입니다. soap_header : { 'pag : Autenticacion'=> { 'pag : User'=> 'aUser', 'pag : Password'=> 'aPass'}} , 그리고 오프 코스 시도 SoapUI –