Skip to main content
Skip table of contents

Web Services - Customer Register

Version history

Version

Date

Change target / Explanation

16.5.3

15.03.2023

SalesDimensionProfile and PurchaseDimensionProfile added
The encoding column removed as unnecessary. All string fields are UTF-8.
Additional information etc. column renamed to Format, and this indicates what format the field can contain in addition to the type.

1 Module Overview

This module is used to retrieve information about specific customers from the Customer Register and to update some customer information. The interfaces do not support multiple currencies; only EUR is supported.

Error handling must be integrated into the interfaces in case of connection interruptions.

Usage Examples:

  • Search for customer address information

  • Update customer address information

  • Link customers as extra addresses

  • Create new customers in the register

  • Mark customers as deleted from the register

1.2 Supported features

All NetBaron customer register features are supported, except for customer categories defined for the register entry.

1.3 Implementation

If the NetBaron Customer Register contains customers missing an external number, updating the correct customer information might be problematic.

  • Option 1: Search the entire customer register and complete the missing ExternalCustomerIdentifierId information. (It is recommended that the internal IDs of the integrated system be known to NetBaron in this field)

  • Option 2: Use KeyElements targeting on all possible data (business ID, EDI, organization, contact person, address). This way, if the NetBaron system cannot detect a customer with the given information, it creates a new customer. Please note that all information must be contained in the XML file. If, for example, the contact person does not exist in the integrated system, the element must be imported blank.


2 Technical Information

2.1 Service Information

Address:

https://{server}/ws/customer

If another parallel interface has been activated, the interface number in question must be specified so that the interface is connected from the correct address. Otherwise, the authentication will fail. I.e. https://{server}/ws/customer2

Authentication:

Organization and the organization-specific Web Services password

The character set used:

UTF-8

The methods in use:

GET / POST / DELETE

Type of request:

Object

Type of response:

Object


2.2 Request Content (GET)

It is possible to use a string or a BeginsWith-structure as the SEARCH CONDITION type. For example, <BeginsWith>Cust</BeginsWith> finds all data where the string begins with "Cust".

Element

Type

Default

Definition

CustomerIdentifierId

int

Customer number

ExtraCustomerIdentifier Id

string

External customer number

CustomerType

string

Customer type

PartyIdentifier

string

Business ID

OrganisationUnitNumb er

string

EDI

ContactPersonName

string

Name of contact person

StreetName

string

Address

PostCodeIdentifier

string

Postal code

TownName

string

Business place

EmailAddressIdentifier

string

Email address

GetExtraAddresses

boolean

false

True = Search for extra address as part of structure

False = Search for main address only

GetFromExtraAddresses

boolean

false

True = Search for extra addresses at the main level. This way, extra addresses can be searched using the search criteria mentioned above.

False = Do not search for extra addresses at the main level.

GetDefaults

boolean

false

True = reset to default

GetExtraFields

boolean

false

True = reset ExtraFields-table

GetAttachments

boolean

false

True = reset Attachements-tabel

GetBankingDetails

boolean

false

True = reset BanksingDetails-table

GetCertificationDetails

boolean

false

True = reset certification information

GetFinvoicePaymentInst ructionDetails

boolean

false

True = reset FinvoicePaymentInstructionDetails-table

GetCargoContractDetail s

boolean

false

True = reset CargoContractDetails-table

GetPriceListDetails

boolean

false

True = reset the selected product discounts to the customer


2.3 Response content (GET)

The table shows the content of the response from the service.

Element

Type

Shape

Definition

ResponseStatus

int

0 | 1

0= Error

1=The operation completed successfully

ResponseMessage

string

Provides descriptive information about the response

NumOfCustomers

int

Number of customers searched

Customers

array

Selected customers as Customer objects

2.3.1 Customers – table

 Customers-table consist of Customer elements that contain the following information.

Element

Type

Shape

Search condition

Definition

CustomerIdentifierId

int

Customer number

NumOfExtraAddresses

int

Number of extra addresses

ExternalCustomerIdentifierI d

string

External customer number

ReservedForExtraAddress

string

Customer reserved for extra address

PartyIdentifierScheme

string

iso6523cid

Business ID Semantic code

PartyIdentifier

string

Business ID

TaxCodeIdentifier

string

VAT ID

OrganisationUnitNumber

string

EDI

RemittanceInfoIdentifier

string

Invoice reference number

SocialSecurityNumber

string

Social security Number

Gender

string

Gender

ExtraIdentifier

string

Extra identifier

ExtraIdentifierDescription

string

Description of extra identifier

InvoiceIntermediator

string

Invoice intermediator

InvoiceAccountIdentifierSch eme

string

E-invoice type identifier

Semantic code

InvoiceAccountIdentifier

string

E-invoice identifier

PurchaseInvoiceImportType

string

Purchase invoice import type (unpacked or summary)

PurchaseInvoiceImportTitle

string

Title of purchase invoice import method summary

OrganisationName

string

Name of organization

OrganisationName2

string

Name 2 of organization

ContactPersonName

string

Contact person

FirstName

string

First name

MiddleName

string

Middle name

SurName

string

Surname

Occupation

string

Occupation

StreetName

string

Address

StreetName2

string

Address 2

PostCodeIdentifier

string

Postal code

TownName

string

Business place

HomeTownName

string

Home town

CountryCode

string

Country

CountrySubdivision

string

Area / unit

Department

PhoneNumberIdentifier

string

Phone

PhoneNumberIdentifier2

string

Phone 2

GsmNumberIdentifier

string

GSM

FaxNumberIdentifier

string

Fax

EmailAddressIdentifier

string

Email

WebAddressIdentifier

string

www

CustomerType

string

Customer type

InvoiceHandle

string

Invoice handling (Consumer or Company or Public Administration)

Industry

string

Industry

PaymentTermsFreeText

string

GetDefaults

Term of payment

DeliveryTermsText

string

GetDefaults

Delivery term

DeliveryMethodText

string

GetDefaults

Delivery methods

ProjectReferenceIdentifier

string

GetDefaults

Project number

SalesAccountIdentifier

int

GetDefaults

Sales account

SalesDimensionText

string

GetDefaults

Sales cost center

SalesDimensionProfile

string

GetDefaults

Dimension profile of sales invoice

InvoiceDefaultNoticeCostAmount

double

GetDefaults

Reminder fee

InvoiceDefaultOverdueInter estPercent

double

GetDefaults

Late payment interest

InvoiceInterestListLimit

double

GetDefaults

Interest rate limit

PurchaseAccountIdentifier

int

GetDefaults

Purchase account

PurchaseDimensionText

string

GetDefaults

Purchase cost center

PurchaseDimensionProfile

string

GetDefaults

Dimension profile of purchase invoice

DeliveryInstructions

string

GetDefaults

Delivery instructions

InvoiceInstructions

string

GetDefaults

Billing instructions

TransportInstructions

string

GetDefaults

Transport instructions

DefaultPaymentInstructionI dentifier

int

GetDefaults

Payment instruction

SalesPerson

string

GetDefaults

Seller

PurchasePerson

string

GetDefaults

Buyer

PurchasePriceList

string

GetDefaults

Purchase price list

SalesPriceList

string

GetDefaults

Sales price list

ValueAddedTaxRegisterDat e

date

GetCertificationDetails

Value added tax register

TradeRegisterDate

date

GetCertificationDetails

Trade register

TaxAdministrationDate

date

GetCertificationDetails

Tax administration basic information

PrepaymentRegisterDate

date

GetCertificationDetails

Prepayment register

reypaymentRegistrationValidUntil

date

GetCertificationDetails

Prepayment register

validity

EmployerRegisterDate

date

GetCertificationDetails

Employer register

CreditLimitAcceptedDate

date

GetCertificationDetails

Credit details day

CreditLimitAccepted

string

Y|N

GetCertificationDetails

Credit details approved

CreditLimitCheckInterval

int

GetCertificationDetails

Inspection interval of credit

CreditLimitCheckIntervalType

string

DAY |

MONTH |

YEAR

GetCertificationDetails

Type of inspection interval of credit

CreditLimit

double

GetCertificationDetails

One sale credit limit

CreditLimitOverdraftAllowe d

string

Y|N

GetCertificationDetails

One sale credit limit overdraft allowed

TotalCreditLimit

double

GetCertificationDetails

Total credit limit

TotalCreditLimitOverdraftAl lowed

string

Y|N

GetCertificationDetails

Total credit limit overdraft allowed

AuditingDate

date

GetCertificationDetails

Audit date

AuditingInterval

int

GetCertificationDetails

Audit interval

AuditingIntervalType

string

DAY |

MONTH |

YEAR

GetCertificationDetails

Audit intervaltype

AuditingClassification

int

GetCertificationDetails

Overall rating

AuditingAccepted

string

Y|N

GetCertificationDetails

Approved customer

DefaultUserPermission

string

GetCertificationDetails

User-specific general permission to edit customer data

PersonPermissions

array

GetCertificationDetails

User specific permission for the customer

PhoneMarketingDenied

string

Y|N

GetDefaults

Phone marketing prohibited

PostalMarketingDenied

string

Y|N

GetDefaults

Postal marketing prohibited

EmailMarketingDenied

string

Y|N

GetDefaults

E-mail marketing prohibited

SmsMarketingDenied

string

Y|N

GetDefaults

SMS marketing prohibited

InvoicePrintFileMethod

GetDefaults

Printing method

InvoicePrintFileType

GetDefaults

Printing template

SalesDeferral

string

GetDefaults

Deferral profile of sales invoice

PurchaseDeferral

string

GetDefaults

Deferral profile of purchase invoice

PurchaseInvoiceInspectors

string

GetDefaults

Default inspectors for purchase invoices

PurchaseInvoiceAcceptors

string

GetDefaults

Default acceptors for purchase invoices

ExtraFields

array

GetExtraFields

Table that contains customer extra fields

BankingDetails

array

GetBankingDetails

Table that contains customer banking details

Attachments

array

GetAttachments

Table that contains attachments connected to customer

FinvoicePaymentInstruction Details

array

GetFinvoicePaymentI nstructionDetails

Table that contains Finvoice payment instruction details connected to customer

CargoContractDetails

array

GetCargoContractDet ails

Table that contains customer cargo contract details

PriceListDetails

array

GetPriceListDetails

Table that contains

discounts for the products selected for the customer

ExtraAddresses

array

GetExtraAddresses

Table that contains extra addresses linked to the customer, equivalent to Customers array

2.3.2 PersonPermissions-table

Element

Type

Shape

Definition

PermissionIdentifier

int

 

Specific user permission identifier

Permission

string

 

R=Read only, W=Readwrite, N=No right

Active

string

Y|N

Active

2.3.3 PurchaseInvoiceInspectors-table

Element

Type

Definition

PersonIdentifier

int

Information identifying the person

Name

String

Person’s name

 

2.3.4 PurchaseInvoiceAcceptors-table

Element

Type

Definition

PersonIdentifier

int

Information identifying the person

Name

string

Person’s name

2.3.5 ExtraFields-table

Element

Type

Definition

Key

string

Name of extra field

Value

string

Value of extra field

2.3.6 BankingDetails-table

Element

Type

Definition

ReceiverBankNames

array

Name of receiver’s bank and address information

Accounts

array

Accounts

2.3.6.1 Accounts-table

Element

Type

Shape

Definition

AccountIdentifier

int

Information identifying the account

BBAN

string

Account BBAN

BIC

string

Account BIC

IBAN

string

Account IBAN

ClearingCode

string

Account clearing code

Default

string

Y|N

Default account

2.3.6.2 ReceiverBankNames-table

Element

Type

Definition

ReceiverBankNameIdentifie r

int

Information identifying the receiving bank

ReceiverBankName

string

Receiving bank name / address

2.3.7 Attachments-table

Element

Type

Definition

AttachmentIdentifier

int

Information identifying the attachment

FileName

string

File name

FileType

string

File type

File

Base64

File content

2.3.8 PaymentInstructionDetails-table

Element

Type

Shape

Definition

PaymentInstructionIdentifier

int

Payment instruction code

SellerInvoiceTypeText

string

Payment instruction information

Active

string

Y|N

Active

2.3.9 CargoContractDetails-table

Element

Type

Shape

Definition

CargoContractIdentifier

Information identifying cargo contract

CargoDeliverer

Cargo deliverer

CargoContractNumber

Contract number

CargoReturnContractNumber

Return contract number

Default

string

Y|N

Default

2.3.10 PriceListDetails-table

PriceListDetails-table consists of information about the products selected for the customer-specific price list. The product groups defined in the customer-specific price list are reset product by product.

Element

Type

Definition

ProductIdentifier

string

Product number

DiscountRate

double

Discount rate

SalePrice

double

Sales price VAT 0%

BaseSalePrice

double

Product sales VAT 0% without discount

Condition

string

Condition

QuantityOfCondition

string

Quantity of condition

2.3.11 ExtraAddresses-table

ExtraAddresses-table contains the same Customer objects as the Customers table, with the following additional information

Element

Type

Shape

Definition

DefaultExtraAddress

string

Y|N

Field indicating whether the extra  address

is a default extra address

ExtraAddressType

string

Billing address| Delivery address| Contact person|Null

Type of extra address

  • Laskutusosoite = Billing address

  • Toimitusosoite = Delivery address


2.4 Request content (POST)

Element

Type

Default

Definition

KeyElements

array

ExternalCustomerIdentifierId

List of elements from the Customers object used for searching an existing customer, possible options include all search criteria of the GET message.

It is recommended to use the customer number of the integrated system and ExternalCustomerIdentifierId, if these are available in NetBaron.

CreateIfNotFound

boolean

false

If true, create customer if

not found in the allocation

Customers

array

Customers to be updated

2.4.1 Customers-table

Element

Type

Shape

Definition

CustomerIdentifierId

int

Customer number

NumOfExtraAddresses

int

Number of extra addresses

ExternalCustomerIdentifierId

string

External customer number

ReservedForExtraAddress

string

Customer reserved for extra address

PartyIdentifierScheme

string

iso6523cid

Business ID semantic code

PartyIdentifier

string

Business ID

TaxCodeIdentifier

string

VAT code

OrganisationUnitNumber

string

EDI

RemittanceInfoIdentifier

string

Invoice reference number

SocialSecurityNumber

string

Social security number

Gender

string

Gender

ExtraIdentifier

string

Extra identifier

ExtraIdentifierDescription

string

Description of extra identifier

InvoiceIntermediator

string

Invoice intermediator

InvoiceAccountIdentifierScheme

string

iso6523cid

E-invoice type identifier

Semantic code

InvoiceAccountIdentifier

string

E-invoice identifier

PurchaseInvoiceImportType

string

unpacked | summary

Purchase invoice import type (unpacked or summary)

PurchaseInvoiceImportTitle

string

Title of purchase invoice import method summary

OrganisationName

string

Name of organization

OrganisationName2

string

Name 2 of organization

ContactPersonName

string

Contact person

FirstName

string

First name

MiddleName

string

Middle name

SurName

string

Surname

Occupation

string

Occupation

StreetName

string

Address

StreetName2

string

Address 2

PostCodeIdentifier

string

Postal code

TownName

string

Business place

HomeTownName

string

Home town

CountryCode

string

Country

CountrySubdivision

string

Department

PhoneNumberIdentifier

string

Phone

PhoneNumberIdentifier2

string

Phone 2

GsmNumberIdentifier

string

GSM

FaxNumberIdentifier

string

Fax

EmailAddressIdentifier

string

Email

WebAddressIdentifier

string

www

CustomerType

string

Customer type (Must be found in NetBaron register)

InvoiceHandle

string

Consumer | Company | PublicAdmini stration

Invoice handling (Consumer or Company or Public Administration)

Industry

string

Industry (Must be found in NetBaron register)

PaymentTermsFreeText

string

Term of payment (Must be found in NetBaron register)

DeliveryTermsText

string

Delivery term (Must be found in NetBaron register)

DeliveryMethodText

string

Delivery method (Must be found in NetBaron register)

ProjectReferenceIdentifier

string

Project number (Must be found in NetBaron register)

SalesAccountIdentifier

int

Sales account (Must be found in NetBaron register)

SalesDimensionText

string

Sales cost center (Must be found in NetBaron register)

SalesDimensionProfile

string

Profile

description text

Dimension profile of sales invoice (Must be found in the settings)

InvoiceDefaultNoticeCostAmount

double

Reminder fee

InvoiceDefaultOverdueInterestPercent

double

Late payment interest

InvoiceInterestListLimit

double

Interest rate limit

PurchaseAccountIdentifier

int

Purchase account (Must be found in NetBaron register)

PurchaseDimensionText

string

Purchase cost center (Must be found in NetBaron register)

PurchaseDimensionProfile

string

Dimension profile of purchase invoice (Must be found in NetBaron register)

DeliveryInstructions

string

Delivery instructions

InvoiceInstructions

string

Billing instructions

TransportInstructions

string

Transport instructions

DefaultPaymentInstructionIdentifier

int

Payment instruction (Must be found in NetBaron register)

SalesPerson

string

Seller (Must be found in NetBaron register)

PurchasePerson

string

Buyer (Must be found in NetBaron register)

PurchasePriceList

string

Purchase price list (Must be found in NetBaron register)

SalesPriceList

string

Sales price list (Must be found in NetBaron register)

ValueAddedTaxRegisterDate

date

Value added tax register

TradeRegisterDate

date

Trade register

TaxAdministrationDate

date

Tax administration basic information

PrepaymentRegisterDate

date

Prepayment register

PreypaymentRegistrationValidUntil

date

Prepayment register

validity

EmployerRegisterDate

date

Employer register

CreditLimitAcceptedDate

date

Credit details day

CreditLimitAccepted

string

Y|N

Credit details approved

CreditLimitCheckInterval

int

Inspection interval of credit

CreditLimitCheckIntervalType

string

DAY | MONTH | YEAR

Type of inspection interval of credit

CreditLimit

double

One sale credit limit

CreditLimitOverdraftAllowed

string

Y|N

One sale credit limit overdraft allowed

TotalCreditLimit

double

Total credit limit

TotalCreditLimitOverdraftAllowed

string

Y|N

Total credit limit overdraft allowed

AuditingDate

date

Audit date

AuditingInterval

int

Audit interval

AuditingIntervalType

string

DAY | MONTH | YEAR

Audit intervaltype

AuditingClassification

int

Overall rating

AuditingAccepted

string

Y|N

Approved customer

DefaultUserPermission

string

User-specific general permission to edit customer data

PersonPermissions

array

User specific permission for the customer

PhoneMarketingDenied

string

Y|N

Phone marketing prohibited

PostalMarketingDenied

string

Y|N

Postal marketing prohibited

EmailMarketingDenied

string

Y|N

E-mail marketing prohibited

SmsMarketingDenied

string

Y|N

SMS marketing prohibited

InvoicePrintFileMethod

string

Values accepted: screen, printer, file, email, bank or operator

Printing method (Must be found in NetBaron register)

InvoicePrintFileType

string

Values accepted: Finvoice or PDF

Printing template (Must be found in NetBaron register)

SalesDeferral

string

Profile

description text

Deferral profile of sales invoice (Must be found in the settings)

PurchaseDeferral

string

Profile

description text

Deferral profile of purchase  invoice (Must be found in the settings)

PurchaseInvoiceInspectors

array

Default inspectors for purchase invoices

PurchaseInvoiceAcceptors

array

Default acceptors for purchase invoices

ExtraFields

array

Table that contains customer extra fields

BankingDetails

array

Table that contains customer banking details

Attachments

array

Table that contains attachments linked to customer

FinvoicePaymentInstructionDetails

array

Table that contains Finvoice payment instruction details connected to customer

CargoContractDetails

array

Table that contains customer cargo contract details

ExtraAddresses

array

Table that contains extra addresses linked to the customer, practically equivalent to Customers array

2.4.2 PersonPermissions-table

Element

Type

Shape

Definition

PersonIdentifier

int

Information identifying the person

Name

string

Person’s name

Operation

string

Control message Update | Insert | Delete

Update, create or delete information

2.4.3 PurchaseInvoiceInspectors-table

Element

Type

Shape

Definition

PersonIdentifier

int

Information identifying the person

Name

string

Person’s name

Operation

string

Control message Update | Insert | Delete

Update, create or delete information

2.4.4 PurchaseInvoiceAcceptors-table

Element

Type

Shape

Definition

PersonIdentifier

int

Information identifying the person

Name

string

Person’s name

Operation

string

Control message Update | Insert | Delete

Update, create or delete information

2.4.5 ExtraFields-table

Element

Type

Shape

Definition

Key

string

Name of extra field (Must be found in NetBaron register)

Value

string

Value of extra field

Operation

string

Control message Update

Update value of extra field

2.4.6 BankingDetails-table

Element

Type

Definition

ReceiverBankNames

Array

Receiver’s bank name and address information

Accounts

Array

Accounts

2.4.6.1 Accounts-table

Element

Type

Shape

Definition

AccountIdentifier

int

Information identifying the account, compulsory when updating or deleting

BBAN

string

Account BBAN

BIC

string

Account BIC

IBAN

string

Account IBAN

ClearingCode

string

Account clearing code

Default

string

Y|N

Default account

Operation

string

Control message  Update | Insert | Delete

Update, create or delete information

2.4.6.2 ReceiverBankNames-table

Element

Type

Shape

Definition

ReceiverBankNameIdentifier

int

Information identifying the receiver’s bank

ReceiverBankName

string

Receiver’s bank name / address information

Operation

string

Control message  Update | Insert | Delete

Update, create or delete information

2.4.7 Attachments-table

Element

Type

Shape

Definition

AttachmentIdentifier

int

Information identifying the attachment

FileName

string

File name

FileType

string

File mime-type

File

base64

File content

Operation

string

Control message Insert|Delete

Add an attachment

2.4.8 PaymentInstructionDetails-table

Element

Type

Shape

Definition

PaymentInstruction Identifier

int

Payment instruction code

SellerInvoiceType Text

string

Payment instruction information

Active

string

Y|N

Active

Operation

string

Control message Update

Update code (Active)

2.4.9 CargoContractDetails-table

Element

Type

Shape

Definition

CargoContractIdentifier

int

Information identifying cargo contract

CargoDeliverer

string

Cargo deliverer

CargoContractNumber

string

Contract number

CargoReturnContractNumber

string

Return contract number

Default

string

Y|N

Default

Operation

string

Control message Update | Insert | Delete

Update, create or delete information

2.4.10 ExtraAddresses-table

ExtraAddresses-table contains the same Customer objects as the Customers table, with the following additional information

Element

Type

Shape

Definition

DefaultExtraAddress

string

Y|N

Field indicating whether the extra address

is a default extra address

ExtraAddressType

string

Billing address| Delivery address| Contact person|Null

Type of extra address

  • Laskutusosoite = Billing address

  • Toimitusosoite = Delivery address


2.5 Response content (POST)

Element

Type

Definition

ResponseStatus

int

0= Error

1=The operation was completed successfully

ResponseMessage

string

Provides descriptive information about the response

Customers

array

Updated (or created) customers

2.5.1 Customers-table

If a new one was created, only CustomeridentifierId:s are returned.

If the original customer is updated, the Customers array is returned as with GET, but with the fields updated.

Element

Type

Definition

CustomerIdentifier Id

string

Customer number

ControlMessages

array

Response of the control message

2.5.2 ControlMessages -table

Element

Type

Shape

Definition

Status

string

ERROR / NOTICE = notice, e.g. about missing data

(does not interrupt operations) /OK = Update Ok

Response of the control message

Text

string

More detailed message about the update


2.6 Response content (DELETE)

Customers can be deleted by sending the necessary information in the Customers array. (KeyElements can be used to control the targeting as in POST)

If the customer targeting is successful (only 1 found when targeting) then customer will be deleted from the register.

2.6.1 Customers-table

Element

Type

Definition

ExternalCustomerIdentifier Id

string

External customer number


2.7 Content of the response (DELETE)

Response will be ControlMessages in the Customers table either for successful deletion or for failed targeting.

2.7.1 Customers-table

Element

Type

Definition

ControlMessages

array

Information about successful deletion

2.7.2 ControlMessages -table

Element

Type

Value

Definition

Status

string

ERROR /

NOTICE = notice about missing data (does not interrupt operations) /

OK = update ok

Response of control message

Text

string


3 Code samples

It should be noted that the code samples presented in the documents are examples of how the interface can be used. Implementation of the codes requires PHP knowledge from the www-service provider. NetBaron is not responsible for any direct or indirect damage and costs related to the sample codes when a third party does the implementation and further development.


3.1 GET (Simple)

A simple GET request will only retrieve basic information. By removing control messages from comments, more information can be included in the response.

3.1.1 PHP

PHP
<?php

function getresp($responsex, $pref=""){
	$responserows = "";
	foreach($responsex as $k => $r){
		if(is_array($r)){
			$responserows .= $pref."$k => Array(<br>".getresp($r,$pref."	").$pref."),<br>";
		} else 	if(is_object($r)){
			$responserows .= $pref."$k => Object(<br>".getresp($r,$pref."	").$pref."),<br>";
		} else $responserows .= $pref."$k => $r<br>";
	}
	return $responserows;
}

$ns = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd';
$token = new stdClass;
// Depending on the client-side encoding, utf_encode may be required.
$token->Username = new SOAPVar("username", XSD_STRING, null, null, null, $ns);
$token->Password = new SOAPVar("password", XSD_STRING, null, null, null, $ns);
$wsec = new stdClass;
$wsec->UsernameToken = new SoapVar($token, SOAP_ENC_OBJECT, null, null, null, $ns);
$soapHeaders[] = new SOAPHeader($ns, 'Security', $wsec->UsernameToken, true);
/**
* Client
*/
$client = new SoapClient(null, array(
	"location" => "https://<serverurl>/ws/customer",
	"uri" => "urn:NBWS",
	'style' => SOAP_RPC,
	'use' => SOAP_LITERAL,
	"soap_version" => SOAP_1_2,
	"compression" => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5,
	"trace" => 1)
);
/**
* Set headers
*/
$client->__setSoapHeaders( $soapHeaders );

