$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:generateProtocolsWithDestinationsV1|dpd:dpdServicesParamsV2|dpd:Policy","STOP_ON_FIRST_ERROR"
$oXml.UpdateChildContentInt"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:dpdServicesParamsV2|dpd:Session|dpd:Packages|dpd:Package|dpd:PackageId",123456
$oXml.UpdateChildContentInt"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:dpdServicesParamsV2|dpd:Session|dpd:Packages|dpd:Package|dpd:Parcels|dpd:Parcel|dpd:ParcelId",123456
$oXml.UpdateChildContent"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:dpdServicesParamsV2|dpd:Session|dpd:Packages|dpd:Package|dpd:Parcels|dpd:Parcel|dpd:Reference","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:dpdServicesParamsV2|dpd:Session|dpd:Packages|dpd:Package|dpd:Parcels|dpd:Parcel|dpd:Waybill","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:dpdServicesParamsV2|dpd:Session|dpd:Packages|dpd:Package|dpd:Reference","string"
$oXml.UpdateChildContentInt"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:dpdServicesParamsV2|dpd:Session|dpd:SessionId",123456
$oXml.UpdateChildContent"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:dpdServicesParamsV2|dpd:PickupAddress|dpd:Address","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:dpdServicesParamsV2|dpd:PickupAddress|dpd:City","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:dpdServicesParamsV2|dpd:PickupAddress|dpd:Company","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:dpdServicesParamsV2|dpd:PickupAddress|dpd:CountryCode","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:dpdServicesParamsV2|dpd:PickupAddress|dpd:Email","string"
$oXml.UpdateChildContentInt"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:dpdServicesParamsV2|dpd:PickupAddress|dpd:Fid",1042
$oXml.UpdateChildContent"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:dpdServicesParamsV2|dpd:PickupAddress|dpd:Name","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:dpdServicesParamsV2|dpd:PickupAddress|dpd:Phone","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:dpdServicesParamsV2|dpd:PickupAddress|dpd:PostalCode","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:dpdServicesParamsV2|dpd:DeliveryDestinations|dpd:DeliveryDestination|dpd:DepotList|dpd:ProtocolDepot|dpd:Number","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:dpdServicesParamsV2|dpd:DeliveryDestinations|dpd:DeliveryDestination|dpd:DestinationName","string"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:dpdServicesParamsV2|dpd:GenProtForNonMatching","true"
$oXml.UpdateChildContent"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:authDataV1|dpd:login","string"
$oXml.UpdateChildContentInt"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|dpd:authDataV1|dpd:masterFid",1042
$oXml.UpdateChildContent"soapenv:Body|dpd:generateProtocolsWithDestinationsV1|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 $sDestinationName = $oResponseXml.GetChildContent("*:Body|*:generateProtocolsWithDestinationsV1Response|*:return|*:DestinationDataList|*:DestinationsData|*:DestinationName")
Local $sDocumentId = $oResponseXml.GetChildContent("*:Body|*:generateProtocolsWithDestinationsV1Response|*:return|*:DestinationDataList|*:DestinationsData|*:DocumentId")
Local $sDomestic = $oResponseXml.GetChildContent("*:Body|*:generateProtocolsWithDestinationsV1Response|*:return|*:DestinationDataList|*:DestinationsData|*:Domestic")
Local $sDocumentData = $oResponseXml.GetChildContent("*:Body|*:generateProtocolsWithDestinationsV1Response|*:return|*:DocumentData")
Local $sWaybill = $oResponseXml.GetChildContent("*:Body|*:generateProtocolsWithDestinationsV1Response|*:return|*:nonMatchingDataList|*:waybill")
Local $iPackageId = $oResponseXml.GetChildIntValue("*:Body|*:generateProtocolsWithDestinationsV1Response|*:return|*:Session|*:Packages|*:Package|*:packageId")
Local $iParcelId = $oResponseXml.GetChildIntValue("*:Body|*:generateProtocolsWithDestinationsV1Response|*:return|*:Session|*:Packages|*:Package|*:parcels|*:parcelId")
Local $sReference = $oResponseXml.GetChildContent("*:Body|*:generateProtocolsWithDestinationsV1Response|*:return|*:Session|*:Packages|*:Package|*:parcels|*:reference")
Local $sDescription = $oResponseXml.GetChildContent("*:Body|*:generateProtocolsWithDestinationsV1Response|*:return|*:Session|*:Packages|*:Package|*:parcels|*:statusInfo|*:Description")
Local $sStatus = $oResponseXml.GetChildContent("*:Body|*:generateProtocolsWithDestinationsV1Response|*:return|*:Session|*:Packages|*:Package|*:parcels|*:statusInfo|*:Status")
$sWaybill = $oResponseXml.GetChildContent("*:Body|*:generateProtocolsWithDestinationsV1Response|*:return|*:Session|*:Packages|*:Package|*:parcels|*:waybill")
$sReference = $oResponseXml.GetChildContent("*:Body|*:generateProtocolsWithDestinationsV1Response|*:return|*:Session|*:Packages|*:Package|*:reference")
$sDescription = $oResponseXml.GetChildContent("*:Body|*:generateProtocolsWithDestinationsV1Response|*:return|*:Session|*:Packages|*:Package|*:statusInfo|*:Description")
$sStatus = $oResponseXml.GetChildContent("*:Body|*:generateProtocolsWithDestinationsV1Response|*:return|*:Session|*:Packages|*:Package|*:statusInfo|*:Status")
Local $iSessionId = $oResponseXml.GetChildIntValue("*:Body|*:generateProtocolsWithDestinationsV1Response|*:return|*:Session|*:SessionId")
$sDescription = $oResponseXml.GetChildContent("*:Body|*:generateProtocolsWithDestinationsV1Response|*:return|*:Session|*:StatusInfo|*:Description")
$sStatus = $oResponseXml.GetChildContent("*:Body|*:generateProtocolsWithDestinationsV1Response|*:return|*:Session|*:StatusInfo|*:Status")