LOCAL loXml
LOCAL lcSoapRequestBody
LOCAL lcEndpoint
LOCAL lcSoapAction
LOCAL lcContentType
LOCAL loHttp
LOCAL loResp
LOCAL loResponseXml
LOCAL lnStatusCode
LOCAL lcEnvelope_xmlns
LOCAL lcMessageID
LOCAL lcMessageAckID
LOCAL lnMessageType
LOCAL lcAckStatus
LOCAL lnAckStatusCode
LOCAL lcAckStatusText
LOCAL lcErrorCode
LOCAL lcErrorMessage
LOCAL lcErrorText
loXml = CreateObject('Chilkat_9_5_0.Xml')
loXml.Tag = "soapenv:Envelope"
loXml.AddAttribute("xmlns:soapenv","http://schemas.xmlsoap.org/soap/envelope/")
loXml.AddAttribute("xmlns","http://fina.hr/eracun/b2g/invoicewebservicecomponents/v0.1")
loXml.AddAttribute("xmlns:v0","http://fina.hr/eracun/b2g/ChangeB2GIncomingInvoiceStatus/v0.1")
loXml.AddAttribute("xmlns:b2gEracImpl","http://fina.hr/eracun/b2g/ws/erp/v0.1")
loXml.UpdateChildContent("soapenv:Header","")
loXml.UpdateChildContent("soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|HeaderBuyer|MessageID","string")
loXml.UpdateChildContent("soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|HeaderBuyer|BuyerID","string")
loXml.UpdateChildContent("soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|HeaderBuyer|AdditionalBuyerID","string")
loXml.UpdateChildContentInt("soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|HeaderBuyer|MessageType",123)
loXml.UpdateChildContent("soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|HeaderBuyer|MessageAttributes","string")
loXml.UpdateChildContentInt("soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|v0:Data|v0:B2GIncomingInvoiceStatus|v0:InvoiceID",123)
loXml.UpdateChildContent("soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|v0:Data|v0:B2GIncomingInvoiceStatus|InvoiceStatus|StatusCode","RECEIVED")
loXml.UpdateChildContentInt("soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|v0:Data|v0:B2GIncomingInvoiceStatus|InvoiceStatus|CodeReason",1042)
loXml.UpdateChildContent("soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|v0:Data|v0:B2GIncomingInvoiceStatus|InvoiceStatus|Note","string")
loXml.UpdateChildContent("soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|v0:Data|v0:B2GIncomingInvoiceStatus|InvoiceStatus|PartialAmount","99.0")
loXml.UpdateChildContent("soapenv:Body|v0:ChangeB2GIncomingInvoiceStatusMsg|v0:Data|v0:B2GIncomingInvoiceStatus|InvoiceStatus|DocumentCurrencyCode","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://prez.fina.hr/B2GFinaInvoiceWebService/services/B2GFinaInvoiceWebService"
lcSoapAction = "http://fina.hr/eracun/b2g/ChangeB2GIncomingInvoiceStatus"* 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).
lcEnvelope_xmlns = loResponseXml.GetAttrValue("xmlns")
lcMessageID = loResponseXml.GetChildContent("*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|MessageAck|MessageID")
lcMessageAckID = loResponseXml.GetChildContent("*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|MessageAck|MessageAckID")
lnMessageType = loResponseXml.GetChildIntValue("*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|MessageAck|MessageType")
lcAckStatus = loResponseXml.GetChildContent("*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|MessageAck|AckStatus")
lnAckStatusCode = loResponseXml.GetChildIntValue("*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|MessageAck|AckStatusCode")
lcAckStatusText = loResponseXml.GetChildContent("*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|MessageAck|AckStatusText")
lcErrorCode = loResponseXml.GetChildContent("*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|Error|ErrorCode")
lcErrorMessage = loResponseXml.GetChildContent("*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|Error|ErrorMessage")
lcErrorText = loResponseXml.GetChildContent("*:Body|*:ChangeB2GIncomingInvoiceStatusAckMsg|Error|ErrorText")
RELEASE loXml
RELEASE loHttp
RELEASE loResponseXml