OData post using odata4j missing "category" element
I'm attempting to make an Odata post using odata4j. After dumping the posted xml data, I copied it into a php script using curl just to test. I found out that the 开发者_开发问答xml post is missing the "category" element which is required for a post.
I can't seem to figure out the appropriate method, looking at the odata4j javadocs, to be able to create this element within the entity structure.
Any thoughts on this? I've posted a slightly simplified version of my code.
// create the new request object
OCreateRequest<OEntity> createRequest = consumer.createEntity( "ESvcOrderTrans" )
.properties( OProperties.int32( cursorWrapper.getColumnName(0), cursorWrapper.getInt(0))
.properties( OProperties.string( cursor.getColumnName(1), cursor.getString(1) ));
// Execute the OData post
OEntity newMaterial = createRequest.execute();
There is no api for this in the 0.4 release.
One possible workaround is to create a custom OClientBehavior and hack up the request entry messages as they go out. See http://code.google.com/p/odata4j/wiki/Extensibility
We'll make this easier in the next release. Track via http://code.google.com/p/odata4j/issues/detail?id=48
Hope that helps,
- john
精彩评论