try {

	$Request = new stdClass;

	// OHJAUSVIESTIT, defines what information is returned
	//$Request->GetExtraAddresses = true; // additional addresses as a object
	//$Request->GetFromExtraAddresses = true; // additional addresses at the main level
	//$Request->GetExtraFields = true; // extra fields
	//$Request->GetAttachments = true; // attachments
	//$Request->GetPermissionDetails = true; // user spesific permissions to customer
	//$Request->GetDefaults = true; // defaults 
	//$Request->GetBankingDetails = true; // bank details
	//$Request->GetCertificationDetails = true; // certification information
	//$Request->GetFinvoicePaymentInstructionDetails = true; // finvoice vastaanottajailmoitukset Finvoice recipient notifications
	//$Request->GetCargoContractDetails = true; // cargo contracts
	//$Request->GetPriceListDetails = true; // product & customer spefcific prices

	// SEARCH CONDITIONS (exact search)
	//$Request->CustomerIdentifierId = utf8_encode($_POST['GetCustomerIdentifierId']);
	//$Request->ExternalCustomerIdentifierId=utf8_encode($_POST['GetExternalCustomerIdentifierId']);
	//$Request->CustomerType = utf8_encode($_POST['GetCustomerType']);
	//$Request->PartyIdentifier = utf8_encode($_POST['GetPartyIdentifier']);
	//$Request->OrganisationUnitNumber = utf8_encode($_POST['GetOrganisationUnitNumber']);
	//$Request->OrganisationName = utf8_encode($_POST['GetOrganisationName']);
	//$Request->ContactPersonName = utf8_encode($_POST['GetContactPersonName']);
	//$Request->StreetName = utf8_encode($_POST['GetStreetName']);
	//$Request->PostCodeIdentifier = utf8_encode($_POST['GetPostCodeIdentifier']);
	//$Request->TownName = utf8_encode($_POST['GetTownName']);

	// alternatively SEARCH CONDITION BeginsWith
	//$Request->OrganisationName = new stdClass();
	//$Request->OrganisationName->BeginsWith = utf8_encode($_POST['GetOrganisationName']);
	// ...

	$response = $client->get( new SoapVar($Request, SOAP_ENC_OBJECT,"","","Request") );

	if(is_object($response)){
		$responserows = getresp($response);
	} else {
		$responserows = $response;
	}
	$response = "<b>RESPONSE</b><pre>".utf8_decode($responserows)."</b></pre>";
}
catch(SoapFault $fault){
	$response .= "<b>SOAP Fault:</b><pre>faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring}</pre>";
}
echo $response;
?>

3.1.2 XML

3.1.2.1 Request
XML
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="urn:NBWS" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<env:Header>
    <wsse:Security>
        <wsse:UsernameToken>
            <wsse:Username>username</wsse:Username>
            <wsse:Password>password</wsse:Password>
        </wsse:UsernameToken>
    </wsse:Security>
</env:Header>
<env:Body>
    <ns1:get>
        <Request/>
    </ns1:get>
</env:Body>
</env:Envelope>
3.1.2.2. Response
XML
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="urn:NBWS" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
<env:Body xmlns:rpc="http://www.w3.org/2003/05/soap-rpc">
    <ns1:getResponse env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
        <rpc:result>Response</rpc:result>
        <Response xsi:type="enc:Struct">
            <ResponseStatus xsi:type="xsd:int">1</ResponseStatus>
            <ResponseMessage xsi:type="xsd:string">
            </ResponseMessage>
            <NumOfCustomers xsi:type="xsd:int">1</NumOfCustomers>
            <Customers xsi:type="enc:Struct">
                <Customer xsi:type="enc:Struct">
                    <CustomerIdentifierId xsi:type="xsd:string">7242</CustomerIdentifierId>
                    <NumOfExtraAddresses xsi:type="xsd:string">0</NumOfExtraAddresses>
                    <ExternalCustomerIdentifierId xsi:type="xsd:string">4242420</ExternalCustomerIdentifierId>
                    <ReservedForExtraAddress xsi:type="xsd:string">N</ReservedForExtraAddress>
                    <PartyIdentifier xsi:type="xsd:string">1793463-5</PartyIdentifier>
                    <TaxCodeIdentifier xsi:type="xsd:string">FI17934635</TaxCodeIdentifier>
                    <OrganisationUnitNumber xsi:type="xsd:string">003708599126</OrganisationUnitNumber>
                    <RemittanceInfoIdentifier xsi:type="xsd:string">
                    </RemittanceInfoIdentifier>
                    <SocialSecurityNumber xsi:type="xsd:string">
                    </SocialSecurityNumber>
                    <Gender xsi:type="xsd:string">M</Gender>
                    <ExtraIdentifier xsi:type="xsd:string">
                    </ExtraIdentifier>
                    <ExtraIdentifierDescription xsi:type="xsd:string">
                    </ExtraIdentifierDescription>
                    <InvoiceIntermediator xsi:type="xsd:string">
                    </InvoiceIntermediator>
                    <InvoiceAccountIdentifier xsi:type="xsd:string">
                    </InvoiceAccountIdentifier>
                    <PurchaseInvoiceImportType xsi:type="xsd:string">purettu</PurchaseInvoiceImportType> <!-- UNPACKED -->
                    <PurchaseInvoiceImportTitle xsi:type="xsd:string">
                    </PurchaseInvoiceImportTitle>
                    <OrganisationName xsi:type="xsd:string">Netbaron Solutions Oy</OrganisationName>
                    <OrganisationName2 xsi:type="xsd:string">
                    </OrganisationName2>
                    <ContactPersonName xsi:type="xsd:string">AL</ContactPersonName>
                    <FirstName xsi:type="xsd:string">
                    </FirstName>
                    <MiddleName xsi:type="xsd:string">
                    </MiddleName>
                    <SurName xsi:type="xsd:string">
                    </SurName>
                    <Occupation xsi:type="xsd:string">
                    </Occupation>
                    <StreetName xsi:type="xsd:string">Kehräämöntie 7</StreetName>
                    <StreetName2 xsi:type="xsd:string">
                    </StreetName2>
                    <PostCodeIdentifier xsi:type="xsd:string">87400</PostCodeIdentifier>
                    <TownName xsi:type="xsd:string">Kajaani</TownName>
                    <HomeTownName xsi:type="xsd:string">Kajaani</HomeTownName>
                    <CountryCode xsi:type="xsd:string">FI</CountryCode>
                    <PhoneNumberIdentifier xsi:type="xsd:string">029 000 9015</PhoneNumberIdentifier>
                    <PhoneNumberIdentifier2 xsi:type="xsd:string">
                    </PhoneNumberIdentifier2>
                    <GsmPhoneNumberIdentifier xsi:type="xsd:string">044 553 2907</GsmPhoneNumberIdentifier>
                    <FaxNumberIdentifier xsi:type="xsd:string">
                    </FaxNumberIdentifier>
                    <EmailAddressIdentifier xsi:type="xsd:string">myynti@netbaron.fi</EmailAddressIdentifier>
                    <WebAddressIdentifier xsi:type="xsd:string">http://www.netbaron.fi</WebAddressIdentifier>
                    <CustomerType xsi:type="xsd:string">Deliverer</CustomerType>
                    <InvoiceHandle xsi:type="xsd:string">Company</InvoiceHandle>
                    <Industry xsi:type="xsd:string">
                    </Industry>
                </Customer>
            </Customers>
        </Response>
    </ns1:getResponse>
</env:Body>
</env:Envelope>

3.2. POST (Simple)

3.2.1 PHP

PHP
<?php

function getresp($responsex, $pref=""){
	$responserows = "";
	foreach($responsex as $k => $r){
		if(is_array($r)){
			$responserows .= $pref."$k => Array(<br>".getresp($r,$pref."	").$pref."),<br>";
		} else 	if(is_object($r)){
			$responserows .= $pref."$k => Object(<br>".getresp($r,$pref."	").$pref."),<br>";
		} else $responserows .= $pref."$k => $r<br>";
	}
	return $responserows;
}

