cancel
Showing results for 
Search instead for 
Did you mean: 

Using custom request handler.

former_member184111
Active Contributor
0 Kudos

Hi All,

I craeted a request handler class by implementing the interface if_http_extension.

the code is:

method IF_HTTP_EXTENSION~HANDLE_REQUEST.

data: my_response type string ,
      itab_header_fields type tihttpnvp,
      wa_header_fields type ihttpnvp .

      server->request->get_header_fields( CHANGING FIELDS = itab_header_fields ).

      concatenate '<HTML>'
                  '<BODY>'
                  '<TABLE>'
                  into my_response .

      loop at itab_header_fields into wa_header_fields .
      concatenate
                 my_response
                 '<TR><TD>'
                 wa_header_fields-name
                 '<TD><TD>'
                 wa_header_fields-value
                 '</TD><TR/>'
                 into my_response .

       concatenate
                  my_response
                  
'</H2>DEMO:Own Request Handler</H2>'
                
                  '</BODY>'
                  '</HTML>'
                  into my_response .

                 server->response->set_header_field( name = 'Contentp-Type'
                                                     value = 'text/html'  ).

                  server->response->set_cdata( data = my_response  ) .

                  if_http_extension~flow_rc = if_http_extension=>co_flow_ok .
     endloop.

endmethod.

The calss is activated.

How can i test the handler that i have created?

I know i have to create a node in sicf txn and make an entery in the request handler table,but where to create the node and how to make entery in the request handler table.

BR,

Anubhav.

Edited by: Anubhav Jain on May 15, 2008 11:02 PM

Accepted Solutions (1)

Accepted Solutions (1)

GrahamRobbo
Active Contributor
0 Kudos

Hi Anu,

you can create the ICF node anywhere in the service hierachy. There are some security aspects that might prevent you placing it in some SAP specific areas.

If your organisation has a registered namespace you should create a new indepenedent service at the top level, the same level as default_host/sap, and give it the same name as your namespace.

I usually create my test areas at this same level. Then create your service underneath this container service.

Cheers

Graham Robbo

former_member184111
Active Contributor
0 Kudos

Hi Robinson,

Thanks for the reply.

Actually i am trying the example give in the book written by Fredric Heinemann and Christian Rau.

Here it is written that:

"To test the event handler that you have created , generate a service entery in the ICF tree.The service node ZMY_HANDLER was generated in the ICF path default_host/sap" .

Till here its fine but nextt it says:

"For this example Enter the handler that you created in the request handler table and save your enteries.

If you now enter the URL of the service in the web browser, the handler you created is executed."

Now my question is how to make the entery in request handler table?

BR,

Anubhav.

GrahamRobbo
Active Contributor
0 Kudos

Hi Anu,

navigate to the service in the ICF hierachy (transaction SICF). Double-click on the service node. Click on the Handler List tab. Click the Change button, add your handler class and click Save.

Cheers

Graham Robbo

former_member184111
Active Contributor
0 Kudos

Hi Graham,

When i double click on the node SAPconnect just below the node default_host and enter my handler class name in the Handler List tab , i get an error that class Z_CL_HTTP_MY_US does not implements interface if_http_extension , eventhough i have implemented the interface in my class .

The node SAPconnect is also greyed out.

Any ideas on this error?

Thanks for the replies.

BR,

Anubhav.

GrahamRobbo
Active Contributor
0 Kudos

Hi Anu,

you need to create your entries hierachically under "default_host". Expand the tree under "default_host" and you will see a service node called "sap" and possibly others as well. This is where you need to create your HTP services.

The SAPconnect service is the SMTP handler for email.

When you have created the service node(s) you want you will need to activate them from the context menu.

Cheers

Graham Robbo

former_member184111
Active Contributor
0 Kudos

Hi,

Created a node under default_host and added the custom class to handlers tab, activated the service and then tried to test..browser shows the message

404 Not Found

* SAP J2EE Engine/7.00*

The requested resource does not exist.

*Details: *

Go to main page of this application!

BR,

Anubhav.

GrahamRobbo
Active Contributor
0 Kudos

Hi Anu,

This message indicates that the ICF directed the request to the J2EE stack rather than the ABAP stack.

Check your URL to make sure it is correct. Test the service by right-clicking on the service node in the ICF hierachy and selecting "Test".

Failing that get your system admin guys to check it out.

Cheers

Graham Robbo

Answers (0)