SOAP, SSL, Signature

SOAP is an acronym for Simple Object Access Protocol. SOAP is an application of the XML specification

MESSAGE:

  • Envelope

  • Header

  • Body

  • Fault

Envelope − Defines the start and the end of the message.

It is a mandatory element.



POST /wssw/EXXM.axmx HTTP/1.1
Host: sws.fd.com.ua
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://my.example.com.ua/webservices/ExecOperation"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"                 
               xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  ...
  Message information goes here
  ...
</soap:Envelope>

Header − Contains any optional attributes of the message used in processing the message, either at an intermediary point or at the ultimate end-point. It is an optional element.



POST /wssw/EXXM.axmx HTTP/1.1
Host: sws.fd.com.ua
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://my.example.com.ua/webservices/HelloWorldResponse"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"                 
               xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header xmlns="http://my.example.com.ua/webservices/">
    <Transaction>
      Some info
    </Transaction>
  </soap:Header>
  ...
</soap:Envelope>

The SOAP body is a mandatory element that contains the application-defined XML data being exchanged in the SOAP message.



POST /wssw/EXXM.axmx HTTP/1.1
Host: sws.fd.com.ua
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://my.example.com.ua/webservices/HelloWorldResponse"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"                 
               xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  ...
  <soap:Body>
    <HelloWorldResponse xmlns="http://my.example.com.ua/webservices/">
      <HelloWorldResult>string</HelloWorldResult>
    </HelloWorldResponse>
  </soap:Body>
  ...
</soap:Envelope>

If an error occurs during processing, the response to a SOAP message is a SOAP fault element in the body of the message, and the fault is returned to the sender of the SOAP message.



POST /wssw/EXXM.axmx HTTP/1.1
Host: sws.fd.com.ua
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://my.example.com.ua/webservices/HelloWorldResponse"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"                 
               xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  ...
  <soap:Fault>
    <faultcode xsi:type="xsd:string">soap:Client</faultcode>
    <faultstring xsi:type="xsd:string">
      Failed to locate method (ValidateCreditCard) in class (examplesCreditCard) at 
      /usr/local/ActivePerl-5.6/lib/site_perl/5.6.0/SOAP/Lite.pm line 1555.
    </faultstring>
  </soap:Fault>
  ...
</soap:Envelope>
  • Nokogiri
  • Savon
  • gem 'signer'

Signature

SSL

Thanks

SOAP, HTTPS

By dima_chornenky

SOAP, HTTPS

  • 294