cancel
Showing results for 
Search instead for 
Did you mean: 

Web Service Consumption in Web Dynpro Java

Former Member
0 Kudos

Hi,

I'm using NetWeaver 2004s for Java. I have generated a Web Service out of a BAPI. I use that Web Service in a Web Dynpro Java Application as Model. Model generation works fine. But when I call the Web Service during execution of the corresponding Web Dynpro Application, I get the following Exception:

"java.rmi.RemoteException: Service call exception; nested exception is: java.lang.Exception: Call to returned http code 500 with unacceptable content type (text/html; charset=iso-8859-1). <HTML> <HEAD> <TITLE>Unknown Host</TITLE> </HEAD> <BODY BGCOLOR="white" FGCOLOR="black"> <H1>Unknown Host</H1> <HR> <FONT FACE="Helvetica,Arial"><B> Description: Unable to locate the server named "<EM>us0308.wdf.sap.corp</EM>" --- the server does not have a DNS entry. Perhaps there is a misspelling in the server name, or the server no longer exists. Double-check the name and try again. </B></FONT> <HR> </BODY>"

Testing the Web Service via transaction WSADMIN works fine. Can anybody give me an advise how to solve that problem?

Thanks in advance!

Regards,

Frank

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Frank,

I guess you've missed out the corresponding entry in the hosts file for your hostname "us0308.wdf.sap.corp". It is mandatory to make an entry in the hosts file for hostname resolution.

Go to the hosts file licated at <drive>:\windows\system32\drivers\etc\

Then add the following entry : us0308.wdf.sap.corp <IPaddress>

I guess it should work once you add this entry.

Bala

Former Member
0 Kudos

Hi,

thanks for your help. The problem was caused by a change in the backend, invalidating my web service. After adapting my web service model I have got another problem. My web service requires basic user authentication. When I hard code a user name and password in my Web Dynpro Component it works fine. But that is not a solution for the component. Therefore I removed the hard coded username and password and expected to be forced to enter a user name and password when the web service is called. But that doesn't happen. Instead I get the error message:

java.rmi.RemoteException: Service call exception; nested exception is: com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (401) Unauthorized. The requested URL was:"http://us4089.wdf.sap.corp:50004/sap/bc/srt/rfc/sap/ZFlight_Getlist?sap-client=002"

Can anybody give me a hint how to solve that problem?

Thanx and regards,

Frank

Former Member
0 Kudos

Hi Frank,

In my case, I'm calling the model (web service) from my custom controller, and before you call the bind() method you're able to change some parameters like user and password, following an example for you:


//@@begin javadoc:wdDoInit()
  /** Hook method called to initialize controller. */
  //@@end
  public void wdDoInit()
  {
    //@@begin wdDoInit()
    //$$begin Service Controller(-1255648863)
    
	Request_CAFDataServiceViDocument_checkRights
                      checkRightsWS = new Request_CAFDataServiceViDocument_checkRights();
	checkRightsWS._setUser("Administrator");
	checkRightsWS._setPassword("abcd1234");
    wdContext.nodeRequest_CAFDataServiceViDocument_checkRights().bind(checkRightsWS);
    //$$end
    //$$begin Service Controller(-662872299)
 
    //$$end
    //@@end
  }

Hope it helps you!!

Regards!

Danilo Andrade

former_member197348
Active Contributor
0 Kudos

Hi Frank,

If the proble is with authorizations, try this solution.

https://www.sdn.sap.com/irj/scn/wiki?path=/pages/viewpage.action&pageid=74383659

Regards,

Siva

nitin_mahajan2
Contributor
0 Kudos

Had Exactly same problem with authorization issues on the server hosting the webservices.

Create a CPIC user Id on the server hosting the webservice. The user id should have authorization to execute the webservice.

Create a webservice destination in VA for the said webservice using the user id

1. Log on to the J2EE Engine as an administrator using the Visual Administrator.

2. Expand -> Server ->Services.

3. Select the Destinations service.

4. Under Destinations, select HTTP and choose New

You need to create two destinations one for matadata and another for execution data.

Use the destinations while creating the WS model in NWDS.

if you have issues importing the model using the URL, you can create the model using the WSDL and use the WS Destinations to execute it.

I am following the same approach after i had faced similar issues with webservices on PI7.1 and Portal 7.0

About the option to use _setusername, _set...., not all webservices come with the _set methods.

and moreover if you do that, it would be more of hardcoding in the code, which should be avoided.

Regards,

Nitin

Edited by: Nitin Mahajan on Jun 11, 2009 6:11 PM

Former Member
0 Kudos

Hi all,

I am also facing some problem while consuming the web service. We have created the destinations through visual admin & cosnumed the web service through wsdl file.

Application running fine but when we try to exwecute the web service following Exception occures :

Exception on execution of web service on destination 'CORDYS_EXE' for operation 'RunProcess_SMS_MIDE_SAP1' in interface 'ProcessesinSMS_SAPPortType'

Any Help on same.

Regards,

Abhay

Former Member
0 Kudos

Hi Abhay

Have you solve your problem?

If yes, can you post the solution. I have the same problem and didn't find the solution.

Regards

Marcos

Former Member
0 Kudos

Hi Frank,

Normally the return content type should be of type "text/xml" where it is returning "text/html".

Please check the properties while creating the webservice in the backend system and try again.

Best Regards, Anilkumar