Skip to Content
Former Member
Aug 14, 2015 at 05:18 PM

How to unmarshal web server response for PI channels status?



I'm exploring the option to manage PI channels through Java.

I have downloaded the ChannelAdmin.xsd and ran xjc and created the java classes.

"%java_home%\bin\xjc" -p test f:\ChannelAdmin.xsd

Then using http request I was able get a valid xml response with the channels status.

I tried several ways to unmarshal the response and go through the channels with no success.

For example:

JAXBContext jaxbContext = JAXBContext.newInstance(ChannelsType.class);

Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();

StringReader reader = new StringReader(response);

ChannelsType channelsType = (ChannelsType) unmarshaller.unmarshal(reader);

for (ChannelType channel : channelsType.getChannels().getChannel())


Can someone point me to a working example for managing channels using Java, or explain how to do it?