on 09-28-2005 6:44 PM
Hi Everyone: I am attempting to build a first, very simple Web Dypro application that goes beyond the tutorial materials. I have a web service (that I've tested!) that resides on the same Web AS, and I want to display the rows of the table in a Web Dynpro Table object. I have so far:
1) Connected the Controller Context to the Model, and dragged all of the items below the 'response' node of the Web Service to create an tree in the context
2) I connected the View Context to the Controller Context.
Nothing happens when I load the Web Dynpro page. I suspect I need to add some code to the wdDoInit method, but I'm not sure what object I use to invoke the Web Service.
Anyone point me in the right direction to move forward?
Hi ,
If you are new to WebDynpro then make use of the available teamplates in WebDynpro which will take care of generating the required code for intializing as well as executing the webservice.
1. In the component Controller, create Context using "ServiceController" template.
Right Click on the componentController and you can select this template.
This template will generate the code for intialization of the modelnodes and it will generate a method with "executeXXX()" to call the webservice.
2. In the view, create a button using the "Button Template" and this will call the ".executeXXx()" method in the componentController .
Check this tooo
/people/anilkumar.vippagunta2/blog/2005/07/20/developing-web-application-without-writing-single-line-of-code-my-first-web-log
Regards, Anilkumar
Message was edited by: Anilkumar Vippagunta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi lan,
First of all, you need to bind your component controller context to model.
Map only request model into controller. No need to map response model.
You will get response under request model, when you execute this model.
Then write following code in controller's wdinit method to initialize your model.
ipublic<controller name>.i<model name> model = new <model name>();
wdcontext.node<model node>().bind(model);
If this web service requires some input parameters then set those parameters here as follows.
model.set<parameter>(<value>);
Now, when you execute your webservice write following code.
wdcontext.current<model>element().modelobject().execute();
wdcontext.node<response node>().invalidate();
Regards,
Bhavik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Bhavik!
when I put in
Response_SEManagerServiceViDocument_viewAllSEs
which is the name of my model, the compiler returns:
<b>Response_SEManagerServiceViDocument_viewAllSEs cannot be resolved or is not a type</b>
So then I fully qualified the type, and it works, except that I can't then call the bind method!
I think I am very close to getting this to work, but I am stymied!
Thanks, Ian.
Hi McCallum,
I guess you have mapped Response_SEManagerServiceViDocument_viewAllSEs node instead of Request_SEManagerServiceViDocument_viewAllSEs.
You need to map Request_SEManagerServiceViDocument_viewAllSEs node and execute this node. Under this node you will get response node. This response node will contain result data.
No need to use Response_SEManagerServiceViDocument_viewAllSEs node.
Regards,
Bhavik
Hi Ian,
This tutorial might by of help:
http://help.sap.com/saphelp_nw04/helpdata/en/91/9c2226df76f64fa7783dcaa4534395/content.htm
To invoke the webservice you can add this in component controller's wdDoInit() method:
public void wdDoInit() {
//@@begin wdDoInit()
// create a new instance of the Web Service ModelClass
Request_SendEmailPortType_sendEmail req =
new Request_SendEmailPortType_sendEmail();
// bind new instance of the Web Service ModelClass to the
// independent Model Node ¢WebServiceEmail¢
wdContext.nodeWebServiceEmail().bind(req);
//@@end
}
Imports required:
...//@@begin imports
import com.sap.tc.webdynpro.tutorials.emailws
.model.Request_SendEmailPortType_sendEmail;
import com.sap.tc.webdynpro.tutorials.emailws.wdp.IPrivateEmailWSComponent;
//@@end
You can then add the following code directly in the wdDoInit() method or in an action handler:
public void sendEmail() {
//@@begin onActionSendEmail(ServerEvent)
IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
try {
// call Email Web Service and update dependent model node ¢Response¢
wdContext.currentWebServiceEmailElement().modelObject().execute();
wdContext.nodeResponse().invalidate();
...
} catch(Exception ex) {
msgMgr.reportException(ex.getLocalizedMessage(),true);
}
//@@end
}
Bind the Context elements in the view controller to the Table uielement in the View.
You should be able to retrieve teh table returns by the Web Service.
Regards,
Sangeeta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you created a view with a Table UI element?
Have you bound the table properties (dataSource etc.) to the view context?
Have you embedded the view in a window?
You can either call your web service in the component controller's wdDoInit() method or provide some action trigger (e.g. a button) and call it from the buttons action handler.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.