$oXml = ObjCreate("Chilkat_9_5_0.Xml")
$oXml.Tag = "soapenv:Envelope"
$oXml.AddAttribute("xmlns:soapenv","http://schemas.xmlsoap.org/soap/envelope/")
$oXml.AddAttribute("xmlns:dpd","http://dpdservices.dpd.com.pl/")
$oXml.UpdateChildContent"soapenv:Header",""
$oXml.UpdateChildContent"soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:documentId","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:pickupAddress|dpd:address","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:pickupAddress|dpd:city","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:pickupAddress|dpd:company","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:pickupAddress|dpd:countryCode","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:pickupAddress|dpd:email","string"
$oXml.UpdateChildContentInt"soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:pickupAddress|dpd:fid",1042
$oXml.UpdateChildContent"soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:pickupAddress|dpd:name","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:pickupAddress|dpd:phone","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:pickupAddress|dpd:postalCode","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:policy","STOP_ON_FIRST_ERROR"
$oXml.UpdateChildContentInt"soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:session|dpd:packages|dpd:packageId",123456
$oXml.UpdateChildContentInt"soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:session|dpd:packages|dpd:parcels|dpd:parcelId",123456
$oXml.UpdateChildContent"soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:session|dpd:packages|dpd:parcels|dpd:reference","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:session|dpd:packages|dpd:parcels|dpd:waybill","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:session|dpd:packages|dpd:reference","string"
$oXml.UpdateChildContentInt"soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:session|dpd:sessionId",123456
$oXml.UpdateChildContent"soapenv:Body|dpd:generateSpedLabelsV3|dpd:dpdServicesParamsV1|dpd:session|dpd:sessionType","DOMESTIC"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateSpedLabelsV3|dpd:outputDocFormatV1","PDF"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateSpedLabelsV3|dpd:outputDocPageFormatV1","A4"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateSpedLabelsV3|dpd:outputLabelType","BIC3"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateSpedLabelsV3|dpd:labelVariant","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateSpedLabelsV3|dpd:authDataV1|dpd:login","string"
$oXml.UpdateChildContentInt"soapenv:Body|dpd:generateSpedLabelsV3|dpd:authDataV1|dpd:masterFid",1042
$oXml.UpdateChildContent"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.
$oXml.EmitXmlDecl = FalseLocal $soapRequestBody = $oXml.GetXml()
Local $sEndpoint = "https://dpdservicesdemo.dpd.com.pl/DPDPackageObjServicesService/DPDPackageObjServices"Local $soapAction = ""; For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"Local $sContentType = "text/xml"
$oHttp = ObjCreate("Chilkat_9_5_0.Http")
$oHttp.ClearHeaders
$oHttp.SetRequestHeader"Content-Type",$sContentType
$oHttp.SetRequestHeader"SOAPAction",$soapAction
Local $oResp = $oHttp.PostXml($sEndpoint,$soapRequestBody,"utf-8")
If ($oHttp.LastMethodSuccess = False) Then
ConsoleWrite($oHttp.LastErrorText & @CRLF)
ConsoleWrite("Failed to send SOAP request." & @CRLF)
Exit
EndIf; Get the XML response body.
$oResponseXml = ObjCreate("Chilkat_9_5_0.Xml")
$oResp.GetBodyXml($oResponseXml)
Local $iStatusCode = $oResp.StatusCode
ConsoleWrite("response status code: " & $iStatusCode & @CRLF)
; If the status code does not indicate succcess, then show the response XML,
; which probably contains error information.If ($iStatusCode <> 200) Then
ConsoleWrite($oResponseXml.GetXml() & @CRLF)
Exit
EndIf
ConsoleWrite($oResponseXml.GetXml() & @CRLF)
; 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).Local $sDocumentData = $oResponseXml.GetChildContent("*:Body|*:generateSpedLabelsV3Response|*:return|*:documentData")
Local $sDocumentId = $oResponseXml.GetChildContent("*:Body|*:generateSpedLabelsV3Response|*:return|*:documentId")
Local $iPackageId = $oResponseXml.GetChildIntValue("*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:packages|*:packageId")
Local $iParcelId = $oResponseXml.GetChildIntValue("*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:packages|*:parcels|*:parcelId")
Local $sReference = $oResponseXml.GetChildContent("*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:packages|*:parcels|*:reference")
Local $sDescription = $oResponseXml.GetChildContent("*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:packages|*:parcels|*:statusInfo|*:description")
Local $status = $oResponseXml.GetChildContent("*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:packages|*:parcels|*:statusInfo|*:status")
Local $sWaybill = $oResponseXml.GetChildContent("*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:packages|*:parcels|*:waybill")
$sReference = $oResponseXml.GetChildContent("*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:packages|*:reference")
$sDescription = $oResponseXml.GetChildContent("*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:packages|*:statusInfo|*:description")
$status = $oResponseXml.GetChildContent("*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:packages|*:statusInfo|*:status")
Local $iSessionId = $oResponseXml.GetChildIntValue("*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:sessionId")
$sDescription = $oResponseXml.GetChildContent("*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:statusInfo|*:description")
$status = $oResponseXml.GetChildContent("*:Body|*:generateSpedLabelsV3Response|*:return|*:session|*:statusInfo|*:status")