$ns = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd';
$token = new stdClass;
// Depending on the client-side encoding, utf_encode may be required.
$token->Username = new SOAPVar("username", XSD_STRING, null, null, null, $ns);
$token->Password = new SOAPVar("password", XSD_STRING, null, null, null, $ns);
$wsec = new stdClass;
$wsec->UsernameToken = new SoapVar($token, SOAP_ENC_OBJECT, null, null, null, $ns);
$soapHeaders[] = new SOAPHeader($ns, 'Security', $wsec->UsernameToken, true);
/**
* Client
*/
$client = new SoapClient(null, array(
	"location" => "https://<serverurl>/ws/customer",
	"uri" => "urn:NBWS",
	'style' => SOAP_RPC,
	'use' => SOAP_LITERAL,
	"soap_version" => SOAP_1_2,
	"compression" => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5,
	"trace" => 1)
);
/**
* Set headers
*/
$client->__setSoapHeaders( $soapHeaders );

try {
	$Request = new stdClass();
	$Request->CreateIfNotFound = true; // Create customers if ExternalCustomerIdentifierId is not found in the register
	$Customers = array();
	$Customer = new stdClass();
	$Customer->ExternalCustomerIdentifierId = utf8_encode('123456'); // id from external system
	$Customer->CustomerType = utf8_encode('Customer'); // or Deliverer
	$Customer->PartyIdentifier = utf8_encode('1793463-5'); // business ID
	$Customer->OrganisationUnitNumber = utf8_encode('003708599126'); // EDI identidier (OVT)
	$Customer->OrganisationName = utf8_encode('Netbaron Solutions Oy'); // Company name
	$Customer->ContactPersonName = utf8_encode('AL'); // contact person
	$Customer->StreetName = utf8_encode('Kehräämöntie 7'); // steet address
	$Customer->PostCodeIdentifier = utf8_encode('87400'); // postal code
	$Customer->TownName = utf8_encode('Kajaani'); // city
	$Customer->HomeTownName = utf8_encode('Kajaani'); // place of business
	$Customers[] = new SoapVar($Customer, SOAP_ENC_OBJECT, null, null, "Customer");
	
	$Request->Customers = new SoapVar($Customers, SOAP_ENC_OBJECT, null, null, "Customers");
	
	$response = $client->post( new SoapVar($Request, SOAP_ENC_OBJECT,"","","Request") );

	if(is_object($response)){
		$responserows = getresp($response);
	} else {
		$responserows = $response;
	}
	$response = "<b>RESPONSE</b><pre>".utf8_decode($responserows)."</b></pre>";
}
catch(SoapFault $fault){
	$response .= "<b>SOAP Fault:</b><pre>faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring}</pre>";
}
echo $response;
?>

3.2.2. XML

3.2.2.1 Request
XML
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="urn:NBWS" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<env:Header>
    <wsse:Security>
        <wsse:UsernameToken>
            <wsse:Username>username</wsse:Username>
            <wsse:Password>password</wsse:Password>
        </wsse:UsernameToken>
    </wsse:Security>
</env:Header>
<env:Body>
    <ns1:post>
        <Request>
            <CreateIfNotFound>true</CreateIfNotFound>
            <Customers>
                <Customer>
                    <ExternalCustomerIdentifierId>123456</ExternalCustomerIdentifierId>
                    <CustomerType>Customer</CustomerType>
                    <PartyIdentifier>1793463-5</PartyIdentifier>
                    <OrganisationUnitNumber>003708599126</OrganisationUnitNumber>
                    <OrganisationName>Netbaron Solutions Oy</OrganisationName>
                    <ContactPersonName>AL</ContactPersonName>
                    <StreetName>Kehräämöntie 7</StreetName>
                    <PostCodeIdentifier>87400</PostCodeIdentifier>
                    <TownName>Kajaani</TownName>
                    <HomeTownName>Kajaani</HomeTownName>
                </Customer>
            </Customers>
        </Request>
    </ns1:post>
</env:Body>
</env:Envelope>
3.2.2.2 Response
XML
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="urn:NBWS" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
<env:Body xmlns:rpc="http://www.w3.org/2003/05/soap-rpc">
    <ns1:postResponse env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
        <rpc:result>Response</rpc:result>
        <Response xsi:type="enc:Struct">
            <ResponseStatus xsi:type="xsd:int">1</ResponseStatus>
            <ResponseMessage xsi:type="xsd:string">
            </ResponseMessage>
            <Customers xsi:type="enc:Struct">
                <Customer xsi:type="enc:Struct">
                    <ControlMessages xsi:type="enc:Struct">
                        <ControlMessage xsi:type="enc:Struct">
                            <Status xsi:type="xsd:string">OK</Status>
                            <Text xsi:type="xsd:string">Customer created</Text>
                        </ControlMessage>
                    </ControlMessages>
                    <CustomerIdentifierId xsi:type="xsd:string">7247</CustomerIdentifierId>
                </Customer>
            </Customers>
        </Response>
    </ns1:postResponse>
</env:Body>
</env:Envelope>

3.3 POST with extra addresses

3.2.1 PHP

PHP
<?php

function getresp($responsex, $pref=""){
	$responserows = "";
	foreach($responsex as $k => $r){
		if(is_array($r)){
			$responserows .= $pref."$k => Array(<br>".getresp($r,$pref."	").$pref."),<br>";
		} else 	if(is_object($r)){
			$responserows .= $pref."$k => Object(<br>".getresp($r,$pref."	").$pref."),<br>";
		} else $responserows .= $pref."$k => $r<br>";
	}
	return $responserows;
}

$ns = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd';
$token = new stdClass;
// Depending on the client-side encoding, utf_encode may be required.
$token->Username = new SOAPVar("username", XSD_STRING, null, null, null, $ns);
$token->Password = new SOAPVar("password", XSD_STRING, null, null, null, $ns);
$wsec = new stdClass;
$wsec->UsernameToken = new SoapVar($token, SOAP_ENC_OBJECT, null, null, null, $ns);
$soapHeaders[] = new SOAPHeader($ns, 'Security', $wsec->UsernameToken, true);
/**
* Client
*/
$client = new SoapClient(null, array(
	"location" => "https://<serverurl>/ws/customer",
	"uri" => "urn:NBWS",
	'style' => SOAP_RPC,
	'use' => SOAP_LITERAL,
	"soap_version" => SOAP_1_2,
	"compression" => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5,
	"trace" => 1)
);
/**
* Set headers
*/
$client->__setSoapHeaders( $soapHeaders );

