BPost SOAP Call Address Validation

bcengiz
Member Posts: 8
Hi
I'm trying to connect a soap webservice api to validate addresses.
Therefore the Belgian mail delivery company BPost has a free webservice platform to use it.
In the SOAPUI , I could connect and try some requests and got some response. Unfortunately, I have some XML HTTP Status = 500 error when I try to connect in NAV C/AL.
via this website, you can find the documentation of this free webservice "https://www.bpost.be/site/en/webservice-address
Is there someone who can give me some advise? Maybe I'm looking over an connection issue?
New Codeunit Validate Addresses
OnRun()
FillXMLDoc()
ReadChildNodes()
SetAddress()
SOAPUI Settings, connections and properties.




I'm trying to connect a soap webservice api to validate addresses.
Therefore the Belgian mail delivery company BPost has a free webservice platform to use it.
In the SOAPUI , I could connect and try some requests and got some response. Unfortunately, I have some XML HTTP Status = 500 error when I try to connect in NAV C/AL.
via this website, you can find the documentation of this free webservice "https://www.bpost.be/site/en/webservice-address
Is there someone who can give me some advise? Maybe I'm looking over an connection issue?
New Codeunit Validate Addresses
OnRun()
CLEAR(AutXmlDoc); CLEAR(AutXmlHttp); IF ISCLEAR(AutXmlDoc) THEN CREATE(AutXmlDoc,FALSE,TRUE); IF ISCLEAR(AutXmlHttp) THEN CREATE(AutXmlHttp,FALSE,TRUE); AutXmlHttp.open('POST','https://webservices-pub.bpost.be/ws/ExternalMailingAddressProofingCS_v1',FALSE); AutXmlHttp.setRequestHeader('Content-Type','text/xml; charset=utf-8'); AutXmlHttp.setRequestHeader('SOAPAction', 'http://schema.bpost.be/services/common/address/ExternalMailingAddressProofingCS/V001/validateAddress'); AutXmlHttp.setRequestHeader('Operation','validateAddresses'); AutXmlHttp.setRequestHeader('Style','Document'); AutXmlHttp.setRequestHeader('Endpoint','https://webservices-pub.bpost.be/ws/ExternalMailingAddressProofingCS_v1'); FillXMLDoc(); AutXmlHttp.send(AurXmlText.nodeValue); MESSAGE(FORMAT(AutXmlHttp.status)); IF AutXmlHttp.status = 200 THEN BEGIN AutXmlDoc.load(AutXmlHttp.responseXML); AutXmlNodeList := AutXmlDoc.childNodes; FOR i := 0 TO AutXmlNodeList.length - 1 DO BEGIN AutXmlNode := AutXmlNodeList.item(i); ReadChildNodes(AutXmlNode); END;
FillXMLDoc()
AurXmlText := AutXmlDoc.createTextNode(''); AurXmlText.appendData('<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" '); AurXmlText.appendData('xmlns:v001="http://schema.bpost.be/services/common/address/ExternalMailingAddressProofingCSMessages/v001">'); AurXmlText.appendData('<soapenv:Header/>'); AurXmlText.appendData('<soapenv:Body>'); AurXmlText.appendData('<v001:ValidateAddressesRequest>'); AurXmlText.appendData('<v001:AddressToValidateList>'); AurXmlText.appendData('<v001:AddressToValidate id="1">'); AurXmlText.appendData('<v001:MaileeAndAddressee>'); AurXmlText.appendData('<v001:AddresseeIndividualIdentification>'); AurXmlText.appendData('<v001:StructuredAddresseeIndividualIdentification>'); AurXmlText.appendData('</v001:StructuredAddresseeIndividualIdentification>'); AurXmlText.appendData('</v001:AddresseeIndividualIdentification>'); AurXmlText.appendData('<v001:MaileeIndividualIdentification>'); AurXmlText.appendData('<v001:StructuredMaileeIndividualIdentification>'); AurXmlText.appendData('<v001:MaileeRole></v001:MaileeRole>'); AurXmlText.appendData('</v001:StructuredMaileeIndividualIdentification>'); AurXmlText.appendData('</v001:MaileeIndividualIdentification>'); AurXmlText.appendData('<v001:MaileeOrganizationIdentification>'); AurXmlText.appendData('<v001:StructuredMaileeOrganizationIdentification>'); AurXmlText.appendData('</v001:StructuredMaileeOrganizationIdentification>'); AurXmlText.appendData('</v001:MaileeOrganizationIdentification>'); AurXmlText.appendData('<v001:MailRecipientDispatchingInformation>'); AurXmlText.appendData('<v001:StructuredMailRecipientDispatchingInformation>'); AurXmlText.appendData('<v001:Wing>'); AurXmlText.appendData('</v001:Wing>'); AurXmlText.appendData('<v001:Stairwell>'); AurXmlText.appendData('</v001:Stairwell>'); AurXmlText.appendData('<v001:Floor>'); AurXmlText.appendData('</v001:Floor>'); AurXmlText.appendData('<v001:Door>'); AurXmlText.appendData('</v001:Door>'); AurXmlText.appendData('</v001:StructuredMailRecipientDispatchingInformation>'); AurXmlText.appendData('</v001:MailRecipientDispatchingInformation>'); AurXmlText.appendData('</v001:MaileeAndAddressee>'); AurXmlText.appendData('<v001:PostalAddress>'); AurXmlText.appendData('<v001:OtherDeliveryInformation>'); AurXmlText.appendData('<v001:StructuredOtherDeliveryInformation>'); AurXmlText.appendData('</v001:StructuredOtherDeliveryInformation>'); AurXmlText.appendData('</v001:OtherDeliveryInformation>'); AurXmlText.appendData('<v001:DeliveryPointLocation>'); AurXmlText.appendData('<v001:StructuredDeliveryPointLocation>'); AurXmlText.appendData('<v001:StreetName>'+FORMAT(StreetNameG) +'</v001:StreetName>'); AurXmlText.appendData('<v001:StreetNumber>'+FORMAT(StreetNoG)+'</v001:StreetNumber>'); AurXmlText.appendData('<v001:BoxNumber></v001:BoxNumber>'); AurXmlText.appendData('</v001:StructuredDeliveryPointLocation>'); AurXmlText.appendData('</v001:DeliveryPointLocation>'); AurXmlText.appendData('<v001:PostalCodeMunicipality>'); AurXmlText.appendData('<v001:StructuredPostalCodeMunicipality>'); AurXmlText.appendData('<v001:PostalCode>'+FORMAT(PostalCodeG)+'</v001:PostalCode>'); AurXmlText.appendData('<v001:MunicipalityName>'+FORMAT(CityG)+'</v001:MunicipalityName>'); AurXmlText.appendData('</v001:StructuredPostalCodeMunicipality>'); AurXmlText.appendData('</v001:PostalCodeMunicipality>'); AurXmlText.appendData('</v001:PostalAddress>'); AurXmlText.appendData('<v001:DispatchingCountryISOCode>BE</v001:DispatchingCountryISOCode>'); AurXmlText.appendData('<v001:DeliveringCountryISOCode>BE</v001:DeliveringCountryISOCode>'); AurXmlText.appendData('</v001:AddressToValidate>'); AurXmlText.appendData('</v001:AddressToValidateList>'); AurXmlText.appendData('<v001:ValidateAddressOptions>'); AurXmlText.appendData('<v001:IncludeFormatting>true</v001:IncludeFormatting>'); AurXmlText.appendData('<v001:IncludeSuggestions>true</v001:IncludeSuggestions>'); AurXmlText.appendData('<v001:IncludeSubmittedAddress>true</v001:IncludeSubmittedAddress>'); AurXmlText.appendData('</v001:ValidateAddressOptions>'); AurXmlText.appendData('<v001:CallerIdentification>'); AurXmlText.appendData('<v001:CallerName>customername</v001:CallerName>'); AurXmlText.appendData('</v001:CallerIdentification>'); AurXmlText.appendData('</v001:ValidateAddressesRequest>'); AurXmlText.appendData('</soapenv:Body>'); AurXmlText.appendData('</soapenv:Envelope>');
ReadChildNodes()
CASE FORMAT(CurrentXMLNodeP.nodeType) OF '1': // Element BEGIN // Global variable CurrentElementName to keep track of what node // we are currently processing CurrentElementNameG := CurrentXMLNodeP.nodeName; // Process Attributes // If the element has attributes, then browse through those. TempXMLAttributeListL := CurrentXMLNodeP.attributes; FOR k := 0 TO TempXMLAttributeListL.length - 1 DO ReadChildNodes(TempXMLAttributeListL.item(k)); // Process Child nodes TempXMLNodeListL := CurrentXMLNodeP.childNodes; FOR j := 0 TO TempXMLNodeListL.length - 1 DO ReadChildNodes(TempXMLNodeListL.item(j)); END; '2': // Attribute BEGIN MESSAGE(CurrentElementNameG + ' Attribute : ' + FORMAT(CurrentXMLNodeP.nodeName) + ' = ' + FORMAT(CurrentXMLNodeP.nodeValue)); END; '3': // Text BEGIN MESSAGE(CurrentElementNameG + ' Text = ' + FORMAT(CurrentXMLNodeP.nodeValue)); END; END;
SetAddress()
StreetNameG := StreetnameP; StreetNoG := StreetNoP; PostalCodeG := PostalCodeP; CityG := CityP;
SOAPUI Settings, connections and properties.





0
Answers
-
<Continued information>
SOAP UI XML Request
<!--copy paste all text below into the XML request which is send to the webservice:-->
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v001="http://schema.bpost.be/services/common/address/ExternalMailingAddressProofingCSMessages/v001">
<soapenv:Header/>
<soapenv:Body>
<v001:ValidateAddressesRequest>
<v001:AddressToValidateList>
<!--1 to 100 repetitions:-->
<v001:AddressToValidate id="1">
<v001:MaileeAndAddressee>
<v001:AddresseeIndividualIdentification>
<v001:StructuredAddresseeIndividualIdentification>
<v001:AddresseeFormOfAddress>Mr</v001:AddresseeFormOfAddress>
<v001:AddresseeGivenName>Jean</v001:AddresseeGivenName>
<v001:AddresseeSurname>Dupont</v001:AddresseeSurname>
</v001:StructuredAddresseeIndividualIdentification>
</v001:AddresseeIndividualIdentification>
<v001:MaileeIndividualIdentification>
<v001:StructuredMaileeIndividualIdentification>
<v001:MaileeRole></v001:MaileeRole>
</v001:StructuredMaileeIndividualIdentification>
</v001:MaileeIndividualIdentification>
<v001:MaileeOrganizationIdentification>
<v001:StructuredMaileeOrganizationIdentification>
</v001:StructuredMaileeOrganizationIdentification>
</v001:MaileeOrganizationIdentification>
<v001:MailRecipientDispatchingInformation>
<v001:StructuredMailRecipientDispatchingInformation>
<v001:Wing>
</v001:Wing>
<v001:Stairwell>
</v001:Stairwell>
<v001:Floor>
</v001:Floor>
<v001:Door>
</v001:Door>
</v001:StructuredMailRecipientDispatchingInformation>
</v001:MailRecipientDispatchingInformation>
</v001:MaileeAndAddressee>
<v001:PostalAddress>
<v001:OtherDeliveryInformation>
<v001:StructuredOtherDeliveryInformation>
</v001:StructuredOtherDeliveryInformation>
</v001:OtherDeliveryInformation>
<v001:DeliveryPointLocation>
<v001:StructuredDeliveryPointLocation>
<v001:StreetName>Avenue Brugmann</v001:StreetName>
<v001:StreetNumber>1</v001:StreetNumber>
<v001:BoxNumber>2</v001:BoxNumber>
</v001:StructuredDeliveryPointLocation>
</v001:DeliveryPointLocation>
<v001:PostalCodeMunicipality>
<v001:StructuredPostalCodeMunicipality>
<v001:PostalCode>1180</v001:PostalCode>
<v001:MunicipalityName>Uccle</v001:MunicipalityName>
</v001:StructuredPostalCodeMunicipality>
</v001:PostalCodeMunicipality>
</v001:PostalAddress>
<v001:DispatchingCountryISOCode>BE</v001:DispatchingCountryISOCode>
<v001:DeliveringCountryISOCode>BE</v001:DeliveringCountryISOCode>
</v001:AddressToValidate>
</v001:AddressToValidateList>
<v001:ValidateAddressOptions>
<v001:IncludeFormatting>true</v001:IncludeFormatting>
<v001:IncludeSuggestions>true</v001:IncludeSuggestions>
<v001:IncludeSubmittedAddress>true</v001:IncludeSubmittedAddress>
</v001:ValidateAddressOptions>
<v001:CallerIdentification>
<v001:CallerName>customername</v001:CallerName>
</v001:CallerIdentification>
</v001:ValidateAddressesRequest>
</soapenv:Body>
</soapenv:Envelope>
SOAP UI XML RESPONSE
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<msg:ValidateAddressesResponse xmlns:msg="http://schema.bpost.be/services/common/address/ExternalMailingAddressProofingCSMessages/v001">
<msg:ValidatedAddressResultList>
<msg:ValidatedAddressResult id="1">
<msg:MaileeAndAddressee>
<msg:AddresseeIndividualIdentification>
<msg:StructuredAddresseeIndividualIdentification>
<msg:AddresseeFormOfAddress>Mr</msg:AddresseeFormOfAddress>
<msg:AddresseeGivenName>Jean</msg:AddresseeGivenName>
<msg:AddresseeSurname>Dupont</msg:AddresseeSurname>
</msg:StructuredAddresseeIndividualIdentification>
</msg:AddresseeIndividualIdentification>
<msg:MaileeIndividualIdentification>
<msg:StructuredMaileeIndividualIdentification>
<msg:MaileeRole/>
</msg:StructuredMaileeIndividualIdentification>
</msg:MaileeIndividualIdentification>
</msg:MaileeAndAddressee>
<msg:ValidatedAddressList>
<msg:ValidatedAddress>
<msg:PostalAddress>
<msg:StructuredDeliveryPointLocation>
<msg:StreetName>AVENUE BRUGMANN</msg:StreetName>
<msg:StreetNumber>1</msg:StreetNumber>
</msg:StructuredDeliveryPointLocation>
<msg:StructuredPostalCodeMunicipality>
<msg:PostalCode>1060</msg:PostalCode>
<msg:MunicipalityName>SAINT-GILLES</msg:MunicipalityName>
</msg:StructuredPostalCodeMunicipality>
<msg:CountryName>BELGIQUE</msg:CountryName>
</msg:PostalAddress>
<msg:AddressLanguage>fr</msg:AddressLanguage>
<msg:Label>
<msg:Line>Mr Jean Dupont</msg:Line>
<msg:Line>AVENUE BRUGMANN 1</msg:Line>
<msg:Line>1060 SAINT-GILLES</msg:Line>
</msg:Label>
</msg:ValidatedAddress>
</msg:ValidatedAddressList>
<msg:Error>
<msg:ComponentRef>MunicipalityName</msg:ComponentRef>
<msg:ErrorCode>anomaly_in_field</msg:ErrorCode>
<msg:ErrorSeverity>warning</msg:ErrorSeverity>
</msg:Error>
<msg:Error>
<msg:ComponentRef>PostalCode</msg:ComponentRef>
<msg:ErrorCode>anomaly_in_field</msg:ErrorCode>
<msg:ErrorSeverity>warning</msg:ErrorSeverity>
</msg:Error>
<msg:Error>
<msg:ComponentRef>BoxNumber</msg:ComponentRef>
<msg:ErrorCode>anomaly_in_field</msg:ErrorCode>
<msg:ErrorSeverity>warning</msg:ErrorSeverity>
</msg:Error>
<msg:DetectedInputAddressLanguage>fr</msg:DetectedInputAddressLanguage>
<msg:FormattedSubmittedAddress>
<msg:Line>Mr Jean Dupont</msg:Line>
<msg:Line>Avenue Brugmann 1 box 2</msg:Line>
<msg:Line>1180 Uccle</msg:Line>
</msg:FormattedSubmittedAddress>
<msg:TransactionID>7a5b6e26-83fd-46de-8d7d-b0366bd58437</msg:TransactionID>
</msg:ValidatedAddressResult>
</msg:ValidatedAddressResultList>
</msg:ValidateAddressesResponse>
</soapenv:Body>
</soapenv:Envelope>
0 -
Hi,
When you are able to get for the same payload a response through SoapUI, then it's potentially a problem in your http-connection.
Just a guess, did you consider TLS in your code?
Most modern webservices discontinued SSL and did made TLS mandatory.My blog - https://www.HannesHolst.com/0 -
[Topic moved from 'NAV/Navision Classic Client' forum to 'NAV Three Tier' forum]
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions