WebSphere Message Broker, Version 8.0.0.7
Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS
See information about the latest product version
See information about the latest product version
Calling Java from PHP
The IBM® sMash Runtime for PHP provides access to Java™ classes and functionality from PHP. This Java Bridge can instantiate Java classes and call their methods.
You can manipulate values in an MRM or XMLNSC tree with xsd types
that do not map directly to PHP types:
- xsd:decimal type java.math.BigDecimal
- xsd:dateTime com.ibm.broker.plugin.MbTimestamp
For example:
/**
* @MessageBrokerSimpleTransform
*/
function evaluate ($output, $input) {
$number = $input->XMLNSC-doc->number->getValue();
$signature = new JavaSignature (JAVA_STRING);
$decimal = new Java("java.math.BigDecimal", $signature, "654.321");
$sum = $number->add($decimal);
$output->XMLNSC->doc->number = $sum;
$timestamp = $input->XMLNSC->doc->date->getValue();
$now = new Java("java.util.Date");
$timestamp->setTime($now);
$output->XMLNSC->doc->date = $timestamp;
}