struggleendlessly
@struggleendlessly
.net Senior developer

Как вызвать SOAP сервис не передавая имя метода сервиса, используяю Ruby and SAVON 2?

Если использовать такой код :
client = Savon.client(ssl_verify_mode: :none,
                        proxy: "http://127.0.0.1:8888",
                        endpoint: "https://dev.cleverdome.com/CDSSOService/SSOService.svc/SSO",
                        namespace: "'http://tempuri.org/",

                        env_namespace: :soapenv,    )
  
  client.call(:AuthnRequest,
              soap_action: 'urn:up-us:sso-service:service:v1/ISSOService/GetSSO',
              :attributes => { 'xmlns' => 'xyz' }

  )


то получаю такой XML
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="'http://tempuri.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <wsdl:authnRequest xmlns="xyz" />
   </soapenv:Body>
</soapenv:Envelope>


а мне нужен такой:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <AuthnRequest xmlns="urn:oasis:names:tc:SAML:2.0:protocol" ID="_88ce91a2-1030-4a24-b347-ea522eacc1b8" ForceAuthn="false" IsPassive="false" IssueInstant="2015-04-24T15:25:49.497Z" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP" ProviderName="Betterment" Version="2.0">
         <ns1:Issuer xmlns:ns1="urn:oasis:names:tc:SAML:2.0:assertion" Format="urn:oasis:names:tc:SAML:2.0:nameidformat:transient">Betterment</ns1:Issuer>
         <ns2:Signature xmlns:ns2="http://www.w3.org/2000/09/xmldsig#">
            <ns2:SignedInfo>
               <ns2:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments" />
               <ns2:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
               <ns2:Reference URI="#_88ce91a2-1030-4a24-b347-ea522eacc1b8">
                  <ns2:Transforms>


ТОесть мне в BODY нужно передать сразу определенный объект
  • Вопрос задан
  • 365 просмотров
Решения вопроса 1
struggleendlessly
@struggleendlessly Автор вопроса
.net Senior developer
используем вот такой код;
client = Savon.client(ssl_verify_mode: :none,
                        proxy: "http://127.0.0.1:8888",
                        endpoint: "https://dev.cleverdome.com/CDSSOService/SSOService.svc/SSO",
                        namespace: "'http://tempuri.org/",

                        env_namespace: :soapenv,    )

  client.call(:UserPort,
              soap_action: 'urn:up-us:sso-service:service:v1/ISSOService/GetSSO',
              xml:'<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <AuthnRequest xmlns="urn:oasis:names:tc:SAML:2.0:protocol" ID="_88ce91a2-1030-4a24-b347-ea522eacc1b8" ForceAuthn="false" IsPassive="false" IssueInstant="2015-04-24T15:25:49.497Z" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP" ProviderName="Betterment" Version="2.0">
         <ns1:Issuer xmlns:ns1="urn:oasis:names:tc:SAML:2.0:assertion" Format="urn:oasis:names:tc:SAML:2.0:nameidformat:transient">Betterment</ns1:Issuer>
         <ns2:Signature xmlns:ns2="http://www.w3.org/2000/09/xmldsig#">
            <ns2:SignedInfo>
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы