With Oracle ESB 11g, I need transform the structure of a webservice, but I have a problem with xml type, the source webservice has a type base64binary but my mockup is type string.
Source type
<xsd:element
name="MyDocument"
maxOccurs="1"
minOccurs="0"
type="xsd:base64Binary"
></xsd:element>
Destination type
<xs:element name="myBase64file" type="xs:string" minOccurs="0"/>
Why destination is String?? because my mockup in Java return a String
InputStream stream = this.getClass().getClassLoader().getResourceAsStream("doc3.pdf");
byte[] bytes = IOUtils.toByteArray(stream);
byte[] bytes64 = Base64.encodeBase64(bytes);
myBase64file = new String(bytes64);
But now the real service returns base64binary :(
With oepe (Eclipse more plugins for Oracle OSB) in XQuery Mapper I Tried put a hard transformation like this
{
for $MyDocument in $MyData/ns2:MyDocument
return <myBase64file>{ data($MyDocument) }</myBase64file>
}
Is this the correct way?