SOAP WSDL Generate Code

FinaInvoiceB2GBinding / changeB2GIncomingInvoiceStatus

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 <C_CkXmlW.h>
#include <C_CkHttpW.h>
#include <C_CkHttpResponseW.h>

void ChilkatSample(void)
    {
    HCkXmlW xml;
    const wchar_t *soapRequestBody;
    const wchar_t *endpoint;
    const wchar_t *soapAction;
    const wchar_t *contentType;
    HCkHttpW http;
    HCkHttpResponseW resp;
    HCkXmlW responseXml;
    int statusCode;
    const wchar_t *Envelope_xmlns;
    const wchar_t *MessageID;
    const wchar_t *MessageAckID;
    int MessageType;
    const wchar_t *AckStatus;
    int AckStatusCode;
    const wchar_t *AckStatusText;
    const wchar_t *ErrorCode;
    const wchar_t *ErrorMessage;
    const wchar_t *ErrorText;

    xml = CkXmlW_Create();
    CkXmlW_putTag(xml,L"soapenv:Envelope");
    CkXmlW_AddAttribute(xml,L"xmlns:soapenv",L"http://schemas.xmlsoap.org/soap/envelope/");
    CkXmlW_AddAttribute(xml,L"xmlns",L"http://fina.hr/eracun/b2g/invoicewebservicecomponents/v0.1");
    CkXmlW_AddAttribute(xml,L"xmlns:v0",L"http://fina.hr/eracun/b2g/ChangeB2GIncomingInvoiceStatus/v0.1");
    CkXmlW_AddAttribute(xml,L"xmlns:b2gEracImpl",L"http://fina.hr/eracun/b2g/ws/erp/v0.1");
    CkXmlW_UpdateChildContent(xml,L"soapenv:Header",L"");
    CkXmlW_UpdateChildContent(xml,L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|HeaderBuyer|MessageID",L"string");
    CkXmlW_UpdateChildContent(xml,L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|HeaderBuyer|BuyerID",L"string");
    CkXmlW_UpdateChildContent(xml,L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|HeaderBuyer|AdditionalBuyerID",L"string");
    CkXmlW_UpdateChildContentInt(xml,L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|HeaderBuyer|MessageType",123);
    CkXmlW_UpdateChildContent(xml,L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|HeaderBuyer|MessageAttributes",L"string");
    CkXmlW_UpdateChildContentInt(xml,L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|v0:Data|v0:B2GIncomingInvoiceStatus|v0:InvoiceID",123);
    CkXmlW_UpdateChildContent(xml,L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|v0:Data|v0:B2GIncomingInvoiceStatus|InvoiceStatus|StatusCode",L"RECEIVED");
    CkXmlW_UpdateChildContentInt(xml,L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|v0:Data|v0:B2GIncomingInvoiceStatus|InvoiceStatus|CodeReason",1042);
    CkXmlW_UpdateChildContent(xml,L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|v0:Data|v0:B2GIncomingInvoiceStatus|InvoiceStatus|Note",L"string");
    CkXmlW_UpdateChildContent(xml,L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|v0:Data|v0:B2GIncomingInvoiceStatus|InvoiceStatus|PartialAmount",L"99.0");
    CkXmlW_UpdateChildContent(xml,L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|v0:Data|v0:B2GIncomingInvoiceStatus|InvoiceStatus|DocumentCurrencyCode",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. 
    CkXmlW_putEmitXmlDecl(xml,FALSE);
    soapRequestBody = CkXmlW_getXml(xml);

    endpoint = L"https://prez.fina.hr/B2GFinaInvoiceWebService/services/B2GFinaInvoiceWebService";
    soapAction = L"http://fina.hr/eracun/b2g/ChangeB2GIncomingInvoiceStatus";
    //  For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
    contentType = L"text/xml";

    http = CkHttpW_Create();

    CkHttpW_ClearHeaders(http);
    CkHttpW_SetRequestHeader(http,L"Content-Type",contentType);
    CkHttpW_SetRequestHeader(http,L"SOAPAction",soapAction);

    resp = CkHttpW_PostXml(http,endpoint,soapRequestBody,L"utf-8");
    if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        wprintf(L"Failed to send SOAP request.\n");
        CkXmlW_Dispose(xml);
        CkHttpW_Dispose(http);
        return;
    }

    // Get the XML response body.
    responseXml = CkXmlW_Create();
    CkHttpResponseW_GetBodyXml(resp,responseXml);

    statusCode = CkHttpResponseW_getStatusCode(resp);
    wprintf(L"response status code: %d\n",statusCode);

    CkHttpResponseW_Dispose(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",CkXmlW_getXml(responseXml));
        CkXmlW_Dispose(xml);
        CkHttpW_Dispose(http);
        CkXmlW_Dispose(responseXml);
        return;
    }

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

    // 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).

    Envelope_xmlns = CkXmlW_getAttrValue(responseXml,L"xmlns");
    MessageID = CkXmlW_getChildContent(responseXml,L"*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|MessageAck|MessageID");
    MessageAckID = CkXmlW_getChildContent(responseXml,L"*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|MessageAck|MessageAckID");
    MessageType = CkXmlW_GetChildIntValue(responseXml,L"*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|MessageAck|MessageType");
    AckStatus = CkXmlW_getChildContent(responseXml,L"*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|MessageAck|AckStatus");
    AckStatusCode = CkXmlW_GetChildIntValue(responseXml,L"*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|MessageAck|AckStatusCode");
    AckStatusText = CkXmlW_getChildContent(responseXml,L"*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|MessageAck|AckStatusText");
    ErrorCode = CkXmlW_getChildContent(responseXml,L"*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|Error|ErrorCode");
    ErrorMessage = CkXmlW_getChildContent(responseXml,L"*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|Error|ErrorMessage");
    ErrorText = CkXmlW_getChildContent(responseXml,L"*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|Error|ErrorText");


    CkXmlW_Dispose(xml);
    CkHttpW_Dispose(http);
    CkXmlW_Dispose(responseXml);

    }
Request XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://fina.hr/eracun/b2g/invoicewebservicecomponents/v0.1" xmlns:v0="http://fina.hr/eracun/b2g/ChangeB2GIncomingInvoiceStatus/v0.1" xmlns:b2gEracImpl="http://fina.hr/eracun/b2g/ws/erp/v0.1">
    <soapenv:Header/>
    <soapenv:Body>
        <v0:ChangeB2GIncomingInvoiceStatusMsg>
            <HeaderBuyer>
                <MessageID>string</MessageID>
                <BuyerID>string</BuyerID>
                <AdditionalBuyerID>string</AdditionalBuyerID>
                <MessageType>123</MessageType>
                <MessageAttributes>string</MessageAttributes>
            </HeaderBuyer>
            <v0:Data>
                <v0:B2GIncomingInvoiceStatus>
                    <v0:InvoiceID>123</v0:InvoiceID>
                    <InvoiceStatus>
                        <StatusCode>RECEIVED</StatusCode>
                        <CodeReason>1042</CodeReason>
                        <Note>string</Note>
                        <PartialAmount>99.0</PartialAmount>
                        <DocumentCurrencyCode>string</DocumentCurrencyCode>
                    </InvoiceStatus>
                </v0:B2GIncomingInvoiceStatus>
            </v0:Data>
        </v0:ChangeB2GIncomingInvoiceStatusMsg>
    </soapenv:Body>
</soapenv:Envelope>
Response XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://fina.hr/eracun/b2g/invoicewebservicecomponents/v0.1" xmlns:v0="http://fina.hr/eracun/b2g/ChangeB2GIncomingInvoiceStatus/v0.1" xmlns:b2gEracImpl="http://fina.hr/eracun/b2g/ws/erp/v0.1">
    <soapenv:Header/>
    <soapenv:Body>
        <v0:ChangeB2GIncomingInvoiceStatusAckMsg>
            <MessageAck>
                <MessageID>string</MessageID>
                <MessageAckID>string</MessageAckID>
                <MessageType>123</MessageType>
                <AckStatus>ACCEPTED</AckStatus>
                <AckStatusCode>1042</AckStatusCode>
                <AckStatusText>string</AckStatusText>
            </MessageAck>
            <Error>
                <ErrorCode>string</ErrorCode>
                <ErrorMessage>string</ErrorMessage>
                <ErrorText>string</ErrorText>
            </Error>
        </v0:ChangeB2GIncomingInvoiceStatusAckMsg>
    </soapenv:Body>
</soapenv:Envelope>