#!/usr/bin/perl
use XML::WBXML;
# slurp mode
$/ = undef;
# read XML
$xml = <STDIN>;
# convert from XML to WBXML
my $wbxml = XML::WBXML::xml_to_wbxml($xml);
# convert to ASCII string of hex values
my $data = unpack "H*", $wbxml;
which is used something like
cat file.xml | perl wbxml.pl