Web Services (Old)

Web services are used for inbound integration between customer systems and Pricefx. They are part of IntegrationManager. 

Supported Object Types

The following PFX objects are currently supported:

  • customer

  • customerExtension

  • product

  • productExtension

  • pricingParameter

  • datamart

  • rebateRecords

  • payoutRecords

Methods

Each object type has the following methods:

  • loaddata – This command is a very efficient and quick way to load bulk data. The main benefit is its vastly greater speed to load thousands of rows (compared to e.g. integrate). The limit of records is 50 000 per request. All records in payload need to contain same set of attributes. This command only works on selected data types (type codes).

  • integrate – This command performs an upsert operation of selected backend objects. This operation is not available for all types of objects. This command is particularly useful in a situation where the caller does not (and should not) know about typed IDs and other “internal” data fields, i.e. typically in an integration scenario. The only mandatory pre-requisite for this command is that the object’s defined business key fields (vary per object type) are present in every request. No typed ID or version fields are required. This also means that no version checking is performed, thus the request will overwrite existing data of that record regardless of other changes.

  • fetch – This command is used to fetch data from Pricefx.

Another difference between loaddata and integrate is that all items in the loaddata body need to have same set of attributes. You cannot send one product with attribute1 and another product with attribute2. 

Enable Web Services

To enable the web services, add the packageScan element in camel-context or as @ComponentScan at Application.java class.

<bean id="basicAuthValidator" class="net.pricefx.integration.route.ws.interceptor.BasicAuthInterceptor"> <property name="username" value="${ws.username}"/> <property name="password" value="${ws.password}"/> </bean> <cxf:bus> <cxf:inInterceptors> <ref bean="basicAuthValidator"/> </cxf:inInterceptors> </cxf:bus> <camelContext xmlns="http://camel.apache.org/schema/spring" useMDCLogging="true"> <packageScan> <package>net.pricefx.integration.route.ws</package> </packageScan> <contextScan/> </camelContext>

Configure Web Services

There are two ways to configure web services: using a Spring configuration or Auto Configuration. 

Spring Configuration

This is an older method of configuring web services. You put the following keys and their values in the application.properties file:

  • ws.url – default is http://0.0.0.0:9000/webservices/

  • ws.username

  • ws.password

Auto Configuration 

Class

Bean Name

Description

Class

Bean Name

Description

net.pricefx.integration.route.ws.ProductRoute

productRoute

 

net.pricefx.integration.route.ws.CustomerRoute

customerRoute

 

net.pricefx.integration.route.ws.ProductExtensionRoute

productExtensionRoute

 

net.pricefx.integration.route.ws.CustomerExtensionRoute

customerExtensionRoute

 

net.pricefx.integration.route.ws.PricingParameterRoute

pricingParameterRoute

 

net.pricefx.integration.route.ws.DatamartRoute

datamartRoute

 

net.pricefx.integration.route.ws.RebateRecordRoute

rebateRecordRoute

 

net.pricefx.integration.route.ws.PayoutRecordRoute

payoutRecordRoute

 

net.pricefx.integration.route.ws.interceptor.BasicAuthInterceptor

basicAuthValidator

 

org.apache.cxf.bus.spring.SpringBus

cxf

 

 

Property

Default Value

Description

Property

Default Value

Description

integration.webservices.enabled

true

If false, web services do not start automatically

integration.webservices.username

 

User name for web services authentication

integration.webservices.password

 

Password for web services authentication

ws.url

http://0.0.0.0:9000/webservices/

 

ws.payloadBackupDirectory

/var/pricefx/data/{{pfx.partition}}/messages

Directory used for storing incoming XML payloads. Invalid XML payloads are stored in /error subdirectory.

ws.fileNamePattern

${exchangeId}

Camel simple expression

ws.useObjectTypePrefix

false

 

ws.useSingleThread

false

This parameter should solve problem with duplicates records created by integrate method. When it is set to true, only one thread is used and possibility to create duplicates is limited.

ws.continuationTimeout

30000

 

Custom Mapper (from 1.1.18.1)

You can define a customer mapper for each web service. 

Property

Description

Property

Description

ws.loaddataMapper.{objectType}.{id}

Name of the mapper in the application context

ws.integrateMapper.{objectType}.{id}

Name of the mapper in the application context

 

ws.loaddataMapper.P=productMapper ws.loaddataMapper.PX.Costs=pxCostsMapper ws.loaddataMapper.MLTV3.12121=sizePricingParameterMapper ws.loaddataMapper.MLTV3.Size=sizePricingParameterMapper ws.loaddataMapper.DMDS.PriceHistory=dmdsPriceHistoryMapper

Post Processing

If you need to execute a specific action after a web service was processed, you can add the property integration.webservices.postProcessRoute=your route into your properties file.

Publish Web Services

To publish the web services, you need to configure the Apache server and handle the authentication. 

Apache Server Setup

If you want to open the access to web services to customers/partners, you need to configure the Apache server. 

Do not configure SSL in Camel. It is done by Apache configuration.

Go to a server where IntegrationManager is deployed and set the following:

Example file /etc/apache2/sites-available/000-pricefx-ssl.conf

URL for customers

Example file /etc/apache2/sites-available/000-pricefx-ssl.conf

URL for customers

ProxyPass /webservices/ http://0.0.0.0:9000/webservices/

https://servername.pricefx.eu/webservices/

Authentication

The backend operates in a stateless manner. This means that no request depends on any other data outside the request itself or any previous requests. The server does not store any vital information in the server-side session. Therefore every request must contain authentication information. The form depends on the API version you use.

Authentication can be done by a standard HTTP auth header or as a session cookie. To help the implementation, the backend also supports session cookies that any command call will generate if it is not present before. So calling the login command is not really a requirement. The cookie is effectively an authentication token if the user’s credentials cannot or should not be sent with every request. The authentication per request utilizes the standard HTTP-AuthHeader mechanism. 

Add this header to the request:

Authorization: "Basic {base64 encoded credentials}"

WSDL

After IntegrationManager starts, the web services are available at:

Web services

WSDL from internal network

WSDL for customers

Web services

WSDL from internal network

WSDL for customers

customer

http://0.0.0.0:9000/webservices/customer?wsdl

https://servername.pricefx.eu/webservices/customer?wsdl

customerExtension

http://0.0.0.0:9000/webservices/customerExtension?wsdl

https://servername.pricefx.eu/webservices/customerExtension?wsdl

product

http://0.0.0.0:9000/webservices/product?wsdl

https://servername.pricefx.eu/webservices/product?wsdl

productExtension

http://0.0.0.0:9000/webservices/productExtension?wsdl

https://servername.pricefx.eu/webservices/productExtension?wsdl

pricingParameter

http://0.0.0.0:9000/webservices/pricingParameter?wsdl

https://servername.pricefx.eu/webservices/pricingParameter?wsdl

datamart

http://0.0.0.0:9000/webservices/datamart?wsdl

https://servername.pricefx.eu/webservices/datamart?wsdl

rebateRecord

http://0.0.0.0:9000/webservices/rebateRecord?wsdl

https://servername.pricefx.eu/webservices/rebateRecord?wsdl

payoutRecord

http://0.0.0.0:9000/webservices/payoutRecord?wsdl

https://servername.pricefx.eu/webservices/payoutRecord?wsdl

 

Sample payload

Soap Request Examples

Products loaddata
Products integrate

 

Products fetch

IntegrationManager version 5.8.0