DataServiceEndpointSoapBinding / decodeVIN
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:intf",L"http://data.webservice.workshop.vivid.nl");
xml.AddAttribute(L"xmlns:soapenv",L"http://schemas.xmlsoap.org/soap/envelope/");
xml.UpdateChildContent(L"soapenv:Header",L"");
xml.UpdateChildContent(L"soapenv:Body|intf:decodeVIN|intf:vrid",L"xml");
xml.UpdateChildContent(L"soapenv:Body|intf:decodeVIN|intf:descriptionLanguage",L"xml");
xml.UpdateChildContent(L"soapenv:Body|intf:decodeVIN|intf:vin",L"xml");
// 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://www.haynespro-services.com/workshopServices3/services/DataServiceEndpoint";
const wchar_t *soapAction = L"";
// 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 *capacity = responseXml.getChildContent(L"*:Body|*:decodeVINResponse|*:decodeVINReturn|*:capacity");
const wchar_t *engineCode = responseXml.getChildContent(L"*:Body|*:decodeVINResponse|*:decodeVINReturn|*:engineCode");
const wchar_t *fuelType = responseXml.getChildContent(L"*:Body|*:decodeVINResponse|*:decodeVINReturn|*:fuelType");
const wchar_t *fullName = responseXml.getChildContent(L"*:Body|*:decodeVINResponse|*:decodeVINReturn|*:fullName");
const wchar_t *id = responseXml.getChildContent(L"*:Body|*:decodeVINResponse|*:decodeVINReturn|*:id");
const wchar_t *level = responseXml.getChildContent(L"*:Body|*:decodeVINResponse|*:decodeVINReturn|*:level");
const wchar_t *madeFrom = responseXml.getChildContent(L"*:Body|*:decodeVINResponse|*:decodeVINReturn|*:madeFrom");
const wchar_t *madeUntil = responseXml.getChildContent(L"*:Body|*:decodeVINResponse|*:decodeVINReturn|*:madeUntil");
const wchar_t *modelPictureMimeDataName = responseXml.getChildContent(L"*:Body|*:decodeVINResponse|*:decodeVINReturn|*:modelPictureMimeDataName");
const wchar_t *name = responseXml.getChildContent(L"*:Body|*:decodeVINResponse|*:decodeVINReturn|*:name");
const wchar_t *order = responseXml.getChildContent(L"*:Body|*:decodeVINResponse|*:decodeVINReturn|*:order");
const wchar_t *output = responseXml.getChildContent(L"*:Body|*:decodeVINResponse|*:decodeVINReturn|*:output");
const wchar_t *remark = responseXml.getChildContent(L"*:Body|*:decodeVINResponse|*:decodeVINReturn|*:remark");
const wchar_t *confirmationLink = responseXml.getChildContent(L"*:Body|*:decodeVINResponse|*:decodeVINReturn|*:status|*:confirmationLink");
const wchar_t *statusCode = responseXml.getChildContent(L"*:Body|*:decodeVINResponse|*:decodeVINReturn|*:status|*:statusCode");
const wchar_t *item = responseXml.getChildContent(L"*:Body|*:decodeVINResponse|*:decodeVINReturn|*:subjects|*:item");
const wchar_t *key = responseXml.getChildContent(L"*:Body|*:decodeVINResponse|*:decodeVINReturn|*:subjectsByGroup|*:mapItems|*:item|*:key");
const wchar_t *value = responseXml.getChildContent(L"*:Body|*:decodeVINResponse|*:decodeVINReturn|*:subjectsByGroup|*:mapItems|*:item|*:value");
const wchar_t *superCarTypeId = responseXml.getChildContent(L"*:Body|*:decodeVINResponse|*:decodeVINReturn|*:superCarTypeId");
}
Request XML
<soapenv:Envelope xmlns:intf="http://data.webservice.workshop.vivid.nl" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<intf:decodeVIN>
<intf:vrid>xml</intf:vrid>
<intf:descriptionLanguage>xml</intf:descriptionLanguage>
<intf:vin>xml</intf:vin>
</intf:decodeVIN>
</soapenv:Body>
</soapenv:Envelope>
Response XML
<soapenv:Envelope xmlns:intf="http://data.webservice.workshop.vivid.nl" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<intf:decodeVINResponse>
<intf:decodeVINReturn>
<intf:capacity>xml</intf:capacity>
<intf:engineCode>xml</intf:engineCode>
<intf:fuelType>xml</intf:fuelType>
<intf:fullName>xml</intf:fullName>
<intf:id>xml</intf:id>
<intf:level>xml</intf:level>
<intf:madeFrom>xml</intf:madeFrom>
<intf:madeUntil>xml</intf:madeUntil>
<intf:modelPictureMimeDataName>xml</intf:modelPictureMimeDataName>
<intf:name>xml</intf:name>
<intf:order>xml</intf:order>
<intf:output>xml</intf:output>
<intf:remark>xml</intf:remark>
<intf:status>
<intf:confirmationLink>xml</intf:confirmationLink>
<intf:statusCode>xml</intf:statusCode>
</intf:status>
<intf:subjects>
<intf:item>xml</intf:item>
</intf:subjects>
<intf:subjectsByGroup>
<intf:mapItems>
<intf:item>
<intf:key>xml</intf:key>
<intf:value>xml</intf:value>
</intf:item>
</intf:mapItems>
</intf:subjectsByGroup>
<intf:superCarTypeId>xml</intf:superCarTypeId>
</intf:decodeVINReturn>
</intf:decodeVINResponse>
</soapenv:Body>
</soapenv:Envelope>