Using the AquaLogic Service Bus Console
Proxy services are the definitions of services implemented locally on the AquaLogic Service Bus server. Actions allow you to design and configure the message flow in the pipelines, route nodes and branch nodes of a proxy services.
This topic describes how to add actions to stages in pipelines, route nodes, and branch nodes, and describes each of the actions available in AquaLogic Service Bus. It includes the following sections:
The Edit Stage Configuration page enables you to add actions. Actions are the elements of stages in pipelines and route and branch nodes that define the handling of messages as they flow through a proxy service. To learn more about Message Flow, see Overview of Message Flow.
Note: You must create a pipeline pair node and add a stage before you can add actions. To learn more, see Adding a Pipeline Pair Node and Adding a Stage.
The following table lists the actions you can configure for AquaLogic Service Bus message flows, and links you to topics that describe the actions, including how to configure them.
Table 16-1 AquaLogic Service Bus Actions
After you configure an action, you are returned to the Edit Stage Configuration page, which you can use to add additional actions, add branch nodes, add error handlers, update actions, and so on, as described in the following steps.
Table 16-2 Tasks to Use When you Edit Stage Configuration
Table 16-3 Tasks to Use When you Edit Message Flow
Click the appropriate request or response pipeline, then click Add Stage. To learn more, see Adding a Stage. |
|
Click the Proxy Service icon, then click Add Pipeline Pair. Alternatively, click an existing Pipeline Pair Node icon, click Add, then click Add Pipeline Pair. To learn more, see Adding a Pipeline Pair Node. |
|
Click the Pipeline Pair Node icon, click Add, then click Add Route Node. To learn more, see Adding a Route Node. |
|
Paste a route node that you cut or copied from the message flow of another proxy service |
Click the Pipeline Pair Node icon for the pipeline pair you created, then click Paste Route Node. Note: This option is not available if you have not cut or copied a route node. |
Click the Pipeline Pair Node icon, click Add, then click Add Conditional Branch Node. To learn more, see Adding a Conditional Branch Node. |
|
Click the Proxy Service icon, then click Add Service Error Handler. To learn more, see Adding Error Handling for the Proxy Service. |
|
Click the appropriate Stage icon, click Edit, then click Name and Description. |
|
Save the updates and return to the Summary of Proxy Services page |
|
Disregard changes and return to the Summary of Proxy Services page |
|
Click Cancel All. When you confirm that you want to exit the Message Flow, the Summary of Proxy Services page is displayed if you initially clicked the Edit Message Flow icon for the proxy service on that page or the Project View or Folder View pages are displayed if you clicked the Edit Message Flow icon for the proxy service on those pages. |
Note: When you click Save, the Message Flow is updated in the current session. When you have finished making changes to this configuration, from the left navigation pane, click Activate under Change Center. The session ends and the configuration is saved. Alternatively, click Discard at any time during the session to delete the changes you have made so far in the current session.
Note: To learn more about actions, see Modeling Message Flow in AquaLogic Service Bus in the BEA AquaLogic Service Bus User Guide for usage scenarios, design patterns, and best practices.
Update actions include Delete, Rename, Insert, and Replace actions. They are evaluated and executed as follows:
Listing and Locating Proxy Services
Viewing and Changing Proxy Services
Viewing and Changing Message Flow
Use the Assign action to assign the result of an XQuery expression to a context variable.
To configure an Assign action:
Use the Delete action to delete a context variable or all the nodes specified by an XPath expression.The Delete action is one of a set of Update actions. To learn more, see Update Actions.
Alternatively, to delete all nodes selected by an XPath expression, select the radio button associated with the XPath option, then click XPath. The XPath Expression Editor page is displayed. To learn more, see Using the XPath Expression Editor. After you save the expression, enter a context variable in the in variable field. To learn more about context variables, see Message Context.
Use the For Each action to iterate over a sequence of values and execute a block of actions.
To configure a For Each action:
Figure 16-1 The For Each Action Configuration Options
Let us use the values shown in the following figure to describe how the For Each action is executed at run time.
Figure 16-2 Example Configuration for For Each Action
Specifying values for the value, index, and total variables, and for the XPath expression is optional. In other words, if they are not specified when you design the action, you can still activate the session.
Note: For information about the scope of the context variables in For Each actions, see Scope of Variables in the For Each Action and Nested For Each Actions.
The value context variable is only visible inside the For Each action—when the For Each action finishes execution (whether it finishes successfully or with an error), the value variable falls out of scope and is removed from the message context. However, when the For Each action finishes execution, the index and total count variables remain in the context with their last known values. If the For Each action finishes successfully, then the index variable and the total count variable both have the same numeric value—the total number of items in the sequence.
If an error occurs when an iteration is in progress, the value of the index variable is smaller than the value of the total count variable. However, note that during the final iteration, index has the same value as total count. So, if an error occurs and the values in index and total are equal, then you can determine only that the error occurred either in the final iteration or after the For Each action finished successfully.
You can modify any of the variables (value, index, or total) in the Do() loop.
Because the values in the sequence returned as a result of executing the XPath are references to the content of the variable on which the XPath is run (body, in the example in the preceding figure), any updates to the value variable performed by actions in the For Each loop are reflected in the content of body. Consequently, you can perform in-place updates that are more complex than those you can perform with the Insert and Update Actions.
For example, a For Each action configured as shown in the following figure iterates over a sequence of line items in a purchase order and increases the cost of each item by 10%.
Figure 16-3 Example of For Each Action Configuration
At the start of each iteration, the value in the index variable is overwritten with the next index value. In other words, the loop behavior and the number of iterations performed is not affected by any changes that are made in the loop for the value of the index variable.
The total count variable is initialized at the beginning of the For Each action. Consequently, any changes to its value, as a result of actions in the Do() loop, are permanent. However, the loop behavior and the number of iterations performed is not affected by any changes to the value of the total variable.
You can configure nested For Each actions. When you do so, it is recommand that where possible you use unique variable names. If you reuse the variables in nested For Each actions, be aware of the scope of those variables. As described in the preceding section:
Use an If Then action to perform an action or set of actions conditionally, based on the Boolean result of an XQuery expression.
To configure an If Then Action:
The condition you create is used as the test that is executed before the then() clause is entered, per standard if...then logic. To learn more, see Using the XQuery Condition Editor.
Note: Condition actions can be nested. However, there is a nesting limit of 4 cumulative levels in the stage editor. If you attempt to add a 5th level, this nesting action is not displayed. Cumulative levels include all branching actions: If... Then... Conditions, Publish Tables, and Route Tables. For example, you can have 2 levels of conditionals, then a publish table with a route table inside of it, bringing the total to 4 levels. If you attempt to add another conditional action (to the last publish table), it is not displayed.
Use the Insert action to insert the result of an XQuery expression at an identified place relative to nodes selected by an XPath expression. The Insert action is one of a set of Update actions. To learn more, see Update Actions.
To configure an Insert action:
Note: Valid configurations include those in which:
Use the Log action to construct a message to be logged and to define a set of attributes with which the message is logged. This topic includes the following sections:
The Log action allows you to log one or more log messages to the WebLogic Server log each time the stage is executed within a proxy service. One or more instances of a log action can be configured in a message flow.
The contents of the log message can consist of one or more of:
AquaLogic Service Bus uses the non catalog logger APIs to write messages to the WebLogic Server log. The AquaLogic Service Bus Console does not replicate logging configuration functionality provided by the WebLogic Server Administration Console. If you need specific log file configuration, like those described in the following listing, do the configuration through the WebLogic Server Administration Console:
For information about logging in WebLogic Server, see Configuring Log Files and Filtering Log Messages in the WebLogic Server documentation.
Table 16-4 Log Action Severity Levels
Use a Publish action to identify a target service for a message and configure how the message is packaged and sent to that service.This topic includes the following sections:
The following quality of service and scope of the message context information applies to Publish actions and Publish Table actions.
When a message is published to another service as the result of a Publish or Publish Table action, the default quality of service (QoS) is best effort, if the proxy service inbound transport and the outbound publish action use the JMS/XA transport. Best effort meaning that there is no reliable messaging and there is no elimination of duplicate messages—however, performance is optimized. To override the default best effort quality of service attribute, you must set the qualityOfService
in the outbound message context variable ($outbound
). For more information, see Message Context. For information about exactly once reliability, see Adding a Route Node.
For more information about quality of service, see Modeling Message Flow in AquaLogic Service Bus in the BEA AquaLogic Service Bus User Guide.
Each publish request transformation maintains its own local copy of message context. The changes to the predefined context variables in the publish request actions are isolated to that publish endpoint and do not affect subsequent processing by the message flow.
For the purposes of instruction, the following questions about working with the message context in publish actions are asked and answered considering an example scenario in which AquaLogic Service Bus receives a SOAP message with attachments (3 parts: SOAP, text, binary).
No. Any changes you make to an outbound message in a publish action only affect the published message. In other words, the changes you make in the publish action are rolled back before the message flow proceeds to any nodes that follow the stage that contains the publish action in your message flow.
An exception to this rule occurs in the case that you configure a Reply action as one of the Publish request actions. In this case, the message content is not rolled back. In other words the message that was sent as the published message is the one returned to the client as a result of the Reply action being executed. For example, for a case in which the sequence of actions configured in a stage are Assign and Reply as follows:
When this stage is executed at run time, the client receives message_x
in the reply message.
The nature of the message written to the file system depends on the type of your outbound service:
<soap:Envelope>
) as the root part. (For more information, see SOAP Services.)$body
as the root part. (For more information, see XML Services (Non SOAP) and Messaging Services.)You need not set any transport headers. The Content-Type
is set automatically according to the service type. For more information, see Initializing the attachments Context Variable.
To configure a Publish action:
A publish table is a set of routes wrapped in a switch-style condition table. It is a short-hand construct that allows different routes to be selected based upon the results of a single XQuery expression. Use a Publish Table action to identify target services for messages and configure how the messages are packaged and sent to these services.
For information about the default quality of service and the scope of the message context for Publish actions, see Understanding Publish Actions.
Note: There is a nesting limit of 4 cumulative levels in the stage editor. If you attempt to add a 5th level, this nesting action is not displayed. Cumulative levels include all branching actions: If... Then... Conditions, Publish Tables, and Route Tables. For example, you can have 2 levels of conditionals, then a publish table with a route table inside of it, bringing the total to 4 levels. If you attempt to add another conditional (to the last publish table), the conditional is not displayed.
To configure a Publish Table action:
Use the Raise Error action to raise an exception with a specified error code (a string) and description.
To configure a Raise Error action:
To learn more about error handling actions, see Error Messages and Handling.
Use the Rename action to rename elements selected by an XPath expression without modifying the contents of the element. The Rename action is one of a set of Update actions. To learn more, see Update Actions.
To learn more, see Using the XPath Expression Editor.
Use a Replace action to replace a node or the contents of a node specified by an XPath expression. The node or its contents are replaced with the value returned by an XQuery expression.
A Replace action can be used to replace simple values or elements (XQuery expressions cannot return attributes). If the XPath identifies attributes, then the XQuery expression must evaluate to a simple value. An XQuery expression that returns nothing is equivalent to making the identified nodes empty or deleting the identified attributes.
The Replace action is one of a set of Update actions. To learn more, see Update Actions.
To configure a Replace action:
The Reply action can be used in the request, response or error pipeline. You can configure it to result in a reply with success or failure. In the case of failure for SOAP services, a HTTP 500 error is returned. The Reply action specifies that an immediate reply is sent to the invoker.
To learn more about error handling actions, see Error Messages and Handling
For information about using the Reply action as one of the Publish action request actions, see Scope of the Message Context in Publish
Use the Report action to enable message reporting for a proxy service.
AquaLogic Service Bus provides the capability to deliver message data and alerts to one or more reporting providers. Message data can be captured from the body of the message or from any other variables associated with the message, such as header or inbound variables. Alert data contains information about Service Level Agreement (SLA) violations or occurrences that you can configure to monitor proxy services. You can use the message or alert data delivered to the reporting provider for functions such as tracking messages or regulatory auditing.
To receive report messages from either the AquaLogic Service Bus JMS Reporting Provider or a user-defined reporting provider, you must first create a Report action in the message flow for the proxy service. The Report action allows you to extract information from each message and write it to the Reporting Data Stream.
You need not configure a report action for alert reporting. Alert data is always available in the Reporting Data Stream.
You use key value pairs to extract key identifiers from any message context variable or message payload, and ignore the rest of the message. The keys are a convenient way to identify a message. They are displayed as report indexes in the Reporting module. To learn more, see Listing and Locating Messages and Viewing Message Details.
For an example of a Report Action configuration and the data reported on the AquaLogic Service Bus dashboard, see Example Report Action Configuration and Resulting Reporting Data.
Let us take an example in which we configure a Report action on an error handler in a stage. The goal is to report the contents of the fault
context variable in the event of an error—we configure the Report action as shown in the following figure.
Figure 16-4 Example Key Name, Key Value Configuration
Where errorCode
is the key name, and the key value is extracted from the fault
variable using the following XPath: ./ctx:errorCode
Each time this Report action is executed at run time, a message is reported via the Reporting Data Stream. The following figure shows the Message Report Summary page in the AquaLogic Service Bus Console after the Report action configured with the key and value pair described in Figure 16-4 is executed twice.
Figure 16-5 Run Time Results of Executing Report Action
The Resume action is used in error handlers. At run time, this action causes the message flow processing to continue as though no error has occurred. Processing continues after the node or stage in which the error handler is configured. You may need to configure the error handler with compensating logic to set the context variables and message state to correspond with the variable and message state expected by subsequent message flow logic.Configure the compensating logic prior to the Resume action.
This action has no parameters and can only be used in error pipelines. To create a Resume action for your message flow:
To learn more about error handling actions, see Error Messages and Handling.
Use a Service Callout action to configure a synchronous (blocking) call to a proxy or business service that is already registered with AquaLogic Service Bus. This topic includes the following sections:
Service Callouts allow you to make a callout from a proxy service to another service. Input parameters for the called service are constructed from the proxy service message context and outputs from the called service are mapped back to the message context. A service to which call outs are made must have the following characteristics:
Only SOAP document-style, XML (HTTP binding with mime:mimeXml body) and SOAP RPC-style (SOAP 1.1) Web services are supported. SOAP RPC/literal is supported and SOAP RPC/encoded is interpreted as SOAP RPC/literal.
Attachments are not supported.
Note: The endpoint URI for the service to which the callout is being made can be the same as the URI specified by the soap:address
element in the WSDL, but it can be a different URI.
The outbound request uses the AquaLogic Service Bus binding layer to achieve the correct construction of the request payload, based on the service type. Also, WS-Security is supported through the binding layer.
In addition to any transport headers you specify when configuring the Service Callout action, the following headers are automatically added by the AquaLogic Service Bus binding layer:
Content-Type = text/xml + charset
for HTTP/HTTPS servicesThe charset
parameter will be set according to the configuration of the business service.
If you specify a value for the Content-Type
transport header when you configure the Service Callout action, the value you specify will be used, not the default text/xml
value.
SOAPAction
for SOAP document-style or SOAP RPC style HTTP/HTTPS servicesPopulate the context by specifying a service and operation, and enter context variables to bind to the invocation input and output parameters:
The Service Callout action is displayed. It includes a Service link that you can click to select a service.
Warning: You provide only the core payload documents in the input variable—the SOAP package is created for you by AquaLogic Service Bus. In other words, do not wrap the input document with <soap-env:Body>
...</soap-env:Body>
.
For example, when creating a body
input variable that is used for this request parameter, you would define that variable's contents using the following XPath: body/*
(to remove the wrapper soap-env:Body
), not $body
(which results in keeping the soap-env:Body
wrapper).
Warning: You must wrap the input document for the SOAP Request Header with <soap-env:Header>...</soap-env:Header>
.
The drop-down list is populated with all of the predefined header names for the target transport (for example, Content-Type
for HTTP transports, JMSCorrelationID
for JMS transports, and so on). If you enter a header name in the Other field, and that header name is not one of the predefined headers for this service's transport, it becomes a user-header, as defined by the transport specification.
text/xml
) or a complex XQuery or XSLT expression.:Because the AquaLogic Service Bus transport layer defines the XML representation of all headers as string values, the result of any expression is converted to a string before the header value is set. Expressions that return nothing result in the header value being set to the empty string. You cannot delete a header using an expression.
Warning: Not all of the transport headers and metadata that you can specify in this action are honored at run time. That is, the values of certain headers and metadata can be overwritten, or ignored by the AquaLogic Service Bus run time. For information about which headers and metadata for a given transport you can set, and which of those set are honored at run time, see Understanding How the Run Time Uses the Transport Headers' Settings.
Note: In addition to the transport headers you specify, headers are added by the AquaLogic Service Bus binding layer. For more information, see Note About Transport Headers.
For examples that show how variables and message context is used for Service Callouts, see How are Messages Constructed for Service Callouts?
The variable is evaluated at run time to construct the body of the SOAP message sent to the service (in the case of SOAP Document-style services), or the body of the XML message sent in the case of Any XML service types.
Warning: You provide only the core payload documents in the input variable—the SOAP package is created for you by AquaLogic Service Bus. In other words, do not wrap the input document with <soap-env:Body>
...</soap-env:Body>
.
For example, when creating a body
input variable that is used for this request parameter, you would define that variable's contents using the following XPath: body/*
(to remove the wrapper soap-env:Body
), not $body
(which results in keeping the soap-env:Body
wrapper).
ctx:binary-content
element. Warning: You must wrap the input document for the SOAP Request Header with <soap-env:Header>...</soap-env:Header>
.
The drop-down list is populated with all of the predefined header names for the target transport (for example, Content-Type
for HTTP transports, JMSCorrelationID
for JMS transports, and so on). If you enter a header name in the Other field, and that header name is not one of the predefined headers for this service's transport, it becomes a user-header, as defined by the transport specification.
text/xml
) or a complex XQuery or XSLT expression.:Because the AquaLogic Service Bus transport layer defines the XML representation of all headers as string values, the result of any expression is converted to a string before the header value is set. Expressions that return nothing result in the header value being set to the empty string. You cannot delete a header using an expression.
Warning: Not all of the transport headers and metadata that you can specify in this action are honored at run time. That is, the values of certain headers and metadata can be overwritten, or ignored by the AquaLogic Service Bus run time. For information about which headers and metadata for a given transport you can set, and which of those set are honored at run time, see Understanding How the Run Time Uses the Transport Headers' Settings.
Note: In addition to the transport headers you specify, headers are added by the AquaLogic Service Bus binding layer. For more information, see Note About Transport Headers.
For examples that show how variables and message context is used for Service Callouts, see How are Messages Constructed for Service Callouts?
When AquaLogic Service Bus makes a call to a service via a Service Callout action, the content of the message is constructed using the values of variables in the message context. The message content for outbound messages is handled differently depending upon the type of the target service. How the message content is created depends on the type of the target service, as described in the following topics:
In the case of SOAP Document Style services:
To illustrate how messages are constructed during callouts to SOAP Document Style services, take for example a Service Callout action configured as shown in the following figure.
Figure 16-6 Service Callout Action Configuration for a SOAP Document Style Service
Assume also that at run time, the request document variable, myreq
, is bound to the following XML.
Listing 16-1 Content of Request Variable (myreq)
<sayHello xmlns="http://www.openuri.org/">
<intVal>100</intVal>
<string>Hello AquaLogic</string>
</sayHello>
At run time, the SOAP Request Header variable, reqheader
, is bound to the following SOAP header.
Listing 16-2 Content of SOAP Request Header Variable (reqheader)
<soap:Header xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/
xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing">
<wsa:Action>...</wsa:Action>
<wsa:To>...</wsa:To>
<wsa:From>...</wsa:From>
<wsa:ReplyTo>...</wsa:ReplyTo>
<wsa:FaultTo>...</wsa:FaultTo>
</soap:Header>
In this example scenario, the full body of the message sent to the external service is as shown in the following listing (the contents of the myreq
and reqheader variables are shown in bold).
Listing 16-3 Message Sent to the Service as a Result of Service Callout Action
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/
xmlns:wsa="http://schemas.xmlsoap.org/ws/2003/03/addressing">
<wsa:Action>...</wsa:Action>
<wsa:To>...</wsa:To>
<wsa:From>...</wsa:From>
<wsa:ReplyTo>...</wsa:ReplyTo>
<wsa:FaultTo>...</wsa:FaultTo>
</soap:Header>
<soapenv:Body>
<sayHello xmlns="http://www.openuri.org/">
<intVal>100</intVal>
<string>Hello AquaLogic</string>
</sayHello>
</soapenv:Body>
</soapenv:Envelope>
Based on the configuration of the Service Callout action illustrated in the Figure 16-6, the response from the service is assigned to the myresp
variable. The full response from the external service is as shown in the following listing.
Listing 16-4 Response Message From the Service as a Result of Service Callout Action
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.
org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<env:Header/>
<env:Body env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<m:sayHelloResponse xmlns:m="http://www.openuri.org/">
<result xsi:type="xsd:string">This message brought to you by Hello AquaLogic and the number 100
</result>
</m:sayHelloResponse>
</env:Body>
</env:Envelope>
In this scenario, the myresp
variable is assigned the value shown in the following listing.
Listing 16-5 Content of Response Variable (myresp) as a Result of Service Callout Action
<m:sayHelloResponse xmlns:m="http://www.openuri.org/">
<result ns0:type="xsd:string" xmlns:ns0="http://www.w3.org/2001/XMLSchema-instance">
This message brought to you by Hello AquaLogic and the number 100
</result>
</m:sayHelloResponse>
To illustrate how messages are constructed during callouts to XML services, take for example a Service Callout action configured as shown in the following figure.
Figure 16-7 Service Callout Action Configuration for an XML Service
Assume also that at run time, the request document variable, myreq
, is bound to the following XML.
Listing 16-6 Content of myreq Variable
<sayHello xmlns="http://www.openuri.org/">
<intVal>100</intVal>
<string>Hello AquaLogic</string>
</sayHello>
myreq
variable, as shown in the preceding listing.myresp
, is shown in the following listing.Listing 16-7 Content of myresp Variable
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<env:Header/>
<env:Body env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<m:sayHelloResponse xmlns:m="http://www.openuri.org/">
<result xsi:type="xsd:string">This message brought to you by Hello AquaLogic and the number 100
</result>
</m:sayHelloResponse>
</env:Body>
</env:Envelope>
In the case of SOAP RPC Style services:
To illustrate how messages are constructed during callouts to SOAP RPC Style services, take an example with the following configuration:
input1
bound to a value 100 input2
bound to a string value: Hello AquaLogic
.Figure 16-8 Service Callout Action Configuration for a RPC Style Service
In this scenario, the body of the outbound message to the service is shown in the following listing.
Listing 16-8 Content of Outbound Message
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<sayHello2 xmlns="http://www.openuri.org/">
<intVal>100</intVal>
<string >Hello AquaLogic</string>
</sayHello2>
</soapenv:Body>
</soapenv:Envelope>
The response returned by the service to which the call was made is shown in the following listing.
Listing 16-9 Content of Response Message From the helloWorld Service
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<env:Header/>
<env:Body env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<m:sayHello2Response xmlns:m="http://www.openuri.org/">
<result xsi:type="n1:HelloWorldResult" xmlns:n1="java:">
<message xsi:type="xsd:string">
This message brought to you by Hello AquaLogic and the number 100
</message>
</result>
</m:sayHello2Response>
</env:Body>
</env:Envelope>
The message context variable output1
is assigned the value shown in the following listing.
Listing 16-10 Content of Output Variable (output1)
<message ns0:type="xsd:string" xmlns:ns0="http://www.w3.org/2001/XMLSchema-intance">
This message brought to you by Hello AquaLogic and the number 100</message>
In the case of Messaging services:
<binary-content ref=.../>
reference XML.<binary-content ref= ... />
reference XML, regardless of the actual content received.For example, if the request message context variable myreq
is bound to an XML document of the following format: <hello>there</hello>
, the outbound message contains exactly this payload. The response message context variable (myresp)
is bound to a reference element similar to the following:
<binary-content ref=" cid:1850733759955566502-2ca29e5c.1079b180f61.-7fd8"/>
You can configure error handling at the Message Flow, pipeline, route node, and stage level. For information about doing so, see Error Messages and Handling. The types of errors that are received from an external service as the result of a Service Callout include transport errors, SOAP faults, responses that do not conform to an expected response, and so on.
The fault
context variable is set differently for each type of error returned. You can build your business and error handling logic based on the content of the fault
variable. To learn more about $fault
, see Fault Variable and Error Codes.
When a transport error is received from an external service and there is no error response payload returned to AquaLogic Service Bus by the transport provider (for example, in the case that an HTTP 403 error code is returned), the Service Callout action throws an exception, which in turn causes the pipeline to raise an error. The fault variable in a user-configured error handler is bound to a message formatted similarly to that shown in the following listing.
Listing 16-11 Contents of the AquaLogic Service Bus fault Variable—Transport Error, no Error Response Payload
<con:fault xmlns:con="http://www.bea.com/wli/sb/context">
<con:errorCode>BEA-380000</con:errorCode>
<con:reason>Not Found</con:reason>
<con:details>
.......
</con:details>
<con:location>
<con:node>PipelinePairNode1</con:node>
<con:pipeline>PipelinePairNode1_request</con:pipeline>
<con:stage>stage1</con:stage>
</con:location>
</con:fault>
In the case that there is a payload associated with the transport error—for example, when an HTTP 500 error code is received from the business service and there is XML payload in the response—a message context fault is generated with the custom error code: BEA-382502.
The following conditions must be met for a BEA-382502 error response code to be triggered as the result of a response from a service—when that service uses an HTTP or JMS transport:
The ErrorResponseDetail
element in the fault contains error response payload received from the service. The following listing shows an example of the ErrorResponseDetail
element.
Listing 16-12 Contents of the AquaLogic Service Bus fault Variable—Transport Error, with Error Response Payload
<ctx:Fault xmlns:ctx="http://www.bea.com/wli/sb/context">
<ctx:errorCode>BEA-382502<ctx:errorCode>
<ctx:reason> Service callout has received an error response from the server</ctx:reason>
<ctx:details>
<alsb:ErrorResponseDetail xmlns:alsb="http://www.bea.com/...">
<alsb:detail> <![CDATA[
. . .
]]>
</alsb:detail>
</alsb:ReceivedFault>
</ctx:details>
<ctx:location>. . .</ctx:location>
</ctx:Fault>
Note: The XML Schema for the Service Callout-generated fault is shown in XML Schema for the Service Callout-Generated Fault Details.
In case an external service returns a SOAP fault, the AquaLogic Service Bus run time sets up the context variable $fault
with a custom error code and description with the details of the fault. To do so, the contents of the 3 elements under the <SOAP-ENV:Fault> element in the SOAP fault are extracted and used to construct an AquaLogic Service Bus fault element.
Take for example a scenario in which a service returns the following error.
Listing 16-13 SOAP Fault Returned From Service Callout
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>Application Error</faultstring>
<detail>
<message>That's an Error!</message>
<errorcode>1006</errorcode>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The <faultcode>
, <faultstring>
, and <detail>
elements are extracted and wrapped in an <alsb:ReceivedFault
> element. Note that the faultcode
element in Listing 16-13 contains a QName—any related namespace declarations are preserved.
The generated <alsb:ReceivedFault
> element, along with the custom error code and the error string are used to construct the contents of the fault
context variable, which in this example takes a format similar to that shown in the following listing.
Listing 16-14 Contents of the AquaLogic Service Bus fault Variable—SOAP Fault
<ctx:Fault xmlns:ctx="http://www.bea.com/wli/sb/context">
hat's an Error!
<ctx:errorCode>BEA-382500<ctx:errorCode>
<ctx:reason> service callout received a soap Fault response</ctx:reason>
<ctx:details>
<alsb:ReceivedFault xmlns:alsb="http://www.bea.com/...">
<alsb:faultcode
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">SOAP-ENV:Clien
</alsb:faultcode>
<alsb:faultstring>Application Error</alsb:faultstring>
<alsb:detail>
<message>T</message>
<errorcode>1006</errorcode>
</alsb:detail>
</alsb:ReceivedFault>
</ctx:details>
<ctx:location> </ctx:location>
</ctx:Fault>
Note: The unique error code BEA-382500 is reserved for the case when Service Callout actions receive SOAP Fault responses.
When a service returns a response message that is not what the proxy service's run time expects, a message context fault will be generated and initialized with the custom error code BEA-382501. The details of the fault include the contents of the SOAP-Body element of the response.
The XML Schema for the Service Callout-generated fault is shown in Listing 16-15.
The XML schema definition of thje service callout-generated fault datails is shown in the following listing.
Listing 16-15 XML Schema for the Service Callout-Generated Fault Details
<xs:complexType name="ReceivedFaultDetail">
<xs:sequence>
<xs:element name="faultcode" type="xs:QName"/>
<xs:element name="faultstring" type="xs:string"/>
<xs:element name="detail" minOccurs="0" >
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax" />
</xs:sequence>
<xs:anyAttribute namespace="##any" processContents="lax" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="UnrecognizedResponseDetail">
<xs:sequence>
<xs:element name="detail" minOccurs="0" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="ErrorResponseDetail">
<xs:sequence>
<xs:element name="detail" minOccurs="0" type="xs:string" />
</xs:sequence>
</xs:complexType>
How does a Service Callout action differ from a Route Node at run time?
The different behavior of the actions configured on a Route node and the Service Callout actions at run time are primarily as follows:
Messages are sent asynchronously from Route nodes. At run time, the message flow does not block waiting for a response.
Use the Skip action to specify that at run time, the execution of this stage is skipped and the processing proceeds to the next stage in the message flow.
This action has no parameters and can be used in the request, response or fault pipelines. To create a Skip action for your message flow:
Use a Transport Header action to easily set the header values in messages.
The Transport Header action allows you to set header values for outbound requests (the messages sent out by a proxy service in Route or Publish actions) and inbound responses (the response messages a proxy service sends back to clients). This specifies to the run time which of the message context locations are to be modified.
After you specify the header set to be modified, you configure the header values. You set the header values as an unordered table of name and value pairs. The run time declares namespaces and places header elements in their proper order when generating the corresponding XML
To configure a Transport Headers action:
Figure 16-9 Transport Header Action Configuration—Outbound Request, Inbound Response
This is a required field and specifies to the run time whether the header values are to be set for outbound requests (the messages sent out by a proxy service in Route or Publish actions) and inbound responses (the response messages a proxy service sends back to clients).
Selecting Outbound Request or Inbound Response when you configure the Transport Headers action specifies to the run time which of the message context locations are to be modified—these header elements are located in the message context as follows:
$outbound/ctx:transport/ctx:request/tp:headers
$inbound/ctx:transport/ctx:response/tp:headers
Figure 16-10 Inbound/Outbound Request, Inbound/Outbound Response
When you select this option, the Transport Headers action will automatically pass all headers through from the inbound message to the outbound message or vice versa. Every header in the source set of headers will be copied to the target header set, overwriting any existing values in the target header set.
For information about using this option in conjunction with the header-specific pass through option, see About the Global Pass Through and Header-Specific Copy Options.
Figure 16-11 Individual Transport Header Action Configuration Options
The drop-down list is populated with all of the predefined header names for the target transport (for example, Content-Type
for HTTP transports, JMSCorrelationID
for JMS transports, and so on). If you enter a header name in the Other field, and that header name is not one of the predefined headers for this service's transport, it becomes a user-header, as defined by the transport specification.
Selecting this option allows you to use and XQuery or XSLT expression to set the value of the header. The expression can be simple (for example, "text/xml
") or a complex XQuery or XSLT expression.
Because the AquaLogic Service Bus transport layer defines the XML representation of all headers as string values, the result of any expression is converted to a string before the header value is set. Expressions that return nothing result in the header value being set to the empty string. You cannot delete a header using an expression.
Warning: Not all of the header settings you can specify in this action are honored at run time. For information about which of the headers for a given transport you can set, and which of those set are honored at run time, see Understanding How the Run Time Uses the Transport Headers' Settings.
Specifies that the header is removed from the request or response metadata.
Copy Header from Inbound Request (if you are setting transport headers for the Outbound Request—see Figure 16-10)
or
Copy Header from Outbound Response (if you are setting transport headers for the Inbound Response—see Figure 16-10)
Specify that this header is copied directly from the corresponding header of the same name from the inbound message to the outbound message and vice versa. For example, if you want to set the SOAPAction
header for an outbound request, selecting Copy Header from Inbound Request causes the run time to copy the value from the SOAPAction
request header of $inbound
. In the case of inbound response headers, the source of the header to copy is the response headers of $outbound
.
In the event that the Copy Header ... option is selected for a header that does not exist in the source, this option is ignored and no action is performed on the target for this header. In other words, this Copy Header ... option copies only headers that are present in the source to the target.
For information about using this option in conjunction with the global Pass all Headers through Pipeline option, see About the Global Pass Through and Header-Specific Copy Options.
The table is expanded to include an additional row, which includes a new set of options that you can use to configure another transport header.
The preceding figure displays a Transport Headers table with two headers; a different action is specified for each header. You can add as many headers as necessary to this table and remove headers from the table using the delete option associated with that header row in the table. You need not order the headers in the table because the run time declares namespaces and places header elements in their proper order when generating the corresponding XML.
As described in the preceding section, the following options are available when you configure a Transport Headers action:
Warning: Because transport headers are specific to the transport types, it is recommended that the pass-through (or copy) options only be used to copy headers between services of the same transport type. Passing (or copying) headers between services of different transport types can result in an error if the header being passed is not accepted by the target transport. For the same reasons, be careful when you specify a header name using the Set Header option.
Selecting Pass all Headers through Pipeline specifies that at run time, the Transport Headers action passes all headers through from the inbound message to the outbound message or vice versa. Every header in the source set of headers is copied to the target header set, overwriting any existing values in the target header set.
Selecting a Copy Header option specifies that at run time, the Transport Headers action copies the specific header with which this option is associated from the inbound message to the outbound message or vice versa.
Use the options in a way that best suits your scenario. Both options result in the headers in the source header set being copied to the target header set, overwriting any existing value in the target set. Note that the Pass all Headers through Pipeline option is executed before the header-specific Copy Header options. In other words, for a given Transport Headers action configuration, if you select Pass all Headers through Pipeline, there is no need to select the Copy Header option for given headers.
However, you can select Pass all Headers through Pipeline to copy all headers, and subsequently configure the action such that individual headers are deleted by selecting Delete Header for specific headers.
The preceding topics describe how the values of the transport headers for outbound requests (the messages sent out by a proxy service in Route or Publish actions) and inbound responses (the response messages a proxy service sends back to clients) can be configured for Transport Headers actions. In general, the header values can be:
The Transport Headers action allows you to set, delete or pass-through the headers in $inbound
or $outbound
. If you set or delete these header and then log $inbound
or $outbound
, you can see the effects of your changes. However, when the message is sent out, the AquaLogic Service Bus binding layer may modify or remove some headers in $inbound
or $outbound
and the underlying transport may in turn, ignore some of these headers and use its own values. An important distinction is that any modifications done by the binding layer on a header are done directly to $inbound
and $outbound
, whereas modifications done by the transport affects only the message's wire format. For example, although you can specify a value for the outbound Content-Length
header, the binding layer deletes it from $outbound
when sending the message. Consequently, the modification is visible in the response path (for example, you can see the modified value if you log $outbound
). If you set the User-Agent
header in $outbound
, the HTTP transport ignores it and use its own value—however, the value in $outbound
is not changed.
The following table describes the transport headers that are ignored or overwritten at run time and other limitations that exist for specific transport headers.
Table 16-5 Limitations to Transport Header Values You Specify in Transport Header Actions
The AquaLogic Service Bus run time may overwrite these headers in the binding layer when preparing the message for dispatch. If these headers are modified, |
|||
The underlying transport may ignore these headers and use different values when sending the message. Any changes done by the transport will not be reflected in |
|||
Can only be set when the request is with respect to a one-way service. These headers are overwritten at run time if sending to a request/response service1. |
|||
Should be set to the message time-to-live in milliseconds. The resulting value in the message received is the sum of the time-to-live value specified by the client and the GMT at the time of the send or publish2. |
|||
The AquaLogic Service Bus run time sets these headers. In other words, any specifications you make for these headers at design time are overwritten at run time. |
|
|
|
Because IBM MQ does not allow certain properties to be set by a client application, if you set these headers with respect to an IBM MQ destination, a run-time exception is raised. |
|||
These headers cannot be deleted when the Pass all Headers through Pipeline option is also specified. |
|||
No limitations. In other words you can set or delete the header(s)4 for File and FTP transports and your specifications are honored by the AquaLogic Service Bus run time. |
|||
The AquaLogic Service Bus run time sets these headers. In other words, any specifications you make for these headers at design time are overwritten at run time. |
JMSExpiration
header to 1000, and at the time of the send, GMT is 1,000,000 (as a result of System.currentTimeMillis()), the resulting value of the JMSExpiration
property in the JMS message is 1,000,1000Note: The same limitations around setting certain transport headers and metadata are true when you set the the inbound
and outbound
context variables, and when you use the AquaLogic Service Bus Test Console to test your proxy or business services. For more information , see the following topics:
Use a Validate action to validate elements selected by an XPath expression against an XML schema element or a WSDL resource. To configure a Validate action:
Alternatively, to raise an error if the element fails validation against the WSDL or XML schema element, select Raise Error on validation failure.
Note: The Validate action enables you to validate global elements only; AquaLogic Service Bus does not support validation against local elements.