Sometimes in SOA Suite 11g you need to pass binary data to a web service reference. In SOA Suite 11g there is no standard XSLT or XPATH function which you can use. But in BEPL you can use embedded java, like Sudheer already blogged about. He used the com.collaxa.common.util.Base64Encoder class which does not exists in 11g so I will use the new oracle.soa.common.util.Base64Encoder class.
As input I will retrieve some xml from the inputVariable, get the xml as a string, encode this and set the value to a base64Binary variable.
Would a custom XPath function also be possible? In this case you can implement it at one place and use it everywhere !
ReplyDeleteHi,
ReplyDeleteThat should be possible only you need to find out what the input is like a string , xml or binary.
and need to deploy it on the soa server and to every developer pc. Sometimes this is too much
thanks
Thank you for this useful post. What other imports are required besides oracle.soa.common.util.Base64Encoder class. I get failure in compile execlets of bpel process.
ReplyDeleteHi,
ReplyDeleteI use the full path and don't use imports.
You can check my code for all the classes.
thanks
I tried similar code which you used but no luck. I am using Jdev 11.1.1.6.
DeleteI am getting below error. Could you please throw some light on it.
Error deploying archive sca_SOA-BENMessageProcessor_rev1.0.jar to partition "default" on server AdminServer [http://VWI1LA01:10005]
[02:02:56 PM] HTTP error code returned [500]
[02:02:56 PM] Error message from server:
There was an error deploying the composite on AdminServer: Error occurred during deployment of component: BENMessageProcessor to service engine: implementation.bpel, for composite: SOA-BENMessageProcessor: ORABPEL-05250
Error deploying BPEL suitcase.
error while attempting to deploy the BPEL component file "E:\Oracle\Middleware\user_projects\domains\soadomain\servers\AdminServer\dc\soa_89e88ee7-ff81-44e8-b8e5-64ac1a91b973"; the exception reported is: java.lang.RuntimeException: failed to compile execlets of BENMessageProcessor
This error contained an exception thrown by the underlying deployment module.
Verify the exception trace in the log (with logging level set to debug mode).
.
[02:02:56 PM] Check server log for more details.
[02:02:56 PM] Error deploying archive sca_SOA-BENMessageProcessor_rev1.0.jar to partition "default" on server AdminServer [http://VWI1LA01:10005]
[02:02:56 PM] #### Deployment incomplete. ####
[02:02:56 PM] Error deploying archive file:/C:/JDeveloper/SOA-BENMessageProcessor/SOA-BENMessageProcessor/deploy/sca_SOA-BENMessageProcessor_rev1.0.jar
(oracle.tip.tools.ide.fabric.deploy.common.SOARemoteDeployer)
Right, it works now. Thank you for your suggestion.
ReplyDeleteHello Edwin,
ReplyDeletenice article which help me to decode base64 in Oracle BPEL. At the moment I have problem to access the right Part of Variable. It seems that the XPath is not relevant. I got no more information in Oracle Support Web, may be you have an idea:
getVariableData("inputVariable", "payload", "//ns1:document/ns1:Metadata");
System print output:
?
?
?
?
?
?
?
?
?
?
?
Thanks
Marcel
Hello Edwin,
ReplyDeleteit's me once again. I do some research and an output via convertDomNodeToString and the result shows that getVariableData works fine.
The problem is the getDocument function. It seems that this get the whole variable data. I hope to find a solution.
Thanks
Marcel
Hi,
ReplyDeleteCan you test getVariableData in bpel first, there must somewhere a mistake.
thanks
Hi Edwin,
ReplyDeletegetVariableData seems to work fine. I print out the data with convertDomNodeToString and it looks good. After "getDocument" the variable contains the whole variable data.
Regards
Marcel
String System_base64string = ((oracle.xml.parser.v2.XMLElement)getVariableData("InvokeSyncReadFile_SynchRead_OutputVariable","opaque","/ns3:opaqueElement")).getFirstChild().getNodeValue();
ReplyDeleteThis is returning XML document from First node. But my requirement is to extract the
XML document from second child element.
For Ex:
Then I need output from tag.
Please help me on this.
Are there plans to put the SOA component into JDeveloper 11.1.2?
ReplyDeleteThanks!
hi,
DeleteNo. you need to wait at least a year for 12c , 11gR2 is an ADF patch release which stills run on wls 10.3.5. Oracle uses this to test JSF2.0.
thanks
Hi Edwin Biemond,
ReplyDeleteWhen I try to decode with following code snippet:
I am getting class cast exception.
Hi
DeleteCan you escape your xml code, so I can see what your are doing.
thanks
In 11g, one needs to use oracle.soa.common.util.Base64Encoder instead of com.collaxa.common.util.Base64Encoder, and similarly Base64Decoder.
ReplyDeleteMake sure you import the required classes before using in BPEL.
e.g.
Hi,
ReplyDeleteI am facing an issue related to java embedding .
Here is what I am trying to achieve.
I have to generate a MD5 hash string from an xml file content then I have to check if it matches with another MD5 hash string.
Below is java code I am using.
String md5=getVariableData("md5Var").toString(); //this is the variable that needs to be md5 hashed
try{
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] myByteArray1 = md5.getBytes("UTF-8");
byte[] myByteArray2 = md.digest(myByteArray1);
BigInteger bigInt = new BigInteger( 1, myByteArray2);
String javahashedstring = bigInt.toString(16);
setVariableData("md5Var", javahashedstring, false); //return md5 hashed variable
}catch (Exception ex){
ex.printStackTrace();
}
The above java code works fine if I run it as a standalone program.
The java program has is using Message digest class which is present in JSR177.I have added that in sca-inf\lib folder of the composite, added to the project properties->Library and classpath.
I have also added this jar to the my soa server folder E:\SOA11G7\Oracle\Middleware\Oracle_SOA1\soa\modules\oracle.soa.ext_11.1.1 and after that I ran Ant command as per the oracle documentation.
Also I am using bpel 2.0.My JDK version is JDK1.6.29
But it still give me below error.I have spent a lot of time on this by going through various documentation and blogs but I am still not able to find an answer.
Any suggestion/pointers would be appreciated.
Thanks in advance
Regards
Lalit
Hey Lalit,
Deletedid you find the resolve the issue?
Hi ,
ReplyDeleteHello , how are you ?
Thanks for writing such useful blogs. Need your help in one of the issues while using FTP adapter.
Requirement :
i want to write a file to FTP location (windows server) using opaque element , using schema is not possible, so have to use opaque element only. Now the file is written successfully but the issue is, it is written in base64 format . not sure which property needs to be changed here .
can you please help here ?
Thanks
Kuldeep
A SOA Learner !!!