Page 1 of 1

XML Output

PostPosted: Sun Nov 03, 2019 1:16 pm
by SBarnes
The call to the API

https://api.jiwa.com.au/Queries/DB_Main ... uE-M8gBlA8

produces XML like

Code: Select all
  <d2p1:DB_Main>
            <d2p1:_x003C_ABN_x003E_k__BackingField>__-___-___-___</d2p1:_x003C_ABN_x003E_k__BackingField>
            <d2p1:_x003C_ACN_x003E_k__BackingField>008 745 985</d2p1:_x003C_ACN_x003E_k__BackingField>
            <d2p1:_x003C_AccountName_x003E_k__BackingField>Arthur Creams Pty Ltd</d2p1:_x003C_AccountName_x003E_k__BackingField>
            <d2p1:_x003C_AccountNo_x003E_k__BackingField>1002</d2p1:_x003C_AccountNo_x003E_k__BackingField>
            <d2p1:_x003C_AccountOnHold_x003E_k__BackingField>false</d2p1:_x003C_AccountOnHold_x003E_k__BackingField>
            <d2p1:_x003C_Address1_x003E_k__BackingField>Unit 2, Technology Park</d2p1:_x003C_Address1_x003E_k__BackingField>
            <d2p1:_x003C_Address2_x003E_k__BackingField>18 Pine Road</d2p1:_x003C_Address2_x003E_k__BackingField>
            <d2p1:_x003C_Address3_x003E_k__BackingField>ROSEHILL</d2p1:_x003C_Address3_x003E_k__BackingField>


is there a way to produce the tags as their real filed names such as Address3

Re: XML Output  Topic is solved

PostPosted: Sun Nov 03, 2019 1:44 pm
by Mike.Sheen
From what I can tell, we would need to decorate our DTO's in the JiwaServiceModel namespace with DataContract attributes - as per this response from the ServiceStack author.

I admit what is produced right now is fairly ugly, but the solution of decorating all our DTO's manually isn't an appealing option to us either.

I'll have a look when I have a bit of time to see what can be done to improve this.

Re: XML Output

PostPosted: Sun Nov 03, 2019 5:19 pm
by SBarnes
Thanks Mike,

But don't get too carried away on a solution for the standard DTOs the example I gave has nothing to do with the the task I have to achieve that will be for non standard views and stored procs I need to write for a customer, I was just using DB_Main to ask the question on how to do it.

If the link you have provided works as advertised I'll let you know so that you can look at it for the standard DTOs.

Re: XML Output

PostPosted: Wed Jan 15, 2020 11:26 am
by SBarnes
Hi Mike,

Just to let you know the link you provided does clean up the XML in your annotate the response classes as described.