501 Not Implemented DOH

Posted by Darren Parr on 23-Mar-2020 15:49

Hi

We're getting a 501 error in the DOH. The routine we're trying to call takes many parameters.

@openapi.openedge.export(type="REST", useReturnValue="false", writeDataSetBeforeImage="true").
@progress.service.resourceMapping(type="REST", operation="invoke", URI="/gridvalidate", alias="", mediaType="application/json").
METHOD PUBLIC VOID GridValidate
(INPUT pcParam AS CHARACTER,
INPUT pcTable AS CHARACTER,
INPUT pcID AS CHARACTER,
INPUT DATASET dsItem,
INPUT-OUTPUT DATASET dsPrice):

Its the datasets which I think causew us issues. The dsPrice is the main dataset for the business entity. Thats included at the top in the annotation. The dsItem doesnt have an annotation and I'm not sure how to give it one as I already have a schemaName reference.

Any ideas?

1. Can someone tell me how to turn on logging so I can get more info out of the DOH. 

2. What does 501 mean as far as the DOH is concerned?

Thanks in advance

Darren

Posted by Peter Judge on 23-Mar-2020 16:40

A missing schema will definitely cause that problem for INPUT (or IN-OUT) parameters.  You should probably log a bug to the effect that not all schemas in the invoke signature are written into the gen file.
 
To fix it, you can create a *.map* file with the same name and folder as the .gen, and just add the missing schema in there. The DOH will load both, overlaying the contents of the gen with those of the map.
 
{
"services":
    { "your service name" :
           "schemas": {
               "dsBlah": {
                    // you can see the structure for this in the .gen file
                }
           }
    }
}
 
 
Hth,
-- peter
 
 
 

All Replies

Posted by Peter Judge on 23-Mar-2020 16:04

HI Darren,
 
It usually means that that method could not be found by reflection. This could be for a couple of reasons
  1. The args array in the mapping file isn't correct for one or other reason (order of elements,  ablType wrong for classes in particular, ioMode)
  2. The schemas don't match between the mapping file and the code (the "indexes" property for tamp-tables needs to be in the correct order)
  3. There are temp-tables defined as LIKE . The ABL cannot dynamically create temp-tables that have the correct CRC for those temp-tables, and so the reflection fails.
 
As for increasing the logging, you can add per-service logging using docs.progress.com/.../ABL-application-logging.html . To do  so, add a logger named "OpenEdge.Web.DataObject.DataObjectHandler.<your-service-name>" into a file called logging.config somewhere in PROPATH, with the configuration. If you log at a DEBUG level you should get a fair bit of information about just that service.
 
 
 
 
 
 
 

Posted by Darren Parr on 23-Mar-2020 16:21

Thanks Peter.

The reason I mentioned the annotations was the .gen file doesnt have any defn for dsItem. Would this cause it issues? This is because the annotation at the top of the file only reference to the other dataset.

I'll do some logging.

-Darren

Posted by Peter Judge on 23-Mar-2020 16:40

A missing schema will definitely cause that problem for INPUT (or IN-OUT) parameters.  You should probably log a bug to the effect that not all schemas in the invoke signature are written into the gen file.
 
To fix it, you can create a *.map* file with the same name and folder as the .gen, and just add the missing schema in there. The DOH will load both, overlaying the contents of the gen with those of the map.
 
{
"services":
    { "your service name" :
           "schemas": {
               "dsBlah": {
                    // you can see the structure for this in the .gen file
                }
           }
    }
}
 
 
Hth,
-- peter
 
 
 

Posted by Darren Parr on 23-Mar-2020 16:55

OK. That makes sense. That's whats causing the issue.Its definitely missing.

Posted by Darren Parr on 24-Mar-2020 17:17

OK. I have had to do this differently.

I was unable to get anything into the .map file. It just never read it even though it sits right next to the .gen file.

I've also not been able to get an addtional dataset into the .gen either. I even dropped the tt definition into the sole include which was being used for the dataset definition and it didn't import it all. In the end I attached the tt to the dataset to ensure it would get the schema added. I know I could have added the tt defn to the .gen file manually but I didn't like the idea of doping that.

It works although not as expected. My main issue now is how to get thrown errors sent back to the client. DOH just reports an exception which I'd like thrown back. My handler is built on top of the DOH so I choose what requests to send its way or handle myself. A thrown error is something I can catch before it goes back to the client.

This thread is closed