OSB: Assign a value from $header to variable in error handler - variables

Dear Stackoverflowers,
this is my first post, so I try to do everything correct.
In the error handler of an OSB component, I need to assign a value from the existing $originalHeader to another variable to reuse it, without entering the value as text.
In an assign-action, the expression $originalHeader/privateMetaAttributesHeader/LoggingCategory
for variable originalLoggingCategory does return the below:
Debugging_VariablesScreen
I do not understand why the value of LoggingCategory is not assigned to variable originalLoggingCategory. Please help me out with this.
Content of $originalHeader:
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><v1:privateMetaAttributesHeader xmlns:v1="http://www.example.org/scintilla/meta/v1"><SwingMonitoring>...</SwingMonitoring><LoggingCategory>com.schenker.scintilla.AirOcean.WWTAN.LoadPlanInstructionService.v1</LoggingCategory></v1:privateMetaAttributesHeader></soapenv:Header>
Thanks in advance.
Patrick

There is a difference between <privateMetaAttributesHeader> and <v1:privateMetaAttributesHeader>, which OSB rightly respects.
for instance
$originalHeader/privateMetaAttributesHeader/LoggingCategory may be null
$originalHeader/v1:privateMetaAttributesHeader/v1:LoggingCategory will probably return what you want (try selecting just the header at first, then work your way down to the logging category, just in case LoggingCategory isn't in the v1 namespace)
You can define what namespace 'v1' is in the OSB Proxy Stage, or if you don't know, you can use $originalHeader/*:privateMetaAttributesHeader/*:LoggingCategory but that's not recommended.

Related

Recursive/Exploded uri variable with restlet

Does Restlet support exploded path variable (reference to URI Template RFC)?
An example would be /documents{/path*} where path can be for example "a/b/c/d/e".
This syntax doesn't seem to work with Restlet.
I'm creating a folder navigation api and I can have variable path depth, but I'm trying to have only one resource on the server side to handle all the calls. Is this something I can do with Restlet? I suppose I could create a custom router but if there is another way to do this I would like to know.
Thanks
It is possible to support this using matching modes.
For example:
myRouter.attach("/documents{path}",
MyResource.class).setMatchingMode(Template.START_WITH);
Hope this helps!
I'm doing the following
myRouter.attach("/documents/{path}", MyResource.class).setMatchingMode(Template.START_WITH);
Now I do get inside the resource GET method, but if I request the value of the path variable, I only get the first part (for example, /documents/a/b/c, path returns "a".) I use getRequest().getAttributes().get("path") to retrieve the value. Am I doing something wrong ?
Mathieu

How to use Global Property name in my JSON input request using SoapUI?

I have a SoapUI project which contains around 60 plus services. Each service requires some input which will be changed for every execution. So I have created certain Global Properties and assign some values to that properties.
I have to use these properties values in my SoapUI request ( i.e. JSON Format request ).
If it is groovy script means, I will use like this.
String HTiC_Username = com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils.globalProperties['HTiC_Username'].value;
But, how to get the value of the Global Property in the request?
Hope you understand my question. Please provide proper guidance.
Thanks
To dynamically "expand" (i.e. substitute) the value of a property into a test step, the following syntax is used: ${#scope#propertyName}
...where 'scope' refers to the level at which the property has been defined (e.g. Global, Project, TestSuite, TestCase).
So to expand a property named username defined as a Global property, for example, the following code can be used directly within a Request Test Step (e.g within a JSON body, or header value, etc):
${#Global#username}
To access the same property value within a Groovy Test Step, you can use the following syntax:
context.expand('${#scope#propertyName}')
...as in the following example:
context.expand('${#Global#username}')
What we did was the following:
created a test data file to store all the specific input data for the different services (testdata.properties)
Example content of testdata.properties:
Billing_customerID=1234567
OtherService_paymentid=12121212
....
create a SoupUi global parameter (File/Preferences/Global properties): testdata_filepath=C:\...
For specific services we added a Properties test step. You can specify the "Load from" field to our new global parameter: ${#Global#testdata_filepath} Now you can use the Load button to load parameters.
Finally you can reference the parameter in your xml in the following format: ${Properties#Billing_customerID}
Example content of a service with parameter:
...
<BillingCustomerIdentification>
<BillingCustomerID>${#Properties#Billing_customerID}</BillingCustomerID>
</BillingCustomerIdentification>
...
To set up your projects in this manner also helps to automate service tests eg. using Hudson (see my previous SO answer).
If it is too heavy and automation is not a target, you can simply use ${#Global#someinputvariable} format in your xml ;-)

SetProperty and property in Jmeter

I need to pass Some variable values from one ThreadGroup to another,
For this I am using
${__setProperty(USERNAME, ${USERNAME})}
to set username in ThreadGroup1 (I tried to set this value in User defined variable as well as bean assertion) and use
${__property(USERNAME)}
to fetch this value in ThreadGroup1
but it doesn't work.I set other variables/ properties in same way but they also doesn't seem fetched in ThreadGroup2.
what do I do wrong?
JMeter Plugins has Inter-Thread Communication see http://code.google.com/p/jmeter-plugins/wiki/InterThreadCommunication for this purpose.
There are 2 methods to use it:
PostProcessor/PreProcessor
Functions __fifoPut and __fifoPop
PostProcessor/PreProcessor is easier to use.

Regular expression in While Controller Jmeter

I am using While Controller with Condition:
${_javaScript("${DONE}" ! = "Resolved and Downloaded";)}
where initially DONE="Not Assigned yet".
After few iterations DONE changes and has value Resolved and Downloaded (which I check in Debug Sampler) but loop continues and doesn't quit.
What did I do wrong,What should I do to make it work?
Check syntax of your condition expression first: should be double __ before function name and , instead of ; after condition in function's params list:
${__javaScript("${DONE}"!="Resolved and Downloaded",)}
This can break your test case.
As well you can look into jmeter.log for possible issue details.
${__javaScript("${DONE}"!="Resolved and Downloaded")}
You can try the following using while controller:
${__javaScript(${DONE} !="Resolved and Downloaded")}
You may use if controller.Keeping the if controller as a child of runtime controller.Specify max time in runtime controller.
Under If controller specify the following:
"${DONE}" !="Resolved and Downloaded"

Grails trouble saving object id

id is present in the params but does not save to the db. for example
[book.id:1, comments: good]
comments will save to db but book.id does not.
I need to figure out how to save params.book.id into the db column BOOK_ID that was created from the hasmany/belongsTo relationship.
By default value attribute of each element will be the result of a toString() call on each element. Setting it as optionKey allows the value to be a bean property of each element in the list.
Kindly change the select to
<g:form action="review">
<g:select name="book.id"
from="${item.Book.list()}"
value="${book?.id}"
/>
<g:textField name="bookreview" value="${params?.bookreview}" /><br>
kindly refer the below link
Grail example with optionkey
You have overwritten toString, therefore your books are always rendered by name and not id. If you remove your toString() method you will see the expected results.
If you want your select box work with the name, just add optionValue="name".
Well, it seems that I had misspelled a crucial parameter inside my domain. So the domain was expecting x and it was getting y. Thus the id was always null. It took me a while to spot it, and I was perplexed because I had previously successfully implemented ids in another project. Grails has some jira issues also that make one consider other possibilities, but this time it was my mistake.