Search code examples
variablesheadervariable-assignmentassignosb

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


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


Solution

  • 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.