Issues Integrating 3CX with SAP Business One (B1) on HANA Using Service Layer – Need Help

Status
Not open for further replies.

WEBBICS

Customer
Joined
Aug 21, 2024
Messages
2
Reaction score
0
Hello everyone,

I’ve been working on integrating 3CX (Version 20, Update 2) with SAP Business One (B1) on HANA (Version 9.3 PL 11) using the SAP Service Layer. My goal is to have 3CX match incoming call numbers with customer data in SAP B1 and display the correct contact information.

System Details:

  • SAP Business One: Version 9.3 PL 11 on HANA
  • 3CX: Version 20, Update 2
What I’ve Tried:

  1. OAuth2 with Password Credentials:
    • I configured the CRM Template Generator for OAuth2. When I click “Authorize,” a new tab opens where I am prompted to enter username and password (via the browser’s Basic Authentication popup). Even though I enter the correct credentials, the prompt keeps reappearing, and I can’t proceed beyond this point.
  2. Basic Authentication:
    • I also tried using Basic Authentication by encoding username:password in Base64 and setting it in the Authorization header. However, this resulted in 3CX rejecting the XML with the error "Invalid file format."
  3. Using a Static Session ID:
    • I generated a session ID via Postman and attempted to use it directly in the XML configuration by adding it as a cookie (B1SESSION=[SessionId]). Once again, 3CX gave the "Invalid file format" error.
Here’s an example of the XML I’ve used:
Code:
<?xml version="1.0"?>
<Crm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Country="DE" Name="SAP B1 Integration" Version="1" SupportsEmojis="true">
  <Number Prefix="AsIs" MaxLength="20" />
  <Connection MaxConcurrentRequests="2" />
  <Parameters>
    <Parameter Name="CompanyDB" Type="String" Parent="General Configuration" Editor="String" Title="Company Database:" Default="****" />
    <Parameter Name="UserName" Type="String" Parent="General Configuration" Editor="String" Title="Username:" Default="****" />
    <Parameter Name="Password" Type="String" Parent="General Configuration" Editor="Password" Title="Password:" Default="****" />
  </Parameters>
  <Authentication Type="OAuth2">
    <Value>https://192.168.25.103:50000/b1s/v1/Login</Value>
  </Authentication>
  <Scenarios>
    <Scenario Id="Auth" Type="REST">
      <Request Url="https://192.168.25.103:50000/b1s/v1/Login" MessagePasses="0" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <PostValues>
          <Value Key="CompanyDB" Passes="0" Type="String">[CompanyDB]</Value>
          <Value Key="UserName" Passes="0" Type="String">[UserName]</Value>
          <Value Key="Password" Passes="0" Type="String">[Password]</Value>
        </PostValues>
      </Request>
      <Rules>
        <Rule Type="Any">SessionId</Rule>
      </Rules>
      <Variables>
        <Variable Name="AccessToken" Path="SessionId">
          <Filter />
        </Variable>
      </Variables>
    </Scenario>

    <Scenario Id="LookupByPhoneNumber" Type="REST">
      <Request Url="https://192.168.25.103:50000/b1s/v1/BusinessPartners?$filter=Phone1 eq '[Number]'" MessagePasses="0" RequestType="Get" ResponseType="Json">
        <Headers>
          <Header Name="Authorization" Value="Bearer [AccessToken]" />
        </Headers>
      </Request>
      <Rules>
        <Rule Type="Any">CardCode</Rule>
      </Rules>
      <Variables>
        <Variable Name="ContactID" Path="CardCode" />
        <Variable Name="FirstName" Path="CardName" />
        <Variable Name="LastName" Path="CardName" />
        <Variable Name="CompanyName" Path="CardName" />
        <Variable Name="Email" Path="E_Mail" />
        <Variable Name="PhoneBusiness" Path="Phone1" />
        <Variable Name="PhoneMobile" Path="Mobile" />
      </Variables>
      <Outputs AllowEmpty="false">
        <Output Type="ContactID" Value="[ContactID]" />
        <Output Type="FirstName" Value="[FirstName]" />
        <Output Type="LastName" Value="[LastName]" />
        <Output Type="CompanyName" Value="[CompanyName]" />
        <Output Type="Email" Value="[Email]" />
        <Output Type="PhoneBusiness" Value="[PhoneBusiness]" />
        <Output Type="PhoneMobile" Value="[PhoneMobile]" />
      </Outputs>
    </Scenario>
  </Scenarios>
</Crm>

Or possible problem with SSL certificate?
Could the SSL certificate verification have caused problems with authorization? I only have a self certified one and it is an internal IP. I could not find any option in 3CX to disable SSL certificate verification in XML configuration. If anyone knows how to work around or solve SSL certificate issues, I would be grateful for a hint.

Questions:

  1. Has anyone successfully integrated 3CX with SAP B1 via the Service Layer?
  2. What authentication method did you use?
  3. Is there a way to disable SSL certificate checks, or should I be using a specific configuration?
Any advice or insights would be greatly appreciated!
 
Hello everyone,

I’ve been working on integrating 3CX (Version 20, Update 2) with SAP Business One (B1) on HANA (Version 9.3 PL 11) using the SAP Service Layer. My goal is to have 3CX match incoming call numbers with customer data in SAP B1 and display the correct contact information.

