Getting issue in making JSON request from xml request of SAP -


my requirement create json below xml, , send post request sapnetweaver adapter.

sap end point
uri: /sap/opu/odata/sap/zpm_mobile_srv/woheaderset

method: post
payload: 1 operation, 2 materials

xml request contain 2 payload operations , material.
1. operation : woheaderoperation 2. materail : woheadermaterial

this code contain 2 section 1 woheaderoperation , second woheadermaterial

    <?xml version="1.0" encoding="utf-8"?> <atom:entry xmlns:atom="http://www.w3.org/2005/atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">    <atom:content type="application/xml">       <m:properties>          <d:aufpl>1000000053</d:aufpl>          <d:gltrptms>1425887760</d:gltrptms>          <d:gstrptms>1425887760</d:gstrptms>          <d:auart>pm02</d:auart>          <d:ktext>test mambo 2</d:ktext>          <d:iwerk>kact</d:iwerk>          <d:ingrp>kp</d:ingrp>          <d:gewrk>10000359</d:gewrk>          <d:tplnr>kac-0p5010-pm1</d:tplnr>          <d:arbpl>10000359</d:arbpl>       </m:properties>    </atom:content>    <atom:link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/woheaderoperation" type="application/atom+xml;type=feed" title="woheaderoperation">       <m:inline>          <atom:feed>             <atom:entry>                <atom:content type="application/xml">                   <m:properties>                      <d:vornr>0010</d:vornr>                      <d:ltxa1>operation 1</d:ltxa1>                      <d:indet>2</d:indet>                   </m:properties>                </atom:content>             </atom:entry>          </atom:feed>       </m:inline>    </atom:link>    <atom:link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/woheadermaterial" type="application/atom+xml;type=feed" title="woheadermaterial">       <m:inline>          <atom:feed>             <atom:entry>                <atom:content type="application/xml">                   <m:properties>                      <d:vornr>0010</d:vornr>                      <d:posnr>0010</d:posnr>                      <d:matnr>340</d:matnr>                      <d:werks>kact</d:werks>                      <d:bdmng>7.000</d:bdmng>                      <d:meins>pce</d:meins>                      <d:postp>l</d:postp>                   </m:properties>                </atom:content>             </atom:entry>             <atom:entry>                <atom:content type="application/xml">                   <m:properties>                      <d:vornr>0010</d:vornr>                      <d:posnr>0020</d:posnr>                      <d:matnr>338</d:matnr>                      <d:werks>kact</d:werks>                      <d:bdmng>10.000</d:bdmng>                      <d:meins>pce</d:meins>                      <d:postp>l</d:postp>                   </m:properties>                </atom:content>             </atom:entry>             <atom:entry>                <atom:content type="application/xml">                   <m:properties>                      <d:vornr>0010</d:vornr>                      <d:posnr>0030</d:posnr>                      <d:matnr>336</d:matnr>                      <d:werks>kact</d:werks>                      <d:bdmng>10.000</d:bdmng>                      <d:meins>pce</d:meins>                      <d:postp>l</d:postp>                   </m:properties>                </atom:content>             </atom:entry>          </atom:feed>       </m:inline>    </atom:link> </atom:entry> 

if want json, request such:

get /sap/opu/odata/sap/zpm_mobile_srv/woheaderset?$format=json 

but gateway accept both json , xml there no need other own preference.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -