Blog Archive

Wednesday, December 24, 2014

IBM websphere MQ explorer Queue creation and CCDT configuration in SAP PI

Om



1. Installation IBM websphere MQ series in my local system.
2.Created Queue Manager name PDP1




As shown in below, we can see the listener also at 1414



Created Queue name PDP1








Created another queue name pdp2


Finally captured, my all settings in single file(TAB file, which have information of both two queues), I will copy this file and place in SAP PI server at specific directory.





I have configured my receiver communication channel in SAP PI as follows.










finally, if any one of the queue is stopped, messages will move to another queue name and vice versa, finally, if one of the queue stopped, message goes another queue.( Like this we achieved high availability in SAP PI 


reference: 
http://scn.sap.com/people/anandan.krishnamoorthy/blog/2010/06/08/high-availability-in-jms-adapter

Tuesday, December 23, 2014

String to String escape in SAP PI and other useful format free

Om

handling double quote string in SAP PI udf


Quick selection of lines in Notepad++ for programming

Om


using regular expression in notepad++ ( start lines selection and end lines section)
useful for java, abap, xslt programmers and comparing files



Single-character matches



., \c

Matches any character. If you check the box which says ". matches newline", the dot will indeed do that, enabling the "any" character to run over multiple lines. With the option unchecked, then . will only match characters within a line, and not the line ending characters (\r and \n)

\X

Matches a single non-combining characer followed by any number of combining characters. This is useful if you have a Unicode encoded text with accents as separate, combining characters.


This allows you to use a character Г that would otherwise have a special meaning. For example, \[ would be interpreted as [ and not as the start of a character set. Adding the backslash (this is called escaping) works the other way round, as it makes special a character that otherwise isn't. For instance, \d stands for "a digit", while "d" is just an ordinary letter.

Non ASCII characters



\xnn

Specify a single chracter with code nn. What this stands for depends on the text encoding. For instance, \xE9 may match an é or a θ depending on the code page in an ANSI encoded document.

\x{nnnn}

Like above, but matches a full 16-bit Unicode character. If the document is ANSI encoded, this construct is invalid.

\Onnn

A single byte character whose code in octal is nnn.

[[.collating sequence.]]

The character the collating sequence stands for. For instance, in Spanish, "ch" is a single letter, though it is written using two characters. That letter would be represented as [[.ch.]]. This trick also works with symbolic names of control characters, like[[.BEL.]] for the character of code 0x07. See also the discussion on character ranges.

Control characters



\a

The BEL control character 0x07 (alarm).

\b

The BS control character 0x08 (backspace). This is only allowed inside a character class definition. Otherwise, this means "a word boundary".

\e

The ESC control character 0x1B.

\f

The FF control character 0x0C (form feed).

\n

The LF control character 0x0A (line feed). This is the regular end of line under Unix systems.

\r

The CR control character 0x0D (carriage return). This is part of the DOS/Windows end of line sequence CR-LF, and was the EOL character on Mac 9 and earlier. OSX and later versions use \n.

\R

Any newline character.

\t

The TAB control character 0x09 (tab, or hard tab, horizontal tab).

\Ccharacter

The control character obtained from character by stripping all but its 6 lowest order bits. For instance, \C1, \CA and \Ca all stand for the SOH control character 0x01.

Ranges or kinds of characters



[...]

This indicates a set of characters, for example, [abc] means any of the characters a, b or c. You can also use ranges, for example[a-z] for any lower case character. You can use a collating sequence in character ranges, like in [[.ch.]-[.ll.]] (these are collating sequence in Spanish).

[^...]

The complement of the characters in the set. For example, [^A-Za-z] means any character except an alphabetic character. Care should be taken with a complement list, as regular expressions are always multi-line, and hence [^ABC]* will match until the first A,B or C (or a, b or c if match case is off), including any newline characters. To confine the search to a single line, include the newline characters in the exception list, e.g. [^ABC\r\n].

[[:name:]]

The whole character class named name. Most of the time, there is a single letter escape sequence for them - see below.

Recognised classes are:

alnum : ASCII letters and digits

alpha : ASCII letters

blank : spacing which is not a line terminator

cntrl : control characters

d , digit : decimal digits

graph : graphical character

l , lower : lowercase letters

print : printable characters

punct : punctuation characters: , " ' ? ! ; : # $ % & ( ) * + - / < > = @ [ ] \ ^ _ { } | ~

s , space : whitespace

u , upper : uppercase letters

unicode : any character with code point above 255

w , word : word character

xdigit : hexadecimal digits

\pshort name,\p{name}

Same as [[:name:]]. For instance, \pd and \p{digit} both stand for a digit, \d.

\Pshort name,\P{name]

Same as [^[:name:]] (not belonging to the class name).

Note that Unicode categories like in \p{Sc} or \p{Currency_Symbol}, they are flagged as an invalid regex in v6.3.2. This is because support would draw a large library in, which would have other uses.

\d

A digit in the 0-9 range, same as [[:digit:]].

\D

Not a digit. Same as [^[:digit]].

\l

A lowercase letter. Same as [a-z] or [[:lower:]].

NOTE: this will fall back on "a word character" if the "Match case" search option is off.

\L

Not a lower case letter. See note above.

\u

An uppercase letter. Same as [[:uper:]]. See note about lower case letters.

\U

Not an uppercase letter. Same note applies.

\w

A word character, which is a letter, digit or underscore. This appears not to depend on what the Scintilla component considers as word characters. Same as [[:word:]].

\W

Not a word character. Same as :alnum: with the addition of the underscore.

\s

A spacing character: space, EOLs and tabs count. Same as [[:space:]].

\S

Not a space.

\h

Horizontal spacing. This only matches space, tab and line feed.

\H

Not horizontal whitespace.

\v

Vertical whitespace. This encompasses the The VT, FF and CR control characters: 0x0B (vertical tab), 0x0D (carriage return) and 0x0C (form feed).

\V

Not vertical whitespace.

[[=primary key=]]

All characters that differ from primary key by case, accent or similar alteration only. For example [[=a=]] matches any of the characters: a, À, Á, Â, Ã, Ä, Å, A, à, á, â, ã, ä and å.

Multiplying operators



+

This matches 1 or more instances of the previous character, as many as it can. For example, Sa+m matches Sam, Saam, Saaam, and so on. [aeiou]+ matches consecutive strings of vowels.

*

This matches 0 or more instances of the previous character, as many as it can. For example, Sa*m matches Sm, Sam, Saam, and so on.

?

Zero or one of the last character. Thus Sa?m matches Sm and Sam, but not Saam.

*?

Zero or more of the previous group, but minimally: the shortest matching string, rather than the longest string as with the "greedy" * operator. Thus, m.*?o applied to the text margin-bottom: 0; will match margin-bo, whereas m.*o will match margin-botto.

+?

One or more of the previous group, but minimally.

{n}

Matches n copies of the element it applies to.

{n,}

Matches n' or more copies of the element it applies to.

{m,n}

Matches m to n copies of the element it applies to, as much it can.

{n,}?,{m,n}?

Like the above, but match as few copies as they can. Compare with *? and friends.

*+,?+,++,{n,}+,{m,n}+

These so called "possessive" variants of greedy repeat marks do not backtrack. This allows failures to be reported much earlier, which can boost performance significantly. But they will eliminate matches that would require backtracking to be found.

Example: matching ".*" against "abc"x will find "abc", because

" then abc"x then $ fails

" then abc" then x fails

" then abc then " succeeds.

However, matching "*+" against "abc"x will fail, because the possessive repeat factor prevented backtracking. 

Anchors



Anchors match a position in the line, rather than a particular character. 

^

This matches the start of a line (except when used inside a set, see above).

$

This matches the end of a line.

\<

This matches the start of a word using Scintilla's definitions of words.

\>

This matches the end of a word using Scintilla's definition of words.

\b

Matches either the start or end of a word.

\B

Not a word boundary.

\A, \'

The start of the matching string.

\z, \`

The end of the matching string.

\Z

Matches like \z with an optional sequence of newlines before it. This is equivalent to (?=\v*\z), which departs from the traditional Perl meaning for this escape.

Groups



(...)

( )

 can be re-used as a backreference or as part of a replace operation; see Substitutions, below.

Groups may be nested.

(?<some name>...), (?'some name'...),(?(some name)...)

Names this group some name.

\gn , \g{n}

The n-th subexpression, aka parenthesised group. Uing the second form has some small benefits, like n being more than 9, or disambiguating when n might be followed by digits. When n' is negative, groups are counted backwards, so that \g-2 is the second last matched group.

\g{something},\k<something>

The string matching the subexpression named something.

\digit

Backreference: \1 matches an additional occurence of a text matched by an earlier part of the regex. Example: This regular expression: ([Cc][Aa][Ss][Ee]).*\1 would match a line such as Case matches Case but not Case doesn't match cASE. A regex can have multiple subgroups, so \2, \3, etc can be used to match others (numbers advance left to right with the opening parenthesis of the group). So \n is a synonym for \gn, but doesn't support the extension syntax for the latter.

Readability enhancements



(:...)

A grouping construct that doesn't count as a subexpression, just grouping things for easier reading of the regex.

(?#...)

Comments. The whole group is for humans only and will be ignored in matching text.

Using the x flag modifier (see section below) is also a good way to improve readability in complex regular expressions. 

Search modifiers



The following constructs control how matches condition other matches, or otherwise alter the way search is performed. For those readers familiar with Perl, \G is not supported. 

\Q

Starts verbatim mode (Perl calls it "quoted"). In this mode, all characters are treated as-is, the only exception being the \E end verbatim mode sequence.

\E

Ends verbatim mode. Ths, "\Q\*+\Ea+" matches "\*+aaaa".

(?:flags-not-flags ...), (?:flags-not-flags:...)

Applies flags and not-flags to search inside the parentheses. Such a construct may have flags and may have not-flags - if it has neither, it is just a non-marking group, which is just a readability enhancer. The following flags are known:

   i : case insensitive (default: off) 

   m : ^ and $ match embedded newlines (default: as per ". matches newline") 

    s: dot matches newline (default: as per ". matches newline") 

    x: Ignore unescaped whitespace in regex (default: off) 

(?|expression using the alternation | operator)

If an alternation expression has subexpressions in some of its alternatives, you may want the subexpression counter not to be altered by what is in the other branches of the alternation. This construct will just do that.

For example, you get the following subexpressioncounter values:

# before  ---------------branch-reset----------- after

/ ( a )  (?| x ( y ) z | (p (q) r) | (t) u (v) ) ( z ) /x

# 1            2         2  3        2     3     4

Without the construct, (p(q)r) would be group #3, and (t) group #5. With the constuct, they both report as group #2.

Control flow

Normally, a regular expression parses from left to right linerly. But you may need to change this behaviour. 

|

The alternation operator, which allows matching either of a number of options, like in : one|two|three to match either of "one", "two" or "three". Matches are attempted from left to right. Use (?:) to match an empty string in such a construct.

(?n), (?signed-n)

Refers to subexpression #n. When a sign is present, go to the signed-n-th expression.

(?0), (?R)

Backtrack to start of pattern.

(?&name)

Backtrack to subexpression named name.

(?assertionyes-pattern|no-pattern)

Mathes yes-pattern if assertion is true, and no-pattern otherwise if provided. Supported assertions are:

(?=assert) (positive lookahead)

(?!assert) (negative lookahead)

(?(R)) (true if inside a recursion)

(?(Rn) (true if in a recursion to subexpression numbered n

PCRE doesn't treat recursion expressions like Perl does: 

In PCRE (like Python, but unlike Perl), a recursive subpattern call  is

always treated as an atomic group. That is, once it has matched some of

the subject string, it is never re-entered, even if it contains untried

alternatives  and  there  is a subsequent matching failure.

\K

Resets matched text at this point. For instance, matching "foo\Kbar" will not match bar". It will match "foobar", but will pretend that only "bar" matches. Useful when you wish to replace only the tail of a matched subject and groups are clumsy to formulate.

Assertions



These special groups consume no characters. Their succesful matching counts, but when they are done, matching starts over where it left. 

(?=pattern

If pattern matches, backtrack to start of pattern. This allows using logical AND for combining regexes.

For instance,

(?=.*[[:lower:]])(?=.*[[:upper:]]).{6,}

tries finding a lowercase letter anywhere. On success it backtracks and searches for an uppercase letter. On yet another success, it checks whether the subject has at least 6 characters.

'"q(?=u)i" doesn't match "quit", because, as matching 'u' consumes 0 characters, matching "i" in the pattern fails at "u" i the subject.

(?!pattern

Matches if pattern didn't match.

(?<=pattern)

Asserts that pattern matches before some token.

(?<pattern)

Asserts that pattern does not match before some token.

NOTE: pattern has to be of fixed length, so that the regex engine knows where to test the assertion.

(?>pattern)

Match pattern independently of surrounding patterns, and don't backtrack into it. Failure to match will caus the whole subject not to match.

Substitutions

\a,\e,\f,\n,\r,\t,\v

The corresponding control character, respectively BEL, ESC, FF, LF, CR, TAB and VT.

\Ccharacter", \xnn,\x{nnnn

}

Like in search patterns, respectively the control character with the same low order bits, the character with code 'nn and the character with code nnnn (requires Unicode encoding).

\l

Causes next character to output in lowercase

\L

Causes next characters to be output in lowercase, until a \E is found.

\u

Causes next character to output in uppercase

\U

Causes next characters to be output in uppercase, until a \E is found.

\E

Puts an end to forced case mode initiated by \L or \U.

$&, $MATCH, ${^MATCH}

The whole matched text.

$`, $PREMATCH, ${^PREMATCH}

The text between the previous and current match, or the text before the match if this is the first one.

$", $POSTMATCH, ${$POSTMATCH}

Everything that follows current match.

$LAST_SUBMATCH_RESULT, $^N

Returns what the last matching subexpression matched.

$+, $LAST_PAREN_MATCH

Returns what matched the last subexpression in the pattern.

$$

Returns $.

$n, ${n}, \n

Returns what matched the subexpression numbered n. Negative indices are not alowed.

$+{name}

Returns what matched subexpression named name.

Zero length matches

While, in normal or extended mode, there would be no point in looking for text of length 0, this can very normally happen with regula expressions. For instance, to add something at the beginning of a line, you'll search for "^" and replace with whatever is to be added. 

Notepad++ would select the match, bt there is no sensible way to select a stretch zero character long. Whe this happens, a tooltip very similar to function call tips is displayed instea, with a caret pointing upwards to the empty match. 

Saturday, December 20, 2014

XSLT mapping basics useful for SAP PI XSLT mapping for special requirement : SOAP header and prefix change

Om

(This blog will help you on these topics)
1. XSLT basics using w3 schools examples
2. practicing XSLT in your java eclipse ( version 1.0 and version 2.)
by default you are having version 1.0 ( use the below blog information, to rung xslt mapping in eclipse)

3. extracting CDATA content using XSLT
4. removing prefixes of XSLT all elements.
5. step by step video, how to create xslt mapping with style sheet studio
(adding soap envelope and changing prefix of all elements in XML file)





working with xslt mapping in eclipse/NWDS IDE





( also see the video tutorials
www.youtube.com/watch?v=tAN-1xUsftg)


















for testing purpose,in java ecilipse also , you can run xslt program and see the output( but XSLT 1.0 Version only).

(if you are facing problem to open java eclipse, check if suitable java(jdk) in installed or not, even, the java class path  ex: c:\programfiles\java\jdk1.6\bin in path of environment variables.
then you are able to open the eciplise.
( you can also learn how to open eclipse using command line promt).
Reference Link
http://sometechiestuff.blogspot.in/2008/10/xsl-transformation-xslt-made-easy.html


j



 code for getting CDATA content to target.( XSLT example, use the same code for your requirement by replacing xpath in this example)
 



Online xslt compiler ( in google simply type, online xslt editor/ testing).




some important reference links for soap header changes information in xslt and configuration.


http://scn.sap.com/thread/1643436 frist graphical and xslt ( and achieve all your requirement)
xslt mapping functions http://scn.sap.com/docs/DOC-46751
&nosoap=true http://scn.sap.com/thread/3558965
header informaiton change http://scn.sap.com/community/pi-and-soa-middleware/blog/2014/06/17/read-soap-header-information
read soap header( changing header) http://scn.sap.com/community/pi-and-soa-middleware/blog/2014/06/17/read-soap-header-information
soap header change example http://simonlesflex.wordpress.com/2011/01/26/sap-pi-customize-message-with-xslt-mapping/
date and time xslt mapping http://scn.sap.com/thread/1201065

Dealing with soap header or element prefix changes in xml document in SAP PI mapping.

Om

-->Solution 1
Proxy to WSDL.

1. Prepare sender service interface with required message type
2. created custom MT(target message type for message mapping)
3. use additional filed for that messages type, that are additionaly required for WSDL(some time soap header parameters , dynamically pass)
3. 2nd mapping xslt .

use stylus studio.( we can easily add header section based same output xsd and map quickly from sample input xsd graphically, such way that, we can call to target system with its structure, having different structure from source, which has some what complexity, Like this I have achieved one solution for my requirement  )
1. you need sample source xml and sample target xml files ( to do graphically)
2. created new scenario in stylus studio. provide both source and target xml files.
3. it will show graphical view to map both source and target.
4. you can also see xslt source code view also.( just append) the soap header( required format at required node level)
5. Now again go to graphical view. and map required (elements only, not nodes)
6.execute the xslt mapping. and see the results as expected or not.

The main use of using xslt mapping is here,
some times , we need provide additional prefix for lement  ( first create sample out xml file, as required element-name in target use the same in xslt mapping).
some times, we need add soap header parameters.( in xslt code view, add header section .(hardcode))
and rest is simple logic.



--->Solution 2
Some times we have to deal to soap header based on WSDL definition,
if you are good at JAVA/Graphical mapping and week at XSLT then
use your logic in Graphical and XSLT mapping together( one after other).

1. Graphical mapping in operation mapping.( and use your all your required format of target structure).
2.then XSLT mapping, 



1. First complete your logic using UDF in graphical mapping.(ex: substring, replacestring, concat , of string functions, other functions of java).

2. then copy root node return as xml to target filed.( all source xml moved to target in CDATA section of target section).

3. next use xlst mapping to remove the CDATA content to target.
(XSLT program to extract CDATA content from source xml to target.


example: source xml


( in your case: just change the xpath in xslt as similar to above example).

Reference on CDATA copy from source to target.
http://vvratha.blogspot.in/2012/11/extracting-cdata-section-using-xslt.html#comment-form


Reference links on copy xml tree in single filed in target xml.
http://scn.sap.com/people/william.li/blog/2008/02/14/sap-pi-71-mapping-enhancements-series-copy-xml-subtree

http://scn.sap.com/people/jyothi.anagani/blog/2010/06/17/convert-the-input-xml-to-string-in-pi-71-using-standard-graphical-mapping



:-)