cancel
Showing results for 
Search instead for 
Did you mean: 

Consume Web Service in Web Dynpro

Former Member
0 Kudos

Hi Experts,

I´m currently trying to learn web dynpro development.

Scenario: I have one component which embed two views. One view is for enter customer number and in the other view I will see the name of the customer. The name of this customer is provided in a sap erp2005. I have develop a function modul and wich gave me the appropriate data(customer name). Then I create a web service base on this function module.

When I test this web serviec in WSNavigator, I get the customer name, so the web service is working well.

My Problem is: I can´t invoke this Web Service in Web Dynpro. My steps to invoke web service were: create a model with the web service wsdl and then I add this model in the component (in "Used Models").

I have create a application and assign it to the component. When I "Deploy new archive and Run" the application I be come the error: "Configuration not found for application: demo.sap.com/test_wd3,serviceRefId:7fecf23b-0895-48f3-9902-0e7015a705c3. Please check the configuration details from the NWA. You may have not assigned the Service Group to a Provider System, or the generation of the configuration has failed."

What do I have to consider or to set up?

It is right to assign the input field to the context parameter?

PS: I have followed the steps in this tutorial, but I don´t use XI or PI

http://www.riyaz.net/blog/xipi-consuming-xi-web-services-using-web-dynpro-part-ii/technology/sap/7/

best regards

Anna von Landsberg

Edited by: Anna_von_Landsberg on Dec 8, 2010 4:48 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

PFB link with an example for consuming the Webservice

[/docs/DOC-8061#16 [original link is broken]]

Regards,

Govindu

Former Member
0 Kudos

Hi,

You need to create the Destination in the SOA Management which you have used while creating the model in NWDS

Regards,

Amol

Former Member
0 Kudos

Hi Amol,

how can I do that?

In an other thread I read that I have to set the credentials. Can you tell me the methods in ce 7.2 which are supported?

thank you.

regards,

anna

Former Member
0 Kudos

Hi,

you have to configure the destination as mentioned above and additionally add this two line of code in your execute method:

wdContext.currentRequest_XXXElement().modelObject().setInvokerProperty(Stub.USERNAME_PROPERTY, "username");

wdContext.currentRequest_XXXElement().modelObject().setInvokerProperty(Stub.PASSWORD_PROPERTY, "pwd");

regards,

Ilias

Former Member
0 Kudos

Hi Ilias,

this resolves my problem, thank you!

Best regards

Anna

Sharathmg
Active Contributor
0 Kudos

Hello,

I tried to insert the lines of code above and below execute method.

wdContext.currentRequest_XXXElement().modelObject().setInvokerProperty(Stub.USERNAME_PROPERTY, "username");

wdContext.currentRequest_XXXElement().modelObject().setInvokerProperty(Stub.PASSWORD_PROPERTY, "pwd");

But, I still get the exception.

Could you elaborate the need of the above lines of code? Also, if you could assist me finding the resolution of the issue?

Thank you.

Regards,

Sharath M G

Answers (3)

Answers (3)

Sharathmg
Active Contributor
0 Kudos

You need configure the service. To navigate, right-click on the webservice model in NWDS. It gives you an option to "Configure Destination". Then, Choose the application name in the list of the applications.

You have two options to configure the service.

1. By assigning the Provider system

2. Configure the destination

Option: Configure the Destination

Click on the arrow of the appl. name. Click on edit and choose the tab configuration. Click on configure and follow the wizard and finish the configuration. Finally, Save.

This shoudl resolve the issue.

Regards,

Sharath

Former Member
0 Kudos

Enter "web service model" into the SDN search field.

former_member218672
Active Contributor
0 Kudos
Former Member
0 Kudos

HI,

thanks for this good tutorial. Now I, at least see the views when I deploy and run the application. The problem now is, when I execute my web service (a function module in ERP which is created to a web service, which gave my a customer name when I enter a customer number) I become this error:

"Exception on execution of web service with WSDL URL 'http://xx.sap.xxx.local:8000/sap/bc/srt/wsdl/bndg_E002D399D1A60BF1BC1F005056A967DE/wsdl11/allinone/ws_policy/document?sap-client=100' with operation 'ZTest9' in interface 'z_test6' "

Do you know how to resolve this issue?

best regards

Edited by: Anna_von_Landsberg on Dec 9, 2010 6:28 PM

Sharathmg
Active Contributor
0 Kudos

This looks like an issue with the web service.

Kindly test the WSDL in the Web service navigator.

At times the web service can have null/no data being passed to params but when usign the same in CE environment it needs to be passed. Null/skip option is not permitted when using it in the application.

Regards,

Sharath

Former Member
0 Kudos

Hi Sharat,

when I test the web service in the ws navigator the ws performs without any problems. i assign him the customer number and I get the customer name.

What do you mean by "At times the web service can have null/no data being passed to params but when usign the same in CE environment it needs to be passed. Null/skip option is not permitted when using it in the application."

and how can I resolve this problem?

I´m workin with CE 7.2. This error occured when I edit the customer number in the view and select a button which execute the method "executeWS" to accept the customer number and to gave back the customer name.

In the tutorial above I read that the methd wdDoInit have to be modified, because the NW Demo Enterprise Service are not finished yet. Is this still current? my method looks like this:

public void wdDoInit()

{

//@@begin wdDoInit()

//$$begin Service Controller(-2106034771)

initRequest_ZTest9();

//$$end

//@@end

}

I hope you understand my bad english, sorry..

thank you for your help.

Edited by: Anna_von_Landsberg on Dec 10, 2010 11:32 AM

Former Member
0 Kudos

Hi,

I have the following message error:

Exception on execution of web service with WSDL URL

'http://j2eeserver:port/xxxx/Config1?wsdl'

with operation 'RequestNode' in interface

'urn:xxxxx'

When i debugged it, I found the following error:

Cannot find the required parameter [unTipoProducto] in request message content.

What is wrong?, I pasted the code of my method, that call to web service in the component controller.

public void Alta_Entrega( )

{

//@@begin Alta_Entrega()

String tipoProducto = wdContext.currentAlta_EntregaElement().getUnTipoProducto();

Request_Alta_Entrega entregaMO = wdContext.currentRequest_Alta_EntregaElement().modelObject();

if (!wdContext.currentAlta_EntregaElement().getUnTipoProducto().equalsIgnoreCase("")){

IWDMessageManager manager = wdComponentAPI.getMessageManager();

if (logger.beDebug()) {

entregaMO.wdSetInvocationLogEnabled(true); //switch on logging for this model object

}

try{

entregaMO.setInvokerProperty(Stub.USERNAME_PROPERTY,"xxx");

entregaMO.setInvokerProperty(Stub.PASSWORD_PROPERTY,"xxx");

entregaMO.execute();

wdContext.nodeResponse().invalidate();

wdContext.nodeAlta_Entrega().invalidate();

}catch (Exception e){

manager.reportException(e.getMessage(),false);

}

logger.debugT(entregaMO.wdGetRequestLog()); //request log (HTTP header + SOAP request)

logger.debugT(entregaMO.wdGetResponseLog()); //response log (HTTP header + SOAP response)

logger.debugT(entregaMO.associatedModelClassInfo().getModelInfo().toString()); //model metadata in XML format

logger.debugT(entregaMO.toString()); //model object tree in XML format (= model context node content)

}

I hope you can understand me, because my english is very bad!!.

Thank you.