0
Answer

How to get webservice serialization to use namespace prefix

Terence

Terence

16y
5.6k
1

Hello,

I have a webservice that serializes an object when a request is made from the client to the webservice.

The xml looks like the following:

<dataset xmlns="http://www.abc.gov.au/Statistics/MetadataFramework/DataSet/1"><id xmlns="http://www.abc.gov.au/Statistics/MetadataFramework/miscellaneous/1"><id>1180</id><version>1</version></id><change_history xmlns="http://www.abc.gov.au/Statistics/MetadataFramework/ISO11179/1"><change><change_date>2001-12-17T09:30:47.0000000+11:00</change_date><changed_by>crosmi</changed_by><change_description>test change </change_description></change></change_history><inUseIndicator xmlns="http://www.abc.gov.au/Statistics/MetadataFramework/miscellaneous/1">true</inUseIndicator><createdBy xmlns="http://www.abc.gov.au/Statistics/MetadataFramework/miscellaneous/1">wattte</createdBy><creationDate xmlns="http://www.abc.gov.au/Statistics/MetadataFramework/miscellaneous/1">2001-12-17T09:30:47.0000000+11:00</creationDate><name>wattte test 27 1</name><shortName>wattte 27 1</shortName><definition>testing wattte test</definition><purposeIdentifier>37</purposeIdentifier><levelIdentifier>17</levelIdentifier><dataItemTemplate><id xmlns="http://www.abc.gov.au/Statistics/MetadataFramework/ISO11179/1">288</id><version xmlns="http://www.abc.gov.au/Statistics/MetadataFramework/ISO11179/1">1</version></dataItemTemplate></dataset>

Can the webservice serializer produce the following cleaner xml (prefix used instead of the namespaces) instead?  

<ds:dataset xmlns:misc="http://www.abs.gov.au/Statistics/MetadataFramework/miscellaneous/1" xmlns:ISO11179="http://www.abs.gov.au/Statistics/MetadataFramework/ISO11179/1" xmlns:ds="http://www.abs.gov.au/Statistics/MetadataFramework/DataSet/1">
<misc:id>
<misc:id>1200</misc:id>
<misc:version>1</misc:version>
</misc:id>
<ISO11179:change_history>
<ISO11179:change>
<ISO11179:change_date>2001-12-17T09:30:47.000000</ISO11179:change_date>
<ISO11179:changed_by>crosmi</ISO11179:changed_by>
<ISO11179:change_description>mandatory change history</ISO11179:change_description>
</ISO11179:change>
</ISO11179:change_history>
<misc:inUseIndicator>true</misc:inUseIndicator>
<misc:createdBy>String</misc:createdBy>
<misc:creationDate>2001-12-17T09:30:47.000000</misc:creationDate>
<ds:name>TestDataset</ds:name>
<ds:shortName>Test2</ds:shortName>
<ds:definition>A dataset to test db loading routines</ds:definition>
<ds:dataItemTemplate>
<ISO11179:id>1</ISO11179:id>
<ISO11179:version>1</ISO11179:version>
</ds:dataItemTemplate>
</ds:dataset>
I'd greatly appreaciate any help.

Thank you and Merry Christmas.