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

Compare with Current View Page History

« Previous Version 20 Next »

This page describes the steps for calling a web service using the SOAP protocol. This page also give you background information on how web services work within the Blueriq architecture. The following steps are required:

Not everything of the WSDL standard is supported. If you find that you have troubles performing one of the following steps, please also check in our Web Services datasheet to see if the service should work.

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). In general, it is advised to use a separate module in order to not mix the domain for the web service with the domain of your business.

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 (the message parts from the WSDL). You use these elements to define what entities, attributes and relation in your domain correspond to concepts in the WSDL and XSD. If the domain model was created automatically in an empty module, then you can skip the configuring these elements, because they are automatically set up correct and directly go to Creating a Service Call.

Schema Set Editor

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). It is good to realize that in general entities that are based on elements in an XSD schema are not singleton.

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

You can add validations on attributes. These are used when exposing Blueriq as a service, and are of no interest when calling another web service.

Soap Service Editor

The Soap Service Editor lets you configure the messages that you want to send to your web service and how you store messages received from the web service. For each operation, the web service 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:

These entities are the only singleton in your domain if you generated your domain automatically. Conceptually, they represent the envelope of your message (remember Chapter 2: Simple Object Access Protocol (SOAP)). You can recognize these entities by their name. They are post fixed with either REQUEST or RESPONSE. These entities have no attributes and only one relation. In the code, Blueriq will start at this singleton, and work its way along the relation to all (indirectly) connected instances while creating the XML for the message. When sending a message, you have to make sure that this relation is set. otherwise the SOAP envelop will be empty.

Creating a Service Call

Now that the web service is configured, you want to call it. To call a web service 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 in this case and the service to call. This can be multiple if more than one service is imported in the same module.

  • 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 web service. If none is provided, the URL in the WSDL is used. You can use this for debugging purposes, and send the service call to your local SoapUI mockservice.

  • Configuration Module: The name of the module where the data mapping is located. You only need to specify this if your domain model is not in the same module as the web service. This parameter is optional.

  • Data Mapping: The name of the data mapping to be executed when this operation is called. This parameter is optional.

  • Username: A possible username, for services with authentication.

  • Password A possible password, for services with authentication.

Using the Web service

After you have created your service call, you can use it inside a flow. The web service 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 web service will store the data as new instances, starting from the singleton response instance. If a data mapping is used, the mapping is executed after the domain module in the web service 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 web service is not correctly initiated. If the web service returns an error message, Blueriq runtime will show an error, because error messages are not supported yet.

  • No labels