By accident I encountered the following behaviour of SoapUI. I wanted to register a username/password combination in SoapUI.
Normally in SoapUI property values are shown as plain text. Here I miss-typed the property for password on purpose:
But see what happens if I correctly type the word "Password":
Apparently if the property contains the word "Password", prefixed with something indicative, it will consider the property as a password field. Cool!
By the way: the phrase "Password" should be the last in the name. For example, if you post-fix the property with "-Dev", like "ContentServerPassword-Dev", the content becomes visible again. In those case, you should phrase it like "ContentServer-Dev-Password".
Tuesday, 21 July 2015
Wednesday, 15 July 2015
Disable Wrap Data Types
Just a moment ago I stumbled on a blog entry of Eric Elsinga about the wrapping of datatypes in Weblogic Datasources, related to the DB-Adapter.
Weblogic wraps objects returned by the database-driver to provide functionality related to debugging, connection utilization tracking and transparent transaction support.
However for some native database objects like BLOBS, CLOBS, ARRAYS etc. this wrapping can affect the performance significantly. When this wrapping is disabled, the application (in our case the DB-Adapter) can work directly on the native objects provided by the Database driver.
To disable the object wrapping do the following:
See also:
Weblogic wraps objects returned by the database-driver to provide functionality related to debugging, connection utilization tracking and transparent transaction support.
However for some native database objects like BLOBS, CLOBS, ARRAYS etc. this wrapping can affect the performance significantly. When this wrapping is disabled, the application (in our case the DB-Adapter) can work directly on the native objects provided by the Database driver.
To disable the object wrapping do the following:
- In the Domain Structure tree, expand Services, then select Data Sources.
- On the Summary of Data Sources page, click the data source name.
- Select the Configuration: Connection Pool tab.
- Scroll down and click Advanced to show the advanced connection pool options.
- In Wrap Data Types, deselect the checkbox to disable wrapping.
- Click Save.
See also:
Wednesday, 8 July 2015
OpenSSL and KeyTool commands
Earlier I wrote an article about message transport security in Oracle B2B. It collects a few usefull Java Keytool and OpenSSL commands to convert and import Certificates.
Today I learned another (from co-worker Joris, thanks).
This is how to get a certificate from an external server.
This is usefull, because in some cases the remote host, maybe a virtual one, where by means of Server Name Indication the specific virtual-host's certificate is to be 'asked', while the actual certificate of the physical host is presented by default. Note that Weblogic (and other JEE Appserver as JBoss, Websphere, Glassfish, etc.) does not support SNI.
I think I should create a blog-entry to collect these usefull commands in one page. However I've found these:
Today I learned another (from co-worker Joris, thanks).
This is how to get a certificate from an external server.
openssl x509 -in <(openssl s_client -connect {remote-host}:443 -prexit 2>/dev/null) -out /tmp/certificate.crt
This is usefull, because in some cases the remote host, maybe a virtual one, where by means of Server Name Indication the specific virtual-host's certificate is to be 'asked', while the actual certificate of the physical host is presented by default. Note that Weblogic (and other JEE Appserver as JBoss, Websphere, Glassfish, etc.) does not support SNI.
I think I should create a blog-entry to collect these usefull commands in one page. However I've found these:
Thursday, 2 July 2015
OSB & MTOM: When to use Include Binary Data by Reference or Value
As can be seen in my blogs of these days, I've been busy with implementing a service using MTOM in OSB. When enabling XOP/MTOM Support you'll have to choose between:
I used the first because I want to process the content in another service on another WLS-Domain. However, in my first service catching the initial request I want to do an XSD validation. And although the rest of the message is valid, the Validate activity raises an exception with the message: 'Element not allowed: binary-content@http://www.bea.com/wli/sb/context in element Bestandsdata....'.
Looking into this problem I came up with this section in the doc, which states that you use 'Include Binary Data by Value' when you want to:
Now, although I want exactly that in the end, I don't want that at this point of the service. I want to transform my message, without the Base64-strings. And I want to encode the data only on my other domain.
So I just want to ignore messages that start with the 'Element not allowed: binary-content@...' messages. To do so I came up with the next expression:
If the expression evaluates to true, then you have in fact an invalid XML-message. In the else branch you can add a Resume to ignore the exception.
This expression might come in handy in other situations as well.
- Include Binary Data by Reference
- Include Binary Data by Value
I used the first because I want to process the content in another service on another WLS-Domain. However, in my first service catching the initial request I want to do an XSD validation. And although the rest of the message is valid, the Validate activity raises an exception with the message: 'Element not allowed: binary-content@http://www.bea.com/wli/sb/context in element Bestandsdata....'.
Looking into this problem I came up with this section in the doc, which states that you use 'Include Binary Data by Value' when you want to:
- transfer your data to a service that does not support MTOM
- validate your message
Now, although I want exactly that in the end, I don't want that at this point of the service. I want to transform my message, without the Base64-strings. And I want to encode the data only on my other domain.
So I just want to ignore messages that start with the 'Element not allowed: binary-content@...' messages. To do so I came up with the next expression:
fn:count($fault/ctx:details/con:ValidationFailureDetail/con:message[not(fn:starts-with(text(),'Element not allowed: binary-content@http://www.bea.com/wli/sb/context in element Bestandsdata'))])>0Add an If-Then-Else activity to your Error Handler Stage with this expression. Add the following Namespace:
- Prefix: con
- Namespace: http://www.bea.com/wli/sb/stages/transform/config
If the expression evaluates to true, then you have in fact an invalid XML-message. In the else branch you can add a Resume to ignore the exception.
This expression might come in handy in other situations as well.
Set environment properties in SoapUI (freeware)
Ever used SoapUI to test services on multiple environments? Then you probably ran in to the job of ever changing the endpoints to the hosts of the particular environment; development, test, acceptance, production (although I expect you wouldn't use SoapUI against a prod-env). This is not that hard if you have only one service endpoint in the project. But what if you want to test against multiple services or have to call a service on one system with the result of the other during a testcase. You can even have testcases that mock services called by your (BPEL/BPM) process and call back the process to have it process to a further stage. And then you can end up having multiple endpoints per environment.
You can set multiple endpoints on a request and toggle between them. But you'll have to do that for every request.
SoapUI however, supports the use of properties in the endpoints. So you can setup different host-properties and URI properties on the project:
In this case you see that I have one property for the Service URI, the part of the URL after the host:port, and several ...Host properties for each seperate environment, and one actual.
As said, you can have a property based endpoint like this:
So I have one single endpoint defined based on:
Now you could manually copy and paste the host of the particular environment to the actual host property, but that can be error prone when dealing with multiple endpoints.
What I did was to create a seperate TestSuite called 'ProjectSettings'. In there I created a testcase per environment: 'SetLocalHosts', SsetDevHosts', etc. In there I created a PropertyTransfer that transfers the particular env-host-property to the actual host-property:
You can create a property transfer for each applicable host in your environment. You can enhance the testcase with particular groovyscripts to determine the properties on run-time. You could even call a generic TestCase from there.
Running the particular testcase before your tests will setup your SoapUI project for the target environment in one go.
Maybe I'll enhance this further in my projects, but for now I find this neat. However, it would have been nice if SoapUI would support different environments with hostnames/urls applicable for that environment. And that you could select a target-environment on project level using a poplist.
Also it would be nice to have custom scripts (like macro's) on project level, that could be coupled to a button in the button bar, in stead of how I do it above.
You can set multiple endpoints on a request and toggle between them. But you'll have to do that for every request.
SoapUI however, supports the use of properties in the endpoints. So you can setup different host-properties and URI properties on the project:
In this case you see that I have one property for the Service URI, the part of the URL after the host:port, and several ...Host properties for each seperate environment, and one actual.
As said, you can have a property based endpoint like this:
So I have one single endpoint defined based on:
http://${#Project#CSServiceHost}/${#Project#CSServiceURI}Here you see that the endpoint is based on two properties: ${#Project#CSServiceHost} and ${#Project#CSServiceURI}. In those properties '#Project#' refers to the level in SoapUI the properties are defined. You can also refer to #TestSuite#, #TestCase#, etc.
Now you could manually copy and paste the host of the particular environment to the actual host property, but that can be error prone when dealing with multiple endpoints.
What I did was to create a seperate TestSuite called 'ProjectSettings'. In there I created a testcase per environment: 'SetLocalHosts', SsetDevHosts', etc. In there I created a PropertyTransfer that transfers the particular env-host-property to the actual host-property:
You can create a property transfer for each applicable host in your environment. You can enhance the testcase with particular groovyscripts to determine the properties on run-time. You could even call a generic TestCase from there.
Running the particular testcase before your tests will setup your SoapUI project for the target environment in one go.
Maybe I'll enhance this further in my projects, but for now I find this neat. However, it would have been nice if SoapUI would support different environments with hostnames/urls applicable for that environment. And that you could select a target-environment on project level using a poplist.
Also it would be nice to have custom scripts (like macro's) on project level, that could be coupled to a button in the button bar, in stead of how I do it above.
Wednesday, 1 July 2015
OSB11g what is the scope of the for-each loop variable?
Earlier I wrote an article on the strange behaviour of the OSB11g For-each activity (Osb-11g: for each is index-variable an integer?). Today I found out some other peculiar behaviour.
I had to loop over a sequence of documents, each refering to an attachment. The first document processed well, but at the second iteration the attachment couldn't be found. At first I used Soap with Attachments and now I changed my service to use MTOM. Anyway, at first I thought it to be a SoapUI problem. But adding debug-alerts (I find alerts more comfortable then logs) showed me that the second attachment is really referred to in the message. So apparently, it's not a SoapUI problem.
What happened? Well, have the following for-each:
So I loop over a bunch of documents and at each iteration I'll get the particular document in the document variable. Then I get the attachment, transfer it into a base64-encoded-string, and replace the content with the base64-encoded-string, ... , in the $document variable!!!!! Is that wrong? Well, I expected that in the next iteration the $document variable would be replaced by the new occurrence. But apparently changing the for-each-variable will change the scope of the variable and makes it a 'normal' variable, instead of the loop variable. And since I replaced the contents, It did not have the reference to the next attachment. The quick fix I did was to copy the loop variable to a seperate variable using an assign and then do the changes on that next variable. Each new iteration the content of that variable is overwritten by the assing of the new iteration-variable.
But better is probably to use the index variable and do the changes directly on the main variable, in my case $documents.
So conclusion? Don't change the loop variable!
UPDATE: Oh, by the way, the reason that I change a seperate variable during the loop was that it apparently is not possible to do a Replace or Insert within a loop upon using the index variable. You'll get an error like: 'XQuery exception: line 34, column 11: {err}XP0008 [{bea-err}XP0008a]: Variable
"$documentIndex" used but not declared for expression: declare namespace jca =
'http://www.bea.com/wli/sb/transports/jca';... ' in the expression. So what I did was to copy the document-array from the body variable to a $documents variable, delete all the documents in the body variable (leaving the documents-element). Then loop over the $documents variable, create a new $documentNew variable from $document with the changed variables and insert that in the body variable again.
I had to loop over a sequence of documents, each refering to an attachment. The first document processed well, but at the second iteration the attachment couldn't be found. At first I used Soap with Attachments and now I changed my service to use MTOM. Anyway, at first I thought it to be a SoapUI problem. But adding debug-alerts (I find alerts more comfortable then logs) showed me that the second attachment is really referred to in the message. So apparently, it's not a SoapUI problem.
What happened? Well, have the following for-each:
So I loop over a bunch of documents and at each iteration I'll get the particular document in the document variable. Then I get the attachment, transfer it into a base64-encoded-string, and replace the content with the base64-encoded-string, ... , in the $document variable!!!!! Is that wrong? Well, I expected that in the next iteration the $document variable would be replaced by the new occurrence. But apparently changing the for-each-variable will change the scope of the variable and makes it a 'normal' variable, instead of the loop variable. And since I replaced the contents, It did not have the reference to the next attachment. The quick fix I did was to copy the loop variable to a seperate variable using an assign and then do the changes on that next variable. Each new iteration the content of that variable is overwritten by the assing of the new iteration-variable.
But better is probably to use the index variable and do the changes directly on the main variable, in my case $documents.
So conclusion? Don't change the loop variable!
UPDATE: Oh, by the way, the reason that I change a seperate variable during the loop was that it apparently is not possible to do a Replace or Insert within a loop upon using the index variable. You'll get an error like: 'XQuery exception: line 34, column 11: {err}XP0008 [{bea-err}XP0008a]: Variable
"$documentIndex" used but not declared for expression: declare namespace jca =
'http://www.bea.com/wli/sb/transports/jca';... ' in the expression. So what I did was to copy the document-array from the body variable to a $documents variable, delete all the documents in the body variable (leaving the documents-element). Then loop over the $documents variable, create a new $documentNew variable from $document with the changed variables and insert that in the body variable again.