WSDVSPortBinding / validate
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_CkXml.h>
#include <C_CkHttp.h>
#include <C_CkHttpResponse.h>
void ChilkatSample(void)
{
HCkXml xml;
const char *soapRequestBody;
const char *endpoint;
const char *soapAction;
const char *contentType;
HCkHttp http;
HCkHttpResponse resp;
HCkXml responseXml;
int statusCode;
const char *validateResponseOutput_success;
const char *validateResponseOutput_interrupted;
const char *validateResponseOutput_mostSevereErrorLevel;
const char *Result_success;
const char *Result_artifactType;
const char *Result_artifactPath;
const char *Item_errorLevel;
const char *Item_errorID;
const char *Item_errorFieldName;
const char *Item_errorLocation;
const char *Item_errorText;
const char *Item_test;
const char *Exception;
xml = CkXml_Create();
CkXml_putTag(xml,"soapenv:Envelope");
CkXml_AddAttribute(xml,"xmlns:pep","http://peppol.helger.com/ws/documentvalidationservice/201701/");
CkXml_AddAttribute(xml,"xmlns:soapenv","http://schemas.xmlsoap.org/soap/envelope/");
CkXml_UpdateChildContent(xml,"soapenv:Header","");
CkXml_UpdateAttrAt(xml,"soapenv:Body|pep:validateRequestInput",TRUE,"VESID","?");
CkXml_UpdateAttrAt(xml,"soapenv:Body|pep:validateRequestInput",TRUE,"displayLocale","?");
CkXml_UpdateChildContent(xml,"soapenv:Body|pep:validateRequestInput|pep:XML","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.
CkXml_putEmitXmlDecl(xml,FALSE);
soapRequestBody = CkXml_getXml(xml);
endpoint = "https://peppol.helger.com/wsdvs";
soapAction = "validate";
// For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
contentType = "text/xml";
http = CkHttp_Create();
CkHttp_ClearHeaders(http);
CkHttp_SetRequestHeader(http,"Content-Type",contentType);
CkHttp_SetRequestHeader(http,"SOAPAction",soapAction);
resp = CkHttp_PostXml(http,endpoint,soapRequestBody,"utf-8");
if (CkHttp_getLastMethodSuccess(http) == FALSE) {
printf("%s\n",CkHttp_lastErrorText(http));
printf("Failed to send SOAP request.\n");
CkXml_Dispose(xml);
CkHttp_Dispose(http);
return;
}
// Get the XML response body.
responseXml = CkXml_Create();
CkHttpResponse_GetBodyXml(resp,responseXml);
statusCode = CkHttpResponse_getStatusCode(resp);
printf("response status code: %d\n",statusCode);
CkHttpResponse_Dispose(resp);
// If the status code does not indicate succcess, then show the response XML,
// which probably contains error information.
if (statusCode != 200) {
printf("%s\n",CkXml_getXml(responseXml));
CkXml_Dispose(xml);
CkHttp_Dispose(http);
CkXml_Dispose(responseXml);
return;
}
printf("%s\n",CkXml_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).
validateResponseOutput_success = CkXml_chilkatPath(responseXml,"*:Body|*:validateResponseOutput|(success)");
validateResponseOutput_interrupted = CkXml_chilkatPath(responseXml,"*:Body|*:validateResponseOutput|(interrupted)");
validateResponseOutput_mostSevereErrorLevel = CkXml_chilkatPath(responseXml,"*:Body|*:validateResponseOutput|(mostSevereErrorLevel)");
Result_success = CkXml_chilkatPath(responseXml,"*:Body|*:validateResponseOutput|*:Result|(success)");
Result_artifactType = CkXml_chilkatPath(responseXml,"*:Body|*:validateResponseOutput|*:Result|(artifactType)");
Result_artifactPath = CkXml_chilkatPath(responseXml,"*:Body|*:validateResponseOutput|*:Result|(artifactPath)");
Item_errorLevel = CkXml_chilkatPath(responseXml,"*:Body|*:validateResponseOutput|*:Result|*:Item|(errorLevel)");
Item_errorID = CkXml_chilkatPath(responseXml,"*:Body|*:validateResponseOutput|*:Result|*:Item|(errorID)");
Item_errorFieldName = CkXml_chilkatPath(responseXml,"*:Body|*:validateResponseOutput|*:Result|*:Item|(errorFieldName)");
Item_errorLocation = CkXml_chilkatPath(responseXml,"*:Body|*:validateResponseOutput|*:Result|*:Item|(errorLocation)");
Item_errorText = CkXml_chilkatPath(responseXml,"*:Body|*:validateResponseOutput|*:Result|*:Item|(errorText)");
Item_test = CkXml_chilkatPath(responseXml,"*:Body|*:validateResponseOutput|*:Result|*:Item|(test)");
Exception = CkXml_getChildContent(responseXml,"*:Body|*:validateResponseOutput|*:Result|*:Item|*:Exception");
CkXml_Dispose(xml);
CkHttp_Dispose(http);
CkXml_Dispose(responseXml);
}
Request XML
<soapenv:Envelope xmlns:pep="http://peppol.helger.com/ws/documentvalidationservice/201701/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<pep:validateRequestInput VESID="?" displayLocale="?">
<pep:XML>string</pep:XML>
</pep:validateRequestInput>
</soapenv:Body>
</soapenv:Envelope>
Response XML
<soapenv:Envelope xmlns:pep="http://peppol.helger.com/ws/documentvalidationservice/201701/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<pep:validateResponseOutput success="?" interrupted="?" mostSevereErrorLevel="?">
<pep:Result success="?" artifactType="?" artifactPath="?">
<pep:Item errorLevel="?" errorID="?" errorFieldName="?" errorLocation="?" errorText="?" test="?">
<pep:Exception>string</pep:Exception>
</pep:Item>
</pep:Result>
</pep:validateResponseOutput>
</soapenv:Body>
</soapenv:Envelope>