I am using Olingo java client api to post data.following is my XML structure which I want to post. http://services.odata.org/V4/(S(kfu42eshy4v0da0lifqbjdgc))/TripPinServiceRW

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
    <People xmlns:edm="http://schemas.magicsoftware.com/edm" xmlns:ns1="http://schemas.magicsoftware.com/edm" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <row>
            <Fields>
                <UserName>8People_UserName</UserName>
                <FirstName>Pople_FirstName</FirstName>
                <LastName>People_LastName</LastName>
                <AddressInfo>
                    <Location>
                        <Address>Address1</Address>
                        <City>
                            <CountryRegion>IN</CountryRegion>
                            <Name>ContryRegion</Name>
                            <Region>REG</Region>
                        </City>
                    </Location>
                </AddressInfo>
            </Fields>
            <Expanded_Entities>
                <Friends>
                    <row>
                        <Fields>
                            <UserName>Rajesh</UserName>
                            <FirstName>V</FirstName>
                            <LastName>Patil</LastName>
                        </Fields>
                    </row>
                </Friends>
            </Expanded_Entities>
        </row>
    </People>

I have issue for Expanded_Entities i am getting the error "The resource set reference navigation property 'Friends' has a property annotation 'odata.bind' with a string value. Resource set reference navigation properties can only have a property annotation 'odata.bind' with an array value"

following snippet of my code

private  void buildExpended(ArrayList<EntitySimpleData> xpiEntity) throws Exception {
        ArrayList<EntitySimpleData> expended = getElement(xpiEntity, EXPENDED);
        /*
         * running on first level properties
         */
        if (expended != null){
            String originalEntityName = this.entityName;
            ClientEntity expendedEntity = null;
            for (EntitySimpleData entitySimpleData : expended) {
                URI uri = URI.create(entitySimpleData.getName());
                this.entityName = entitySimpleData.getName();
                ClientLinkType type = ClientLinkType.ENTITY_NAVIGATION;
                String navigationName = entitySimpleData.getName();
                ArrayList<EntitySimpleData> rows = (ArrayList<EntitySimpleData>) entitySimpleData.getData(); // the linked entity
                EdmElement edmElement = EDMManager.getEdmElementByName(resourceName, namespace, originalEntityName, navigationName);
                if (!edmElement.isCollection()){
                    expendedEntity =  client.getObjectFactory().newEntity(new FullQualifiedName(namespace, entitySimpleData.getName()));
                    EntitySimpleData row = rows.get(0); //"row"
                    ArrayList<EntitySimpleData> fields = (ArrayList<EntitySimpleData>) row.getData();// Field
                    EntitySimpleData field = fields.get(0); //"Field"
                    ArrayList<EntitySimpleData> properties = (ArrayList<EntitySimpleData>) field.getData();// properties

                    for (EntitySimpleData entitySimpleData2 : properties) {
                        expendedEntity.getProperties().addAll( buildIt(entitySimpleData2,""));  
                    }
                    uri = null;
                    ClientInlineEntity clientLink = new ClientInlineEntity(uri, type, navigationName, expendedEntity);
                    clientEntity.getNavigationLinks().add(clientLink);
                }else{// multy

                    ClientEntitySet entitySet = client.getObjectFactory().newEntitySet();
                    for (EntitySimpleData row : rows) {
                    this.entityName = edmElement.getType().getName();

                        expendedEntity = client.getObjectFactory().newEntity(new FullQualifiedName(namespace, this.entityName));
                ArrayList<EntitySimpleData> fields = (ArrayList<EntitySimpleData>) row.getData();// Field
                        EntitySimpleData field = fields.get(0); //"Field"
                        ArrayList<EntitySimpleData> properties = (ArrayList<EntitySimpleData>) field.getData();// properties

                        for (EntitySimpleData entitySimpleData2 : properties) {
                            expendedEntity.getProperties().addAll( buildIt(entitySimpleData2,""));  

                        }
                    //  uri = null;

                    }
                entitySet.getEntities().add(expendedEntity);
                ClientInlineEntitySet clientLinks = new ClientInlineEntitySet(uri,  type, navigationName,  entitySet);
            clientEntity.getNavigationLinks().add(clientLinks);
            }
            }
        }
    }

/* * each property build itself and if it's complex, build all child's recursive */

