0

I inherited a project that contains multiple web services. I used one of them as a template to create a new one. It worked and am getting a good soap response. But the customer wants the response format to be different. Here's a snippet of the current response:

<inneoquestChannelMaps>
      <channelNumber>1</channelNumber>
      <eiaChannel>23</eiaChannel>
      <encryptionStatus>Encrypted</encryptionStatus>
      <frequency>219</frequency>
      <mpegServiceId>5</mpegServiceId>
      <qam>visible</qam>
      <sourceId>23071</sourceId>
      <sourceName>XFINITYOD</sourceName>
   </inneoquestChannelMaps>
   <inneoquestChannelMaps>
      <channelNumber>2</channelNumber>
      <eiaChannel>19</eiaChannel>

So you see it is a series of records returned from a database query. What I can't figure out is what is giving the names for each data field in the response?

The customer wants different names, for example

<channel_number>1</channel_number> 

I can see that they are probably being generated by a maven enunciate plugin because after maven build, one of the java class I created gets modified with annotations like this:

@javax.xml.bind.annotation.XmlElement (
    name = "inneoquestChannelMaps",
    namespace = ""
  )

and I can see

// Generated by Enunciate

at the top of the file. What is providing the name "inneoquestChannelMaps"? How to change channelNumber to channel_number?

I can't find it in any of the source files, only in the target build files.

user3217883
  • 1,216
  • 4
  • 38
  • 65

1 Answers1

0

Well I have no idea where it is getting the default field names but you can force it to what you want using an annotation above the getChanelNumber method like this:

  @javax.xml.bind.annotation.XmlElement (
    name = "channel_number",
    namespace = ""
  )
    public Integer getChannelNumber() {
        return channel_number;
    }

The lack of clear documentation for all these magic black-boxes we have to deal with is really de-motivating.

user3217883
  • 1,216
  • 4
  • 38
  • 65