Example SOAP service request

You need a valid Access Token before accessing the 2BA web services.

  1. one time: Acquire the Refresh- and Access Token using OAuth2 Flow1 (Resource Owner Password Credentials Grant) or OAuth2 Flow2 (Authorization Code). Store the Tokens.
  2. continuously: Only(!) retrieve the access token if expired using the Refresh Token service (Refresh Access Token Service). Store the Access Token.
  3. Invoke the desired service, supplying the Access Token in the request header:
private void GetProductSoap()
{
	ProductDetailsResult result = null;
	// ProductClient is the generated SOAP Service Client
	var productService = new ProductClient();
	using (var scope = new OperationContextScope(productService.InnerChannel))
	{
		var httpRequestProperty = new HttpRequestMessageProperty();
		httpRequestProperty.Headers.Add("Authorization", "Bearer" + " " + _accessToken);
		OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = httpRequestProperty;
		result = productService.GetDetails(txtGTIN.Text, "EN");
	}
	if (result != null)
	{
		txtId.Text = result.ID;
		txtManufacturerGLN.Text = result.ManufacturerGLN;
		txtManufacturerName.Text = result.ManufacturerName;
	}
	else
	{
		MessageBox.Show(@"Not found!");
	}
}

This site is registered on wpml.org as a development site.