private  ArrayList<ClientProperty> buildIt( EntitySimpleData data,String parentComplex) throws Exception{
        ArrayList<ClientProperty> props = new ArrayList<ClientProperty>();
        String fullName = (parentComplex.equals("")?data.getName():parentComplex+EDMManager.COMPLEX_DELIMITED+data.getName());
        EdmElement edmElement = EDMManager.getEdmElementByName(resourceName, namespace, entityName, fullName);
        EdmPrimitiveTypeKind edmType=null;
//      if (edmElement == null)
//          throw new SDKException (ODATAstepAdaptor.ERR_INFRASTRUCTURE, "EDM element not found in resource. resourceName["+resourceName+"] namespace["+namespace+"] entityName["+entityName+"] fullName["+fullName+"]");
        if (edmElement != null)
             edmType  = (EdmPrimitiveTypeKind) EDMManager.getODataElementType(edmElement);
        if(data.getElementGeneralType().equals(EntitySimpleData.Type.Simple)){
            props.add(buildProperty(edmType,data));
        }

        else if(data.getElementGeneralType().equals(EntitySimpleData.Type.Complex )){                                                           //complex
            boolean isCollection = false;
            if (edmElement != null)
                isCollection = edmElement.isCollection();
            if (edmType!=null){

                if (isCollection)
                {
                    collectionAddressInfo=client.getObjectFactory().newCollectionValue(edmElement.getType().getFullQualifiedName().getFullQualifiedNameAsString());
                    props.add(client.getObjectFactory().newCollectionProperty(data.getName(), collectionAddressInfo));

                    ArrayList<EntitySimpleData> childrens = (ArrayList<EntitySimpleData>) data.getData();
                    for (EntitySimpleData entitySimpleData : childrens) {
                        String parentName = (parentComplex.equals("")?data.getName():parentComplex+EDMManager.COMPLEX_DELIMITED+data.getName());
                        ArrayList<ClientProperty>complexProps= buildIt(entitySimpleData,parentName);
                        for (ClientProperty clientProperty : complexProps) {
                            if(clientProperty.hasComplexValue())
                            {
                            collectionAddressInfo.add(clientProperty.getComplexValue());
                            }
                            else if(clientProperty.hasPrimitiveValue()){
                                collectionAddressInfo.add(clientProperty.getPrimitiveValue());
                            }
                            else if(clientProperty.hasCollectionValue()){
                                collectionAddressInfo.add(clientProperty.getCollectionValue());
                            }

                        }


                        }


                }
                else

                // point
                props.add(EDMGeoHelper.buildPointProperty(client,edmType,data));
            }
            else{       // regular complex

                @SuppressWarnings("unchecked")
                ArrayList<EntitySimpleData> childrens = (ArrayList<EntitySimpleData>) data.getData();
                ClientComplexValue  complex = client.getObjectFactory().newComplexValue(namespace+"."+data.getName()); 
                props.add(client.getObjectFactory().newComplexProperty(data.getName(), complex));
                for (EntitySimpleData entitySimpleData : childrens) {
                    String parentName = (parentComplex.equals("")?data.getName():parentComplex+EDMManager.COMPLEX_DELIMITED+data.getName());
                    ArrayList<ClientProperty>complexProps= buildIt(entitySimpleData,parentName);
                    for (ClientProperty clientProperty : complexProps) {
                        complex.add(clientProperty);
                    }

                }
            }
        }
        else{// Unknown
            Logger.logMessage(LogLevel.LEVEL_WARN, ODATAstepAdaptor.ODATA_CLIENT_LOG_MODULE, "Element ["+fullName+"] ignored. null value");
        }

        return props;
    }

/** * * @param resourceName * @param schemaNamespace * @param entityName * @param fieldName * @param isCollection - return if property is collection * @return */

public static EdmElement getEdmElementByName(String resourceName, String schemaNamespace, 
            String entityName, String fieldName) {

        // Get current schema by namespace
        ODataSchemaImpl schema = odataResourcesMap.get(resourceName).get(schemaNamespace);

        String[] fieldHierachy = fieldName.split(COMPLEX_DELIMITED);

        EdmStructuredType edmStructured = null;

        // Check if is it complex property
        if (fieldHierachy.length > 1) 
            edmStructured = schema.getComplexTypes().get(fieldHierachy[fieldHierachy.length-2]);

        if(fieldHierachy.length == 1 || edmStructured  ==null )
            edmStructured = schema.getEntityTypes().get(entityName);    

        fieldName = fieldHierachy[fieldHierachy.length - 1];    

        if(edmStructured!=null)
          return edmStructured.getProperty(fieldName);  
        else
         return null;
    }

/* * running on one entity properties (EntitySimpleData), build ClientEntity and post it to server. */

public void postEntity(String namespace, String entityName,EntitySimpleData data,String serviceName) throws Exception {
        ODataEntityCreateRequest<ClientEntity> req = null;
        ClientEntityBuilder helper = null;
        ClientEntity clientEntity = null;
        URI entityURI = null;

        try{
            Logger.logMessage(LogLevel.LEVEL_DEBUG, ODATAstepAdaptor.ODATA_CLIENT_LOG_MODULE, "postEntity. entityName ["+entityName+"] data["+data+"] serviceName [" + serviceName + "]");

            helper = new ClientEntityBuilder(data,client,namespace,SERVICE_ROOT,entityName);
            clientEntity = helper.buildClientEntityParameters();
            entityURI = client.newURIBuilder(SERVICE_ROOT).appendEntitySetSegment(serviceName).expand("Friends").build();

            Logger.logMessage(LogLevel.LEVEL_DEBUG, ODATAstepAdaptor.ODATA_CLIENT_LOG_MODULE, "postEntity. entityName ["+entityName+"] data["+data+"] serviceName [" + serviceName + "] entityURI[ " + entityURI + "] clientEntity [" + clientEntity + "]");
            req = client.getCUDRequestFactory().getEntityCreateRequest(entityURI, clientEntity);
            setHeaders(req, headers);
            ODataEntityCreateResponse<ClientEntity> res = req.execute();
            clientEntity = res.getBody();
        }catch(Exception e){
            Logger.logMessage(LogLevel.LEVEL_ERROR, ODATAstepAdaptor.ODATA_CLIENT_LOG_MODULE, "postEntity. entityName ["+entityName+"] data["+data+"] serviceName [" + serviceName + "] entityURI [ " + entityURI + "] clientEntity [" + clientEntity + "]",e,1);
            throw(e);
        }
    }

ODataEntityCreateResponse<ClientEntity> res = req.execute(); this line I got 
above error 
0

There are 0 answers