This article is part of the article serie
Setting up OAuth 2.0 - IntroductionThis error will occur when the organisation code is included in the soap header instead of the company (office) code.
An example of the soap header which will result in this error:
<env:Header>
<Header xmlns="
http://www.twinfield.com/">;
<AccessToken>91e879b289db22dfec4ed2e6fbd116ec</ns2:AccessToken>
<CompanyCode>TWINAPPS</ns2:CompanyCode>
<CompanyId xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"" xsi:nil="true"/>
<Header>
</env:Header>
De value "TWINAPPS" in this example refers to the organisation code, but not the office code.
SolutionUse the office list function first to create a list of all the offices that the API user has access to:
<list>
<type>offices</type>
</list>
It is mandatory to include the company code in the soap header with any other soap call then the list offices call.