Giter Site home page Giter Site logo

ballerina-soap-module's Introduction

SOAP Connector

The SOAP connector allows you to send an ordinary XML request to a SOAP backend by specifying the necessary details to construct a SOAP envelope. It abstracts out the details of the creation of a SOAP envelope, headers, and the body in a SOAP message.

Compatibility

Versions
Ballerina Language Swan Lake Alpha1
SOAP Version 1.1 & 1.2

Getting Started

Refer the Getting Started guide to download and install Ballerina.

Usage Example

import ballerina/io;
import bash/soap;
  
public function main () {

    soap:Soap12Client soapClient = new("http://ws.cdyne.com/phoneverify/phoneverify.asmx?wsdl");

    xml body = xml `<quer:CheckPhoneNumber xmlns:quer="http://ws.cdyne.com/PhoneVerify/query"> 
         <quer:PhoneNumber>18006785432</quer:PhoneNumber>
         <quer:LicenseKey>0</quer:LicenseKey>
      </quer:CheckPhoneNumber>`;

    var response = soapClient->sendReceive(body);
    if (response is soap:SoapResponse) {
        io:println(response["payload"]);
    } else {
        io:println(response.message());
    }
}

Follow the steps below to run this example.

  1. Save the example in a Ballerina file (e.g., soapExample.bal).
  2. Execute the ballerina run soapExample.bal command to run the file. You will get a response similar to the following.
<?xml version="1.0" encoding="UTF-8"?>
<soap:Body xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
   <CheckPhoneNumberResponse xmlns="http://ws.cdyne.com/PhoneVerify/query">
      <CheckPhoneNumberResult>
         <Company>Toll Free</Company>
         <Valid>true</Valid>
         <Use>Assigned to a code holder for normal use.</Use>
         <State>TF</State>
         <RC />
         <OCN />
         <OriginalNumber>18006785432</OriginalNumber>
         <CleanNumber>8006785432</CleanNumber>
         <SwitchName />
         <SwitchType />
         <Country>United States</Country>
         <CLLI />
         <PrefixType>Landline</PrefixType>
         <LATA />
         <sms>Landline</sms>
         <Email />
         <AssignDate>Unknown</AssignDate>
         <TelecomCity />
         <TelecomCounty />
         <TelecomState>TF</TelecomState>
         <TelecomZip />
         <TimeZone />
         <Lat />
         <Long />
         <Wireless>false</Wireless>
         <LRN />
      </CheckPhoneNumberResult>
   </CheckPhoneNumberResponse>
</soap:Body>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.