cancel
Showing results for 
Search instead for 
Did you mean: 

How to unmarshal web server response for PI channels status?

Former Member
0 Kudos

Hi,

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

ActivationStateType.java

ChannelStateType.java

ChannelsType.java

ChannelType.java

ErrorInformationType.java

ObjectFactory.java

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())

     System.out.println(channel.getChannelName());

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

Thanks!

Accepted Solutions (0)

Answers (1)

Answers (1)

RaghuVamseedhar
Active Contributor
0 Kudos