System Details:

  • SAP Business One: Version 9.3 PL 11 on HANA
  • 3CX: Version 20, Update 2
What I’ve Tried:

  1. OAuth2 with Password Credentials:
    • I configured the CRM Template Generator for OAuth2. When I click “Authorize,” a new tab opens where I am prompted to enter username and password (via the browser’s Basic Authentication popup). Even though I enter the correct credentials, the prompt keeps reappearing, and I can’t proceed beyond this point.
  2. Basic Authentication:
    • I also tried using Basic Authentication by encoding username:password in Base64 and setting it in the Authorization header. However, this resulted in 3CX rejecting the XML with the error "Invalid file format."
  3. Using a Static Session ID:
    • I generated a session ID via Postman and attempted to use it directly in the XML configuration by adding it as a cookie (B1SESSION=[SessionId]). Once again, 3CX gave the "Invalid file format" error.
Here’s an example of the XML I’ve used:
Code:
<?xml version="1.0"?>
<Crm xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Country="DE" Name="SAP B1 Integration" Version="1" SupportsEmojis="true">
  <Number Prefix="AsIs" MaxLength="20" />
  <Connection MaxConcurrentRequests="2" />
  <Parameters>
    <Parameter Name="CompanyDB" Type="String" Parent="General Configuration" Editor="String" Title="Company Database:" Default="****" />
    <Parameter Name="UserName" Type="String" Parent="General Configuration" Editor="String" Title="Username:" Default="****" />
    <Parameter Name="Password" Type="String" Parent="General Configuration" Editor="Password" Title="Password:" Default="****" />
  </Parameters>
  <Authentication Type="OAuth2">
    <Value>https://192.168.25.103:50000/b1s/v1/Login</Value>
  </Authentication>
  <Scenarios>
    <Scenario Id="Auth" Type="REST">
      <Request Url="https://192.168.25.103:50000/b1s/v1/Login" MessagePasses="0" RequestContentType="application/json" RequestEncoding="Json" RequestType="Post" ResponseType="Json">
        <PostValues>
          <Value Key="CompanyDB" Passes="0" Type="String">[CompanyDB]</Value>
          <Value Key="UserName" Passes="0" Type="String">[UserName]</Value>
          <Value Key="Password" Passes="0" Type="String">[Password]</Value>
        </PostValues>
      </Request>
      <Rules>
        <Rule Type="Any">SessionId</Rule>
      </Rules>
      <Variables>
        <Variable Name="AccessToken" Path="SessionId">
          <Filter />
        </Variable>
      </Variables>
    </Scenario>

    <Scenario Id="LookupByPhoneNumber" Type="REST">
      <Request Url="https://192.168.25.103:50000/b1s/v1/BusinessPartners?$filter=Phone1 eq '[Number]'" MessagePasses="0" RequestType="Get" ResponseType="Json">
        <Headers>
          <Header Name="Authorization" Value="Bearer [AccessToken]" />
        </Headers>
      </Request>
      <Rules>
        <Rule Type="Any">CardCode</Rule>
      </Rules>
      <Variables>
        <Variable Name="ContactID" Path="CardCode" />
        <Variable Name="FirstName" Path="CardName" />
        <Variable Name="LastName" Path="CardName" />
        <Variable Name="CompanyName" Path="CardName" />
        <Variable Name="Email" Path="E_Mail" />
        <Variable Name="PhoneBusiness" Path="Phone1" />
        <Variable Name="PhoneMobile" Path="Mobile" />
      </Variables>
      <Outputs AllowEmpty="false">
        <Output Type="ContactID" Value="[ContactID]" />
        <Output Type="FirstName" Value="[FirstName]" />
        <Output Type="LastName" Value="[LastName]" />
        <Output Type="CompanyName" Value="[CompanyName]" />
        <Output Type="Email" Value="[Email]" />
        <Output Type="PhoneBusiness" Value="[PhoneBusiness]" />
        <Output Type="PhoneMobile" Value="[PhoneMobile]" />
      </Outputs>
    </Scenario>
  </Scenarios>
</Crm>

Or possible problem with SSL certificate?
Could the SSL certificate verification have caused problems with authorization? I only have a self certified one and it is an internal IP. I could not find any option in 3CX to disable SSL certificate verification in XML configuration. If anyone knows how to work around or solve SSL certificate issues, I would be grateful for a hint.

Questions:

  1. Has anyone successfully integrated 3CX with SAP B1 via the Service Layer?
  2. What authentication method did you use?
  3. Is there a way to disable SSL certificate checks, or should I be using a specific configuration?
Any advice or insights would be greatly appreciated!
You cannot use self-signed SSL. Try using plain HTTP instead. If you can't, then you'll have to create a middleware as 3CX will always verify the SSL certificate.
 
You cannot use self-signed SSL. Try using plain HTTP instead. If you can't, then you'll have to create a middleware as 3CX will always verify the SSL certificate.
thank you! I added the SSL to the storage, but that doesn't seem to be it.
 
thank you! I added the SSL to the storage, but that doesn't seem to be it.
Because that doesn't matter, 3CX doesn't use that.
 
Also, this should be like this:

XML:
<Authentication Type="Scenario">
  <Value>Auth</Value>
</Authentication>
 
Status
Not open for further replies.