SOAP WSDL Generate Code

WSMovilDGIISoap12 / GetPlaca

ASP AutoIt C C (Unicode) C++ C++ (Unicode) C# DataFlex Delphi Foxpro Go Java Node.js Objective-C Perl PHP Extension PowerBuilder Powershell PureBasic Python CkPython Ruby SQL Server Swift TCL VB.NET VB6 VBScript Xojo
#include <CkXmlW.h>
#include <CkHttpW.h>
#include <CkHttpResponseW.h>

void ChilkatSample(void)
    {
    CkXmlW xml;
    xml.put_Tag(L"soap:Envelope");
    xml.AddAttribute(L"xmlns:soap",L"http://www.w3.org/2003/05/soap-envelope");
    xml.AddAttribute(L"xmlns:dgi",L"http://dgii.gov.do/");
    xml.UpdateChildContent(L"soap:Header",L"");
    xml.UpdateChildContent(L"soap:Body|dgi:GetPlaca|dgi:RNC",L"string");
    xml.UpdateChildContent(L"soap:Body|dgi:GetPlaca|dgi:Placa",L"string");
    xml.UpdateChildContent(L"soap:Body|dgi:GetPlaca|dgi:IMEI",L"string");

    // In a SOAP HTTP request, including the XML declaration (<?xml version="1.0" encoding="UTF-8"?>) in the XML body is generally not required. 
    xml.put_EmitXmlDecl(false);
    const wchar_t *soapRequestBody = xml.getXml();

    const wchar_t *endpoint = L"http://dgii.gov.do/wsMovilDGII/WSMovilDGII.asmx";
    const wchar_t *soapAction = L"http://dgii.gov.do/GetPlaca";
    //  For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
    const wchar_t *contentType = L"text/xml";

    CkHttpW http;

    http.ClearHeaders();
    http.SetRequestHeader(L"Content-Type",contentType);
    http.SetRequestHeader(L"SOAPAction",soapAction);

    CkHttpResponseW *resp = http.PostXml(endpoint,soapRequestBody,L"utf-8");
    if (http.get_LastMethodSuccess() == false) {
        wprintf(L"%s\n",http.lastErrorText());
        wprintf(L"Failed to send SOAP request.\n");
        return;
    }

    // Get the XML response body.
    CkXmlW responseXml;
    resp->GetBodyXml(responseXml);

    int statusCode = resp->get_StatusCode();
    wprintf(L"response status code: %d\n",statusCode);

    delete resp;

    // If the status code does not indicate succcess, then show the response XML,
    // which probably contains error information.
    if (statusCode != 200) {
        wprintf(L"%s\n",responseXml.getXml());
        return;
    }

    wprintf(L"%s\n",responseXml.getXml());

    // Parse the successful SOAP response XML.

    // This is a sample of the response XML, but the namespace prefixes will be different.
    // We can parse the result using "*" for the namespace prefixes (see below).

    const wchar_t *MARCA_VEHICULO = responseXml.getChildContent(L"*:Body|*:GetPlacaResponse|*:GetPlacaResult|*:placa|*:MARCA_VEHICULO");
    const wchar_t *MODELO_VEHICULO = responseXml.getChildContent(L"*:Body|*:GetPlacaResponse|*:GetPlacaResult|*:placa|*:MODELO_VEHICULO");
    const wchar_t *COLOR = responseXml.getChildContent(L"*:Body|*:GetPlacaResponse|*:GetPlacaResult|*:placa|*:COLOR");
    const wchar_t *ANO_FABRICACION = responseXml.getChildContent(L"*:Body|*:GetPlacaResponse|*:GetPlacaResult|*:placa|*:ANO_FABRICACION");
    const wchar_t *PLACA = responseXml.getChildContent(L"*:Body|*:GetPlacaResponse|*:GetPlacaResult|*:placa|*:PLACA");
    const wchar_t *ESTADO = responseXml.getChildContent(L"*:Body|*:GetPlacaResponse|*:GetPlacaResult|*:placa|*:ESTADO");
    const wchar_t *RNC_CEDULA_PROPIETARIO = responseXml.getChildContent(L"*:Body|*:GetPlacaResponse|*:GetPlacaResult|*:placa|*:RNC_CEDULA_PROPIETARIO");
    int NUMERO_OPOSICION = responseXml.GetChildIntValue(L"*:Body|*:GetPlacaResponse|*:GetPlacaResult|*:oposiciones|*:OposicionModel|*:NUMERO_OPOSICION");
    const wchar_t *TIPO_OPOSICION = responseXml.getChildContent(L"*:Body|*:GetPlacaResponse|*:GetPlacaResult|*:oposiciones|*:OposicionModel|*:TIPO_OPOSICION");
    }
Request XML
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:dgi="http://dgii.gov.do/">
    <soap:Header/>
    <soap:Body>
        <dgi:GetPlaca>
            <dgi:RNC>string</dgi:RNC>
            <dgi:Placa>string</dgi:Placa>
            <dgi:IMEI>string</dgi:IMEI>
        </dgi:GetPlaca>
    </soap:Body>
</soap:Envelope>
Response XML
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:dgi="http://dgii.gov.do/">
    <soap:Header/>
    <soap:Body>
        <dgi:GetPlacaResponse>
            <dgi:GetPlacaResult>
                <dgi:placa>
                    <dgi:MARCA_VEHICULO>string</dgi:MARCA_VEHICULO>
                    <dgi:MODELO_VEHICULO>string</dgi:MODELO_VEHICULO>
                    <dgi:COLOR>string</dgi:COLOR>
                    <dgi:ANO_FABRICACION>string</dgi:ANO_FABRICACION>
                    <dgi:PLACA>string</dgi:PLACA>
                    <dgi:ESTADO>string</dgi:ESTADO>
                    <dgi:RNC_CEDULA_PROPIETARIO>string</dgi:RNC_CEDULA_PROPIETARIO>
                </dgi:placa>
                <dgi:oposiciones>
                    <dgi:OposicionModel>
                        <dgi:NUMERO_OPOSICION>123456</dgi:NUMERO_OPOSICION>
                        <dgi:TIPO_OPOSICION>string</dgi:TIPO_OPOSICION>
                    </dgi:OposicionModel>
                </dgi:oposiciones>
            </dgi:GetPlacaResult>
        </dgi:GetPlacaResponse>
    </soap:Body>
</soap:Envelope>