on 2013 Mar 01 4:46 PM
Hi,
When I test my odata service in GW Client(/IWFND/GW_CLIENT), it always says “The specified HTTP method is not allowed for the resource identified by the Data Service Request URI”. (it works well with sdata). I cannot figure it out and we are blocked. can anyone help me here? thanks.
here are the information about my implementation and testing env, I implemented an action to save counting document.
Here is the CountingDoc entity and return entity
*----------------------------------------------------------------------------------
* Entity: Counting Document header
*----------------------------------------------------------------------------------
lo_entity_type = model->create_entity_type( 'CountingDoc' ). "#EC NOTEXT
lo_property = lo_entity_type->create_property( iv_property_name = 'countingID' iv_abap_fieldname = 'PHYSINVENTORY' ).
lo_property->set_is_key( ).
lo_property = lo_entity_type->create_property( iv_property_name = 'fiscalYear' iv_abap_fieldname = 'FISCALYEAR' ).
lo_property->set_is_key( ).
lo_property = lo_entity_type->create_property( iv_property_name = 'siteID' iv_abap_fieldname = 'PLANT' ).
lo_property = lo_entity_type->create_property( iv_property_name = 'stgeLocID' iv_abap_fieldname = 'STGE_LOC' ).
.....
lo_entity_type->bind_structure( '/SRSMOB/STOP_COUNTING_DOC' ).
lo_entity_type->set_creatable( abap_true ).
lo_entity_type->set_updatable( abap_true ).
lo_entity_type->set_deletable( abap_true ).
*----------------------------------------------------------------------------------
* Entity: ExecutionMessage
*----------------------------------------------------------------------------------
lo_entity_type = model->create_entity_type( 'ExecutionMessage' ). "#EC NOTEXT
lo_property = lo_entity_type->create_property( iv_property_name = 'type' iv_abap_fieldname = 'TYPE' ).
lo_property->set_is_key( ).
lo_property = lo_entity_type->create_property( iv_property_name = 'id' iv_abap_fieldname = 'ID' ).
lo_property->set_is_key( ).
lo_property = lo_entity_type->create_property( iv_property_name = 'number' iv_abap_fieldname = 'NUMBER' ).
lo_property->set_is_key( ).
...
Note:
Here is the POST action in the model,
lo_action = model->create_action( 'SaveCountingLineItemList' ). "#EC NOTEXT
lo_action->SET_HTTP_METHOD( /iwbep/if_mgw_med_odata_types=>gcs_med_http_methods-POST ).
lo_action->set_return_entity_type( 'ExecutionMessage' ).
lo_action->set_action_for('CountingDoc').
lo_action->set_return_multiplicity( /iwbep/if_mgw_med_odata_types=>gcs_cardinality-cardinality_1_n ).
lo_parameter = lo_action->create_input_parameter( iv_parameter_name = 'countingID' iv_abap_fieldname = 'PHYSINVENTORY').
lo_parameter->bind_data_element( '/SRSMOB/STOP_VALUE_CHAR' ).
lo_parameter = lo_action->create_input_parameter( iv_parameter_name = 'fiscalYear' iv_abap_fieldname = 'FISCAL_YEAR').
lo_parameter->bind_data_element( '/SRSMOB/STOP_VALUE_CHAR' ).
I didn’t paste the runtime code here since the request never reaches there and sdata works.
I am using GW Client (/IWFND/GW_CLIENT) to do the testing. No ~CHECK_CSRF_TOKEN is set. So CSRF security is enabled and I don’t need to worry about this security token since I am using GW Client. My url and error looks as below.
url: /sap/opu/odata/SRSMOB/STORE_OPERATIONS/SaveCountingLineItemList?docId='300000314'&fiscalYear='2013'
here is the meata data for this function import:
</Documentation>
</Parameter>
</Documentation>
</Parameter>
</FunctionImport>
thanks.
regards,
Steven
Request clarification before answering.
Hi Steven
This question gets asked a lot!
You are trying to POST to a query, you can only POST to a single entity.
eg
/sap/opu/odata/SRSMOB/STORE_OPERATIONS/SaveCountingLineItemList('100000001)
not
/sap/opu/odata/SRSMOB/STORE_OPERATIONS/SaveCountingLineItemList?docId='300000314'&fiscalYear='2013'
Cheers
JSP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.