cancel
Showing results for 
Search instead for 
Did you mean: 

calling abap web service from webdynpro

Former Member
0 Kudos

hi,

i have a problem in that i am trying to call an ABAP web service published from r/3 in webdynpro. when i browse to the url generated by the r/3 application server it asks for my r/3 user name and password (not to be confused with http proxy user name and password). now when i enter it, i can see the generated wsdl without a problem. pressing escape gives me the standard 401 error.

please note this is the r/3 username and password which i am required to enter. when i try to get to the webservice in webdynpro. here is my code:


  public void wdDoInit()
  {
    //@@begin wdDoInit()
    try
    {
		Request_YYMJ_WS_TEST1_DEF1_yymjServiceWebTest1 reekvesta = new Request_YYMJ_WS_TEST1_DEF1_yymjServiceWebTest1();
		reekvesta._setPassword("userid");
		reekvesta._setUser("password");
		wdContext.nodeRequest_YYMJ_WS_TEST1_DEF1_yymjServiceWebTest1().bind(reekvesta);
		wdContext.currentRequest_YYMJ_WS_TEST1_DEF1_yymjServiceWebTest1Element().setWfKunnr("0000000011");
		wdContext.currentRequest_YYMJ_WS_TEST1_DEF1_yymjServiceWebTest1Element().modelObject().execute();
		wdContext.nodeResponse().invalidate();
    }
    catch(Exception e)
    {
		IWDMessageManager msgMrg = wdThis.wdGetAPI().getComponent().getMessageManager();
		String msg = e.getLocalizedMessage();
		if ((msg==null) || (msg.length()==0))
		{
			msg = e.getMessage();
		}
		msgMrg.reportException(msg,true);    	
    }
    //@@end
  }

i have also tried it this way:


  public void wdDoInit()
  {
    //@@begin wdDoInit()
    try
    {
		Request_YYMJ_WS_TEST1_DEF1_yymjServiceWebTest1 reekvesta = new Request_YYMJ_WS_TEST1_DEF1_yymjServiceWebTest1();
wdContext.nodeRequest_YYMJ_WS_TEST1_DEF1_yymjServiceWebTest1().bind(reekvesta);	wdContext.currentRequest_YYMJ_WS_TEST1_DEF1_yymjServiceWebTest1Element().modelObject()._setUser("userid");	wdContext.currentRequest_YYMJ_WS_TEST1_DEF1_yymjServiceWebTest1Element().modelObject()._setPassword("password");
wdContext.currentRequest_YYMJ_WS_TEST1_DEF1_yymjServiceWebTest1Element().setWfKunnr("0000000011");
wdContext.currentRequest_YYMJ_WS_TEST1_DEF1_yymjServiceWebTest1Element().modelObject().execute();
		wdContext.nodeResponse().invalidate();
    }
    catch(Exception e)
    {
		IWDMessageManager msgMrg = wdThis.wdGetAPI().getComponent().getMessageManager();
		String msg = e.getLocalizedMessage();
		if ((msg==null) || (msg.length()==0))
		{
			msg = e.getMessage();
		}
		msgMrg.reportException(msg,true);    	
    }
    //@@end
  }

in both instances i get the error:

Service call exception; nested exception is: com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (407) Proxy authorization required

please note

1. i am trying to test this on my local sap j2ee server, on my workstation. i am not deploying this as of yet to the portal.

2. i do have access to r/3.

3. the r/3 application server is in our corporate intranet, and therefore excluded from being looked up by our proxy.

4. our proxy DOES require a username and password. i added my user name and password to the webservice container section of the visual administrator, and excluded the r/3 server from the proxy list.

what am i missing?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Zafar,

Check the endpoint in generated WSDL. Probably there is a host name that is not in "exclude list" for proxy settings (like IP vs host name, or FQDN vs short host name).

Valery Silaev

SaM Solutions

http://www.sam-solutions.net