SOAP WSDL Generate Code

DPDPackageObjServicesServiceSoapBinding / generateSpedLabelsV3

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
var
xml: HCkXml;
soapRequestBody: PWideChar;
endpoint: PWideChar;
soapAction: PWideChar;
contentType: PWideChar;
http: HCkHttp;
resp: HCkHttpResponse;
responseXml: HCkXml;
statusCode: Integer;
documentData: PWideChar;
documentId: PWideChar;
packageId: Integer;
parcelId: Integer;
reference: PWideChar;
description: PWideChar;
status: PWideChar;
waybill: PWideChar;
sessionId: Integer;

begin
xml := CkXml_Create();
CkXml_putTag(xml,'soapenv:Envelope');
CkXml_AddAttribute(xml,'xmlns:soapenv','http://schemas.xmlsoap.org/soap/envelope/');
CkXml_AddAttribute(xml,'xmlns:dpd','http://dpdservices.dpd.com.pl/');
CkXml_UpdateChildContent(xml,'soapenv:Header','');
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:documentId','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:pickupAddress|dpd:address','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:pickupAddress|dpd:city','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:pickupAddress|dpd:company','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:pickupAddress|dpd:countryCode','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:pickupAddress|dpd:email','string');
CkXml_UpdateChildContentInt(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:pickupAddress|dpd:fid',1042);
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:pickupAddress|dpd:name','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:pickupAddress|dpd:phone','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:pickupAddress|dpd:postalCode','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:policy','STOP_ON_FIRST_ERROR');
CkXml_UpdateChildContentInt(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:session|dpd:packages|dpd:packageId',123456);
CkXml_UpdateChildContentInt(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:session|dpd:packages|dpd:parcels|dpd:parcelId',123456);
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:session|dpd:packages|dpd:parcels|dpd:reference','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:session|dpd:packages|dpd:parcels|dpd:waybill','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:session|dpd:packages|dpd:reference','string');
CkXml_UpdateChildContentInt(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:session|dpd:sessionId',123456);
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:session|dpd:sessionType','DOMESTIC');
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:outputDocFormatV1','PDF');
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:outputDocPageFormatV1','A4');
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:outputLabelType','BIC3');
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:labelVariant','string');
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:authDataV1|dpd:login','string');
CkXml_UpdateChildContentInt(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:authDataV1|dpd:masterFid',1042);
CkXml_UpdateChildContent(xml,'soapenv:Body|dpd:generateSpedLabelsV3|dpd:authDataV1|dpd:password','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://dpdservicesdemo.dpd.com.pl/DPDPackageObjServicesService/DPDPackageObjServices';
soapAction := '';
//  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) then
  begin
    Memo1.Lines.Add(CkHttp__lastErrorText(http));
    Memo1.Lines.Add('Failed to send SOAP request.');
    Exit;
  end;

// Get the XML response body.
responseXml := CkXml_Create();
CkHttpResponse_GetBodyXml(resp,responseXml);

statusCode := CkHttpResponse_getStatusCode(resp);
Memo1.Lines.Add('response status code: ' + IntToStr(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) then
  begin
    Memo1.Lines.Add(CkXml__getXml(responseXml));
    Exit;
  end;

Memo1.Lines.Add(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).

documentData := CkXml__getChildContent(responseXml,'*:Body|*:generateSpedLabelsV3Response|*:return|*:documentData');
documentId := CkXml__getChildContent(responseXml,'*:Body|*:generateSpedLabelsV3Response|*:return|*:documentId');
packageId := CkXml_GetChildIntValue(responseXml,'*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:packages|*:packageId');
parcelId := CkXml_GetChildIntValue(responseXml,'*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:packages|*:parcels|*:parcelId');
reference := CkXml__getChildContent(responseXml,'*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:packages|*:parcels|*:reference');
description := CkXml__getChildContent(responseXml,'*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:packages|*:parcels|*:statusInfo|*:description');
status := CkXml__getChildContent(responseXml,'*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:packages|*:parcels|*:statusInfo|*:status');
waybill := CkXml__getChildContent(responseXml,'*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:packages|*:parcels|*:waybill');
reference := CkXml__getChildContent(responseXml,'*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:packages|*:reference');
description := CkXml__getChildContent(responseXml,'*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:packages|*:statusInfo|*:description');
status := CkXml__getChildContent(responseXml,'*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:packages|*:statusInfo|*:status');
sessionId := CkXml_GetChildIntValue(responseXml,'*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:sessionId');
description := CkXml__getChildContent(responseXml,'*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:statusInfo|*:description');
status := CkXml__getChildContent(responseXml,'*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:statusInfo|*:status');

CkXml_Dispose(xml);
CkHttp_Dispose(http);
CkXml_Dispose(responseXml);

Request XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dpd="http://dpdservices.dpd.com.pl/">
    <soapenv:Header/>
    <soapenv:Body>
        <dpd:generateSpedLabelsV3>
            <dpd:dpdServicesParamsV1>
                <dpd:documentId>string</dpd:documentId>
                <dpd:pickupAddress>
                    <dpd:address>string</dpd:address>
                    <dpd:city>string</dpd:city>
                    <dpd:company>string</dpd:company>
                    <dpd:countryCode>string</dpd:countryCode>
                    <dpd:email>string</dpd:email>
                    <dpd:fid>1042</dpd:fid>
                    <dpd:name>string</dpd:name>
                    <dpd:phone>string</dpd:phone>
                    <dpd:postalCode>string</dpd:postalCode>
                </dpd:pickupAddress>
                <dpd:policy>STOP_ON_FIRST_ERROR</dpd:policy>
                <dpd:session>
                    <dpd:packages>
                        <dpd:packageId>123456</dpd:packageId>
                        <dpd:parcels>
                            <dpd:parcelId>123456</dpd:parcelId>
                            <dpd:reference>string</dpd:reference>
                            <dpd:waybill>string</dpd:waybill>
                        </dpd:parcels>
                        <dpd:reference>string</dpd:reference>
                    </dpd:packages>
                    <dpd:sessionId>123456</dpd:sessionId>
                    <dpd:sessionType>DOMESTIC</dpd:sessionType>
                </dpd:session>
            </dpd:dpdServicesParamsV1>
            <dpd:outputDocFormatV1>PDF</dpd:outputDocFormatV1>
            <dpd:outputDocPageFormatV1>A4</dpd:outputDocPageFormatV1>
            <dpd:outputLabelType>BIC3</dpd:outputLabelType>
            <dpd:labelVariant>string</dpd:labelVariant>
            <dpd:authDataV1>
                <dpd:login>string</dpd:login>
                <dpd:masterFid>1042</dpd:masterFid>
                <dpd:password>string</dpd:password>
            </dpd:authDataV1>
        </dpd:generateSpedLabelsV3>
    </soapenv:Body>
</soapenv:Envelope>
Response XML
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dpd="http://dpdservices.dpd.com.pl/">
    <soapenv:Header/>
    <soapenv:Body>
        <dpd:generateSpedLabelsV3Response>
            <dpd:return>
                <dpd:documentData>BqozVXeZZg==</dpd:documentData>
                <dpd:documentId>string</dpd:documentId>
                <dpd:session>
                    <dpd:packages>
                        <dpd:packageId>123456</dpd:packageId>
                        <dpd:parcels>
                            <dpd:parcelId>123456</dpd:parcelId>
                            <dpd:reference>string</dpd:reference>
                            <dpd:statusInfo>
                                <dpd:description>string</dpd:description>
                                <dpd:status>OK</dpd:status>
                            </dpd:statusInfo>
                            <dpd:waybill>string</dpd:waybill>
                        </dpd:parcels>
                        <dpd:reference>string</dpd:reference>
                        <dpd:statusInfo>
                            <dpd:description>string</dpd:description>
                            <dpd:status>OK</dpd:status>
                        </dpd:statusInfo>
                    </dpd:packages>
                    <dpd:sessionId>123456</dpd:sessionId>
                    <dpd:statusInfo>
                        <dpd:description>string</dpd:description>
                        <dpd:status>OK</dpd:status>
                    </dpd:statusInfo>
                </dpd:session>
            </dpd:return>
        </dpd:generateSpedLabelsV3Response>
    </soapenv:Body>
</soapenv:Envelope>