You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

This page goes threw the steps that you need to follow in order to be able to call a web service using the SOAP protocol. This page also give you background information you need to understand how web service work within the Blueriq architecture. 4 steps are required:

Importing

Because a SOAP service is neatly defined within a WSDL, it is possible to import such a WSDL file in Blueriq. Go to File → Import → Import WSDL and provide the location of the WSDL file. If you have multiple files (for example: your WSDL is importing/including an XSD schema) then provide a zip file with all needed files. Select the project for the import and you can choose whether to create a new module, or overwrite an existing one. The option 'Generate Domain' will automatically generate domain for you, based on the XSD schema referred to from the WSDL. When this button is checked, entities, attributes and relations are created based on the type definitions of the XSD. When using an existing module, there may already be a domain present, that uses identical names as in the XSD. When overwriting, conflicting elements are not created. Obviously, these problems do not occur if you use a new module. When 'Generate Domain' is unchecked, no domain is generated for you. In that case, you can later match the elements from the XSD to you own domain (explained later).

After you press the import button, you can choose which operations should be imported. These operations originate from the WSDL. You should only import the operations that you need, as the created domain will be smaller then.

You should get the message that the import was successful.

Mapping with Domain Model

Open your project and go the (possible newly-created) module which contains the web service. The module now has a Schema Set and a Soap Service. These can be found in the bar on the left side of the screen, as can be seen below.

The Schema Set defines which entities, attributes and relations are used by the webservice (they map the XSD to the domain model). The Soap Service defines which entities are sent. If the domain model was created automatically, then you can skip the following step, and directly go to Creating a Service Call.

Open the Schema Set, and unfold the schema. You can choose which entity is mapped to this type in XSD schema, as can be seen below. In this case, the anonymous complex type of the element “add” in the XSD schema is mapped to the entity “add” in the domain model (the red box).

When choosing simple elements, you can choose to which attributes they map. See below. Mapping relations works in a similar way.

For each operation, the webservice needs two singleton entities: a Request entity and a Response entity, which will be used to create the message. When you create the domain automatically, you will find these along with the other entities of the domain. You can use the soap service editor to create mappings for these, if you did not create the domain automatically, see below:

Creating a Service Call

To call a webservice in studio, you need to create a service call. Chooses the AQ_WebServiceClient from the list of available service calls (do not forget to import the Blueriq library). Every operation in the WSDL needs its own service call.

Here you can define several attributes.

  • Service Module: The module in which the service is located.
  • Service: Select SOAP or REST service and select which service to call.
  • Operation: This is the name of the operation which is going to be executed. You can look up the name in the WSDL.
  • Url: The URL of the webservice. If none is provided, the URL in the WSDL is used.
  • Configuration Module: The name of the module where the datamapping is located. You need to specify this if your domain model is not in the same module as the webservice.
  • Data Mapping: The name of the data mapping to be executed when this operation is called.
  • Username: A possible username, for services with logins.
  • Password A possible password, for services with logins.

Using the Web service

After you have created your service call, you can use it inside a flow. The webservice throws a default event. When the service is executed, it will read the needed data from the domain model, starting from the singleton request instance. After receiving an answer from the server, the webservice will store the data in the domain model, starting from the singleton response instance. All data in these instances will be overwritten. If a data mapping is used, the mapping is executed after the domain module in the webservice module is filled. A common error is that an empty message is sent to the server. The reason for this is that the domain model for the webservice is not correctly initiated. If the webservice returns an error message, Blueriq runtime will show an error, because error messages are not supported yet.

  • No labels