try {
	$Request = new stdClass();
	$Request->CreateIfNotFound = true; // Create customers if ExternalCustomerIdentifierId is not found in the register
	$Customers = array();
	$Customer = new stdClass();
	$Customer->ExternalCustomerIdentifierId = utf8_encode('123456'); // id from external system
	$Customer->CustomerType = utf8_encode('Customer'); // or Deliverer
	$Customer->PartyIdentifier = utf8_encode('1793463-5'); // business ID
	$Customer->OrganisationUnitNumber = utf8_encode('003708599126'); // EDI indentifier (OVT)
	$Customer->OrganisationName = utf8_encode('Netbaron Solutions Oy'); // company name
	$Customer->ContactPersonName = utf8_encode('AL'); // cantact person
	$Customer->StreetName = utf8_encode('Kehräämöntie 7'); // street address
	$Customer->PostCodeIdentifier = utf8_encode('87400'); // postal code
	$Customer->TownName = utf8_encode('Kajaani'); // city
	$Customer->HomeTownName = utf8_encode('Kajaani'); // place of business
	$InvoiceCustomer = new stdClass();
	$InvoiceCustomer->ExternalCustomerIdentifierId = utf8_encode('1234561'); //// id from external system, note! different from Customer
	$InvoiceCustomer->PartyIdentifier = utf8_encode('1793463-5'); // business ID 
	$InvoiceCustomer->OrganisationUnitNumber = utf8_encode('003708599126'); // EDI indentifier (OVT)
	$InvoiceCustomer->OrganisationName = utf8_encode('Netbaron Solutions Oy'); // company name
	$InvoiceCustomer->ContactPersonName = utf8_encode('AL'); // cantact person
	$InvoiceCustomer->StreetName = utf8_encode('Kehräämöntie 7'); // street address
	$InvoiceCustomer->PostCodeIdentifier = utf8_encode('87400'); // postal code
	$InvoiceCustomer->TownName = utf8_encode('Kajaani'); // city
	$InvoiceCustomer->HomeTownName = utf8_encode('Kajaani'); // place of business
	$InvoiceCustomer->ReservedForExtraAddress = true; // Customer reserved for extra addresses
	$InvoiceCustomer->ExtraAddressType = utf8_encode('Laskutusosoite'); // Set as billing address
	$InvoiceCustomer->DefaultExtraAddress = true; // Also set as default billing address
	$Customer->ExtraAddresses = array(); // Extra addresses as an array
	// encoded as SOAP
	$Customer->ExtraAddresses[] = new SoapVar($InvoiceCustomer, SOAP_ENC_OBJECT, null, null, "Customer");
	$Customer->ExtraAddresses = new SoapVar($Customer->ExtraAddresses, SOAP_ENC_OBJECT, null, null, "ExtraAddresses");
	$Customers[] = new SoapVar($Customer, SOAP_ENC_OBJECT, null, null, "Customer");
	
	$Request->Customers = new SoapVar($Customers, SOAP_ENC_OBJECT, null, null, "Customers");	
	
	$response = $client->post( new SoapVar($Request, SOAP_ENC_OBJECT,"","","Request") );

	if(is_object($response)){
		$responserows = getresp($response);
	} else {
		$responserows = $response;
	}
	$response = "<b>RESPONSE</b><pre>".utf8_decode($responserows)."</b></pre>";
}
catch(SoapFault $fault){
	$response .= "<b>SOAP Fault:</b><pre>faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring}</pre>";
}
echo $response;
?>

3.3.2 XML

3.3.2.1 Request
XML
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="urn:NBWS" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<env:Header>
    <wsse:Security>
        <wsse:UsernameToken>
            <wsse:Username>username</wsse:Username>
            <wsse:Password>password</wsse:Password>
        </wsse:UsernameToken>
    </wsse:Security>
</env:Header>
<env:Body>
    <ns1:post>
        <Request>
            <CreateIfNotFound>true</CreateIfNotFound>
            <Customers>
                <Customer>
                    <ExternalCustomerIdentifierId>123456</ExternalCustomerIdentifierId>
                    <CustomerType>Customer</CustomerType>
                    <PartyIdentifier>1793463-5</PartyIdentifier>
                    <OrganisationUnitNumber>003708599126</OrganisationUnitNumber>
                    <OrganisationName>Netbaron Solutions Oy</OrganisationName>
                    <ContactPersonName>AL</ContactPersonName>
                    <StreetName>Kehräämöntie 7</StreetName>
                    <PostCodeIdentifier>87400</PostCodeIdentifier>
                    <TownName>Kajaani</TownName>
                    <HomeTownName>Kajaani</HomeTownName>
                    <ExtraAddresses>
                        <Customer>
                            <ExternalCustomerIdentifierId>1234561</ExternalCustomerIdentifierId>
                            <PartyIdentifier>1793463-5</PartyIdentifier>
                            <OrganisationUnitNumber>003708599126</OrganisationUnitNumber>
                            <OrganisationName>Netbaron Solutions Oy</OrganisationName>
                            <ContactPersonName>AL</ContactPersonName>
                            <StreetName>Kehräämöntie 7</StreetName>
                            <PostCodeIdentifier>87400</PostCodeIdentifier>
                            <TownName>Kajaani</TownName>
                            <HomeTownName>Kajaani</HomeTownName>
                            <ReservedForExtraAddress>true</ReservedForExtraAddress>
                            <ExtraAddressType>Laskutusosoite</ExtraAddressType> <!-- Billing address -->
                            <DefaultExtraAddress>true</DefaultExtraAddress>
                        </Customer>
                    </ExtraAddresses>
                </Customer>
            </Customers>
        </Request>
    </ns1:post>
</env:Body>
</env:Envelope>
3.3.2.2. Response
XML
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="urn:NBWS" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://www.w3.org/2003/05/soap-encoding">
<env:Body xmlns:rpc="http://www.w3.org/2003/05/soap-rpc">
    <ns1:postResponse env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
        <rpc:result>Response</rpc:result>
        <Response xsi:type="enc:Struct">
            <ResponseStatus xsi:type="xsd:int">1</ResponseStatus>
            <ResponseMessage xsi:type="xsd:string">
            </ResponseMessage>
            <Customers xsi:type="enc:Struct">
                <Customer xsi:type="enc:Struct">
                    <ControlMessages xsi:type="enc:Struct">
                        <ControlMessage xsi:type="enc:Struct">
                            <Status xsi:type="xsd:string">OK</Status>
                            <Text xsi:type="xsd:string">Customer created</Text>
                        </ControlMessage>
                    </ControlMessages>
                    <CustomerIdentifierId xsi:type="xsd:string">7249</CustomerIdentifierId>
                    <ExtraAddresses xsi:type="enc:Struct">
                        <Customer xsi:type="enc:Struct">
                            <ControlMessages xsi:type="enc:Struct">
                                <ControlMessage xsi:type="enc:Struct">
                                    <Status xsi:type="xsd:string">OK</Status>
                                    <Text xsi:type="xsd:string">Customer created</Text>
                                </ControlMessage>
                                <ControlMessage xsi:type="enc:Struct">
                                    <Status xsi:type="xsd:string">OK</Status>
                                    <Text xsi:type="xsd:string">Created extra address relation</Text>
                                </ControlMessage>
                            </ControlMessages>
                            <CustomerIdentifierId xsi:type="xsd:string">7250</CustomerIdentifierId>
                        </Customer>
                    </ExtraAddresses>
                </Customer>
            </Customers>
        </Response>
    </ns1:postResponse>
