You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Christian Amend (JIRA)" <ji...@apache.org> on 2016/08/12 08:20:20 UTC

[jira] [Commented] (OLINGO-1001) How to build atom+xml with olingo api for deep insert

    [ https://issues.apache.org/jira/browse/OLINGO-1001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15418511#comment-15418511 ] 

Christian Amend commented on OLINGO-1001:
-----------------------------------------

Hi,
first you should have a look at our client turtorial here: http://olingo.apache.org/doc/odata2/tutorials/OlingoV2BasicClientSample.html

This explains how to use the EntityProvider. There you find a method called writeEntry(...) which you can use to consturct the payload. In order to get expanded entries you need to provide an ExpandSelectTree which contains the callback used for you inline data. You can construct this tree by using the ExpandSelectTreeBuilder. 

You basically have to provide the EntityProvider with the same information you would provide on server side for the $expand option. Here is a tutorial for that: http://olingo.apache.org/doc/odata2/tutorials/read_expand.html

If this doesn`t answer your question please reopen this issue.

Best Regards,
Christian

> How to build atom+xml with olingo api for deep insert
> -----------------------------------------------------
>
>                 Key: OLINGO-1001
>                 URL: https://issues.apache.org/jira/browse/OLINGO-1001
>             Project: Olingo
>          Issue Type: Question
>            Reporter: gopichand
>            Assignee: Christian Amend
>
> Hi , I am working on consuming the SAP ERP odata service in which they have provided the service url for creating an order and atom+xml body I need to build is 
> <?xml version="1.0" encoding="utf-8"?>
>  <atom:entry
>   xmlns:atom="http://www.w3.org/2005/Atom"
>   xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
>   xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices">
>       <atom:content type="application/xml">
>         <m:properties>
>          <d:OrderId>0005000017</d:OrderId>
>         <d:DocumentType>ZHOR</d:DocumentType>
>         <d:CustomerId>0000301560</d:CustomerId>
>         <d:SalesOrg>3020</d:SalesOrg>
>         <d:DistChannel>30</d:DistChannel>
>         <d:Division>00</d:Division>
>         <d:DocumentDate m:null="true"/>
>         <d:OrderValue m:null="true"/>
>         <d:Currency m:null="true"/>
>         </m:properties>
>       </atom:content>
>      <atom:link
> rel = "http://schemas.microsoft.com/ado/2007/08/dataservices/related/SOItems"
> type= "application/atom+xml;type=feed"
> title= "YGW_SO_CREATE.SOHeader_SOItems">
> <m:inline>
>     <atom:feed>
>   <atom:entry>
>   <atom:content type="application/xml">
>     <m:properties>
>         <d:Item>000010</d:Item>
>         <d:Material>H1221417</d:Material>
>         <d:Description m:null="true"/>
>         <d:Plant>3000</d:Plant>
>         <d:Quantity>4.000</d:Quantity>
>         <d:UoM m:null="true"/>
>         <d:Value m:null="true"/>
>    </m:properties>
>    </atom:content>
>  </atom:entry>
>  <atom:entry>
>   <atom:content type="application/xml">
>    <m:properties>
>         <d:Item>000020</d:Item>
>         <d:Material>M-01</d:Material>
>         <d:Description m:null="true"/>
>         <d:Plant>3000</d:Plant>
>         <d:Quantity>2.000</d:Quantity>
>         <d:UoM m:null="true"/>
>         <d:Value m:null="true"/>
>    </m:properties>
>    </atom:content>
> </atom:entry>
> </atom:feed>
> </m:inline>
> </atom:link>
> </atom:entry>
> and the service URI is    ::: http://cgihsap0004.cgiad.local:8004/sap/opu/odata/sap/ygw_so_create/
> Entity set name is SOHeaders
> I m using apache olingo 2.0 api for consuming these services but the body is deep insert , I m not able to build this body using this api . Could some please suggest me the way



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)