cancel
Showing results for 
Search instead for 
Did you mean: 

Getting response from Servlet in WDPJ

former_member188556
Active Contributor
0 Kudos

Hello,

I have been provided with an Servlet URL to get some details to be populated in an WebDynpro Application.

How should i invoke the servlet url inside the webdynpro application?

Regards

Bobu

Accepted Solutions (1)

Accepted Solutions (1)

Qualiture
Active Contributor
0 Kudos

Hi Bopu,

I believe you could start from the WDProtocolAdapter, i.e.

IProtocolAdapter protAdapter = (IProtocolAdapter)WDProtocolAdapter.getProtocolAdapter();

IRequest requestObj = protAdapter.getRequestObjectInternal();

HttpServletRequest request = (HttpServletRequest)requestObj.getProtocolRequest();

However, I believe a better approach is using the Application Integrator, see http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b0446f5c-fcb9-2910-e082-88becbe3d... for a thorough explanation

Cheers,

Robin

former_member188556
Active Contributor
0 Kudos

Hello Robin,

How can i give the URL for the servlet in the request object?

Regards

Bobu

Qualiture
Active Contributor
0 Kudos

Although I haven't tried it myself, I believe you could just use the normal java URL connection, i.e.

URL url = new URL("http://yourdomain/YourServlet");
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
            
BufferedWriter out = new BufferedWriter( new OutputStreamWriter( conn.getOutputStream() ) );

and then handle the response of your servlet

former_member188556
Active Contributor
0 Kudos

Hello Robin,

I coudnt understand then why we need the Protocol Adapter to call the servlet?

Regards

Bobu

former_member188556
Active Contributor
0 Kudos

This worked. the problem i had was with some security. i was hitting some servers which are outside the dev box.

Answers (0)