</env:Body>
</env:Envelope>

3.4 POST KeyElements with targeting information

Updating customer record by targeting business ID and EDI.

3.4.1 PHP

PHP
<?php

function getresp($responsex, $pref=""){
	$responserows = "";
	foreach($responsex as $k => $r){
		if(is_array($r)){
			$responserows .= $pref."$k => Array(<br>".getresp($r,$pref."	").$pref."),<br>";
		} else 	if(is_object($r)){
			$responserows .= $pref."$k => Object(<br>".getresp($r,$pref."	").$pref."),<br>";
		} else $responserows .= $pref."$k => $r<br>";
	}
	return $responserows;
}

$ns = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd';
$token = new stdClass;
// Depending on the client-side encoding, utf_encode may be required.
$token->Username = new SOAPVar("username", XSD_STRING, null, null, null, $ns);
$token->Password = new SOAPVar("password", XSD_STRING, null, null, null, $ns);
$wsec = new stdClass;
$wsec->UsernameToken = new SoapVar($token, SOAP_ENC_OBJECT, null, null, null, $ns);
$soapHeaders[] = new SOAPHeader($ns, 'Security', $wsec->UsernameToken, true);
/**
* Client
*/
$client = new SoapClient(null, array(
	"location" => "https://<serverurl>/ws/customer",
	"uri" => "urn:NBWS",
	'style' => SOAP_RPC,
	'use' => SOAP_LITERAL,
	"soap_version" => SOAP_1_2,
	"compression" => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5,
	"trace" => 1)
);
/**
* Set headers
*/
$client->__setSoapHeaders( $soapHeaders );

try {
	$Request = new stdClass();
	$Request->CreateIfNotFound = true; // // Create customers if not found in the register
	// data used for targeting/linking customer 
	$KeyElements = array();
	// business ID as targeting/linking criteria 
	$KeyElements[] = new SoapVar("PartyIdentifier", SOAP_ENC_OBJECT, "", "", "PartyIdentifier");
	// EDI identifier as targeting/linking criteria 
	$KeyElements[] = new SoapVar("OrganisationUnitNumber", SOAP_ENC_OBJECT, "", "", "OrganisationUnitNumber");
	$Request->KeyElements = new SoapVar($KeyElements, SOAP_ENC_OBJECT, "", "", "KeyElements");
	$Customers = array();
	$Customer = new stdClass();
	$Customer->ExternalCustomerIdentifierId = utf8_encode('123456'); // id from external system
	$Customer->CustomerType = utf8_encode('Customer'); // or Deliverer
	$Customer->PartyIdentifier = utf8_encode('1793463-5'); // business ID
	$Customer->OrganisationUnitNumber = utf8_encode('003708599126'); // EDI identifier (OVT)
	$Customer->OrganisationName = utf8_encode('Netbaron Solutions Oy'); // company name
	$Customer->ContactPersonName = utf8_encode('AL'); // contact person
	$Customer->StreetName = utf8_encode('Kehräämöntie 7'); // street address
	$Customer->PostCodeIdentifier = utf8_encode('87400'); // postal code
	$Customer->TownName = utf8_encode('Kajaani'); // city
	$Customer->HomeTownName = utf8_encode('Kajaani'); // place of business
	$Customers[] = new SoapVar($Customer, SOAP_ENC_OBJECT, null, null, "Customer");

	$Request->Customers = new SoapVar($Customers, SOAP_ENC_OBJECT, null, null, "Customers");		
	
	$response = $client->post( new SoapVar($Request, SOAP_ENC_OBJECT,"","","Request") );

	if(is_object($response)){
		$responserows = getresp($response);
	} else {
		$responserows = $response;
	}
	$response = "<b>RESPONSE</b><pre>".utf8_decode($responserows)."</b></pre>";
}
catch(SoapFault $fault){
	$response .= "<b>SOAP Fault:</b><pre>faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring}</pre>";
}
echo $response;
?>

3.4.2 XML

3.4.2.1 Request
XML
<?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="urn:NBWS" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
        <env:Header>
            <wsse:Security>
                <wsse:UsernameToken>
                    <wsse:Username>username</wsse:Username>
                    <wsse:Password>password</wsse:Password>
                </wsse:UsernameToken>
            </wsse:Security>
        </env:Header>
        <env:Body>
            <ns1:post>
                <Request>
                    <CreateIfNotFound>true</CreateIfNotFound>
                    <KeyElements>
                        <PartyIdentifier/>
                        <OrganisationUnitNumber/>
                    </KeyElements>
                    <Customers>
                        <Customer>
                            <ExternalCustomerIdentifierId>123456</ExternalCustomerIdentifierId>
                            <CustomerType>Customer</CustomerType>
                            <PartyIdentifier>1793463-5</PartyIdentifier>
                            <OrganisationUnitNumber>003708599126</OrganisationUnitNumber>
                            <OrganisationName>Netbaron Solutions Oy</OrganisationName>
                            <ContactPersonName>Marko Ruusu</ContactPersonName>
                            <StreetName>Uusi osoite 123</StreetName>
                            <PostCodeIdentifier>87400</PostCodeIdentifier>
                            <TownName>Kajaani</TownName>
                            <HomeTownName>Kajaani</HomeTownName>
                        </Customer>
                    </Customers>
                </Request>
            </ns1:post>
        </env:Body>
    </env:Envelope>
3.4.2.2 Response
XML
<?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="urn:NBWS" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
        <env:Header>
            <wsse:Security>
                <wsse:UsernameToken>
                    <wsse:Username>username</wsse:Username>
                    <wsse:Password>password</wsse:Password>
                </wsse:UsernameToken>
            </wsse:Security>
        </env:Header>
        <env:Body>
            <ns1:post>
                <Request>
                    <CreateIfNotFound>true</CreateIfNotFound>
                    <KeyElements>
                        <PartyIdentifier/>
                        <OrganisationUnitNumber/>
                    </KeyElements>
                    <Customers>
                        <Customer>
                            <ExternalCustomerIdentifierId>123456</ExternalCustomerIdentifierId>
                            <CustomerType>Customer</CustomerType>
                            <PartyIdentifier>1793463-5</PartyIdentifier>
                            <OrganisationUnitNumber>003708599126</OrganisationUnitNumber>
                            <OrganisationName>Netbaron Solutions Oy</OrganisationName>
                            <ContactPersonName>Marko Ruusu</ContactPersonName>
                            <StreetName>Uusi osoite 123</StreetName>
                            <PostCodeIdentifier>87400</PostCodeIdentifier>
                            <TownName>Kajaani</TownName>
                            <HomeTownName>Kajaani</HomeTownName>
                        </Customer>
                    </Customers>
                </Request>
            </ns1:post>
        </env:Body>
    </env:Envelope>

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.