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 <CkXmlW.h>
#include <CkHttpW.h>
#include <CkHttpResponseW.h>

void ChilkatSample(void)
    {
    CkXmlW xml;
    xml.put_Tag(L"soapenv:Envelope");
    xml.AddAttribute(L"xmlns:soapenv",L"http://schemas.xmlsoap.org/soap/envelope/");
    xml.AddAttribute(L"xmlns",L"http://fina.hr/eracun/b2g/invoicewebservicecomponents/v0.1");
    xml.AddAttribute(L"xmlns:v0",L"http://fina.hr/eracun/b2g/ChangeB2GIncomingInvoiceStatus/v0.1");
    xml.AddAttribute(L"xmlns:b2gEracImpl",L"http://fina.hr/eracun/b2g/ws/erp/v0.1");
    xml.UpdateChildContent(L"soapenv:Header",L"");
    xml.UpdateChildContent(L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|HeaderBuyer|MessageID",L"string");
    xml.UpdateChildContent(L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|HeaderBuyer|BuyerID",L"string");
    xml.UpdateChildContent(L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|HeaderBuyer|AdditionalBuyerID",L"string");
    xml.UpdateChildContentInt(L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|HeaderBuyer|MessageType",123);
    xml.UpdateChildContent(L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|HeaderBuyer|MessageAttributes",L"string");
    xml.UpdateChildContentInt(L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|v0:Data|v0:B2GIncomingInvoiceStatus|v0:InvoiceID",123);
    xml.UpdateChildContent(L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|v0:Data|v0:B2GIncomingInvoiceStatus|InvoiceStatus|StatusCode",L"RECEIVED");
    xml.UpdateChildContentInt(L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|v0:Data|v0:B2GIncomingInvoiceStatus|InvoiceStatus|CodeReason",1042);
    xml.UpdateChildContent(L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|v0:Data|v0:B2GIncomingInvoiceStatus|InvoiceStatus|Note",L"string");
    xml.UpdateChildContent(L"soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|v0:Data|v0:B2GIncomingInvoiceStatus|InvoiceStatus|PartialAmount",L"99.0");
    xml.UpdateChildContent(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. 
    xml.put_EmitXmlDecl(false);
    const wchar_t *soapRequestBody = xml.getXml();

    const wchar_t *endpoint = L"https://prez.fina.hr/B2GFinaInvoiceWebService/services/B2GFinaInvoiceWebService";
    const wchar_t *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"
    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 *Envelope_xmlns = responseXml.getAttrValue(L"xmlns");
    const wchar_t *MessageID = responseXml.getChildContent(L"*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|MessageAck|MessageID");
    const wchar_t *MessageAckID = responseXml.getChildContent(L"*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|MessageAck|MessageAckID");
    int MessageType = responseXml.GetChildIntValue(L"*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|MessageAck|MessageType");
    const wchar_t *AckStatus = responseXml.getChildContent(L"*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|MessageAck|AckStatus");
    int AckStatusCode = responseXml.GetChildIntValue(L"*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|MessageAck|AckStatusCode");
    const wchar_t *AckStatusText = responseXml.getChildContent(L"*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|MessageAck|AckStatusText");
    const wchar_t *ErrorCode = responseXml.getChildContent(L"*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|Error|ErrorCode");
    const wchar_t *ErrorMessage = responseXml.getChildContent(L"*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|Error|ErrorMessage");
    const wchar_t *ErrorText = responseXml.getChildContent(L"*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|Error|ErrorText");
    }
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>