LOCAL loXml
LOCAL lcSoapRequestBody
LOCAL lcEndpoint
LOCAL lcSoapAction
LOCAL lcContentType
LOCAL loHttp
LOCAL loResp
LOCAL loResponseXml
LOCAL lnStatusCode
LOCAL lcFieldName
LOCAL lcInfo
LOCAL lcStatus
LOCAL lnParcelId
LOCAL lcReference
LOCAL lcWaybill
loXml = CreateObject('Chilkat_9_5_0.Xml')
loXml.Tag = "soapenv:Envelope"
loXml.AddAttribute("xmlns:soapenv","http://schemas.xmlsoap.org/soap/envelope/")
loXml.AddAttribute("xmlns:dpd","http://dpdservices.dpd.com.pl/")
loXml.UpdateChildContent("soapenv:Header","")
loXml.UpdateChildContentInt("soapenv:Body|dpd:appendParcelsToPackageV1|dpd:parcelsAppend|dpd:packagesearchCriteria|dpd:packageId",123456)
loXml.UpdateChildContent("soapenv:Body|dpd:appendParcelsToPackageV1|dpd:parcelsAppend|dpd:packagesearchCriteria|dpd:reference","string")
loXml.UpdateChildContent("soapenv:Body|dpd:appendParcelsToPackageV1|dpd:parcelsAppend|dpd:packagesearchCriteria|dpd:waybill","string")
loXml.UpdateChildContent("soapenv:Body|dpd:appendParcelsToPackageV1|dpd:parcelsAppend|dpd:parcels|dpd:content","string")
loXml.UpdateChildContent("soapenv:Body|dpd:appendParcelsToPackageV1|dpd:parcelsAppend|dpd:parcels|dpd:customerData1","string")
loXml.UpdateChildContent("soapenv:Body|dpd:appendParcelsToPackageV1|dpd:parcelsAppend|dpd:parcels|dpd:customerData2","string")
loXml.UpdateChildContent("soapenv:Body|dpd:appendParcelsToPackageV1|dpd:parcelsAppend|dpd:parcels|dpd:customerData3","string")
loXml.UpdateChildContent("soapenv:Body|dpd:appendParcelsToPackageV1|dpd:parcelsAppend|dpd:parcels|dpd:reference","string")
loXml.UpdateChildContentInt("soapenv:Body|dpd:appendParcelsToPackageV1|dpd:parcelsAppend|dpd:parcels|dpd:sizeX",1042)
loXml.UpdateChildContentInt("soapenv:Body|dpd:appendParcelsToPackageV1|dpd:parcelsAppend|dpd:parcels|dpd:sizeY",1042)
loXml.UpdateChildContentInt("soapenv:Body|dpd:appendParcelsToPackageV1|dpd:parcelsAppend|dpd:parcels|dpd:sizeZ",1042)
loXml.UpdateChildContent("soapenv:Body|dpd:appendParcelsToPackageV1|dpd:parcelsAppend|dpd:parcels|dpd:weight","string")
loXml.UpdateChildContent("soapenv:Body|dpd:appendParcelsToPackageV1|dpd:authDataV1|dpd:login","string")
loXml.UpdateChildContentInt("soapenv:Body|dpd:appendParcelsToPackageV1|dpd:authDataV1|dpd:masterFid",1042)
loXml.UpdateChildContent("soapenv:Body|dpd:appendParcelsToPackageV1|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.
loXml.EmitXmlDecl = 0
lcSoapRequestBody = loXml.GetXml()
lcEndpoint = "https://dpdservicesdemo.dpd.com.pl/DPDPackageObjServicesService/DPDPackageObjServices"
lcSoapAction = ""* For SOAP requests, the standard Content-Type is usually set to "text/xml" or "application/soap+xml"
lcContentType = "text/xml"
loHttp = CreateObject('Chilkat_9_5_0.Http')
loHttp.ClearHeaders()
loHttp.SetRequestHeader("Content-Type",lcContentType)
loHttp.SetRequestHeader("SOAPAction",lcSoapAction)
loResp = loHttp.PostXml(lcEndpoint,lcSoapRequestBody,"utf-8")
IF (loHttp.LastMethodSuccess = 0) THEN
? loHttp.LastErrorText
? "Failed to send SOAP request."RELEASE loXml
RELEASE loHttp
CANCELENDIF* Get the XML response body.
loResponseXml = CreateObject('Chilkat_9_5_0.Xml')
loResp.GetBodyXml(loResponseXml)
lnStatusCode = loResp.StatusCode
? "response status code: " + STR(lnStatusCode)
RELEASE loResp
* If the status code does not indicate succcess, then show the response XML,
* which probably contains error information.IF (lnStatusCode <> 200) THEN
? loResponseXml.GetXml()
RELEASE loXml
RELEASE loHttp
RELEASE loResponseXml
CANCELENDIF
? loResponseXml.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).
lcFieldName = loResponseXml.GetChildContent("*:Body|*:appendParcelsToPackageV1Response|*:return|*:invalidFields|*:fieldName")
lcInfo = loResponseXml.GetChildContent("*:Body|*:appendParcelsToPackageV1Response|*:return|*:invalidFields|*:info")
lcStatus = loResponseXml.GetChildContent("*:Body|*:appendParcelsToPackageV1Response|*:return|*:invalidFields|*:status")
lnParcelId = loResponseXml.GetChildIntValue("*:Body|*:appendParcelsToPackageV1Response|*:return|*:parcels|*:parcelId")
lcReference = loResponseXml.GetChildContent("*:Body|*:appendParcelsToPackageV1Response|*:return|*:parcels|*:reference")
lcStatus = loResponseXml.GetChildContent("*:Body|*:appendParcelsToPackageV1Response|*:return|*:parcels|*:status")
lcWaybill = loResponseXml.GetChildContent("*:Body|*:appendParcelsToPackageV1Response|*:return|*:parcels|*:waybill")
lcStatus = loResponseXml.GetChildContent("*:Body|*:appendParcelsToPackageV1Response|*:return|*:status")
RELEASE loXml
RELEASE loHttp
RELEASE loResponseXml