A
A
Alexander Dubina2015-04-27 13:03:09
Ruby on Rails
Alexander Dubina, 2015-04-27 13:03:09

How to call SOAP service without passing service method name using Ruby and SAVON 2?

If you use this code:

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' }

  )

then I get this 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>

and I need this one:
<?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>

That is, I need to transfer a certain object to BODY at once

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Dubina, 2015-04-27
@struggleendlessly

we use the following code;

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>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question