FinaInvoiceB2GBinding / getReceiverListJT
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 *RegistrationName;
const wchar_t *ISOCode;
const wchar_t *CompanyID;
const wchar_t *StreetName;
const wchar_t *BuildingNumber;
const wchar_t *PostalCode;
const wchar_t *CityName;
const wchar_t *Country;
const wchar_t *AddressLine;
const wchar_t *EndpointID;
const wchar_t *EndpointIDSchemeID;
const wchar_t *PartyIdentificationID;
const wchar_t *PartyIdentificationIDSchemeID;
const wchar_t *BusinessBranchName;
const wchar_t *InformationProvider;
int Activity;
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/sync/GetReceiverListJT/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:GetReceiverListMsg|HeaderSupplier|MessageID",L"string");
CkXmlW_UpdateChildContent(xml,L"soapenv:Body|v0:GetReceiverListMsg|HeaderSupplier|SupplierID",L"string");
CkXmlW_UpdateChildContent(xml,L"soapenv:Body|v0:GetReceiverListMsg|HeaderSupplier|AdditionalSupplierID",L"string");
CkXmlW_UpdateChildContentInt(xml,L"soapenv:Body|v0:GetReceiverListMsg|HeaderSupplier|MessageType",123);
CkXmlW_UpdateChildContent(xml,L"soapenv:Body|v0:GetReceiverListMsg|HeaderSupplier|MessageAttributes",L"string");
CkXmlW_UpdateChildContent(xml,L"soapenv:Body|v0:GetReceiverListMsg|v0:Data|v0:ReceiverList|Filter",L"");
// 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/GetReceiverListJT";
// 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|*:GetReceiverListAckMsg|MessageAck|MessageID");
MessageAckID = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|MessageAck|MessageAckID");
MessageType = CkXmlW_GetChildIntValue(responseXml,L"*:Body|*:GetReceiverListAckMsg|MessageAck|MessageType");
AckStatus = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|MessageAck|AckStatus");
AckStatusCode = CkXmlW_GetChildIntValue(responseXml,L"*:Body|*:GetReceiverListAckMsg|MessageAck|AckStatusCode");
AckStatusText = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|MessageAck|AckStatusText");
RegistrationName = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|*:RegistrationName");
ISOCode = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|*:ISOCode");
CompanyID = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|*:CompanyID");
StreetName = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|PostalAddress|StreetName");
BuildingNumber = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|PostalAddress|BuildingNumber");
PostalCode = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|PostalAddress|PostalCode");
CityName = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|PostalAddress|CityName");
Country = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|PostalAddress|Country");
AddressLine = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|PostalAddress|AddressLine");
EndpointID = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|*:BusinessBranch|*:EndpointID");
EndpointIDSchemeID = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|*:BusinessBranch|*:EndpointIDSchemeID");
PartyIdentificationID = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|*:BusinessBranch|*:PartyIdentificationID");
PartyIdentificationIDSchemeID = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|*:BusinessBranch|*:PartyIdentificationIDSchemeID");
BusinessBranchName = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|*:BusinessBranch|*:BusinessBranchName");
InformationProvider = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|*:BusinessBranch|*:InformationProvider");
StreetName = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|*:BusinessBranch|PostalAddress|StreetName");
BuildingNumber = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|*:BusinessBranch|PostalAddress|BuildingNumber");
PostalCode = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|*:BusinessBranch|PostalAddress|PostalCode");
CityName = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|*:BusinessBranch|PostalAddress|CityName");
Country = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|*:BusinessBranch|PostalAddress|Country");
AddressLine = CkXmlW_getChildContent(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|*:BusinessBranch|PostalAddress|AddressLine");
Activity = CkXmlW_GetChildIntValue(responseXml,L"*:Body|*:GetReceiverListAckMsg|*:ReceiverList|*:Receiver|*:BusinessBranch|*:Activity");
CkXmlW_Dispose(xml);
CkHttpW_Dispose(http);
CkXmlW_Dispose(responseXml);
}