SVS on model attribute bound to webservice from entity bean
Hi,
i want to use an SVS on a model attribute. The model comes from a session bean, that talks to an entity bean.
The problem is, that the model attribute has a type of longObject and i think that's the cause why SVS cant be used.
The entity bean belongs to an db table where i use a ddic simple type with enumeration. I think the pure j2ee part between the WebDynpro and the ddic is the problem, why the ddic information cant be transported to the WebDynpro, is it?
So how do i use SVS for a model attribute that is bound to a webservice, that comes from a session/entity bean?
Thanks in advance!
Oliver
hii Sudheer,
The web service creation is getting fine for local project, but wat i want to do is to create a webservice for a session bean in EJB DC ....
So how can i change workspace of DC?? Its stuff goes into DTR rite?
how do u change the workspace of DC project??
regards,
Amey
Similar Messages
-
Creating Webservice with entity bean
I am trying to create a webservice(using entity bean). Using ANT i am building
up the .ear file. My source files are placed in a directory (c:\test) . I have
set the path and invoked ANT .In the build.xml file , when it is trying to compile
the ejb classes , it gives me the following error:
ERROR: Error from ejbc: Could not locate bean with ejb-name 'EBankEJBean'
in weblogic-ejb-jar.xml
Can anybody pls help me out !
thanx
arthiWLS 7.0 only supports stateless session bean or a plain java
class as web service.
From your post it seems you have trouble doing ejbc.
You will get better answer if you post this in the ejb
newsgroup.
regards,
-manoj
"arthi" <[email protected]> wrote in message
news:[email protected]..
I am trying to create a webservice(using entity bean). Using ANT i am building
up the .ear file. My source files are placed in a directory (c:\test) . I have
set the path and invoked ANT .In the build.xml file , when it is trying to
compile
the ejb classes , it gives me the following error:
ERROR: Error from ejbc: Could not locate bean with ejb-name 'EBankEJBean'
in weblogic-ejb-jar.xml
Can anybody pls help me out !
thanx
arthi
[att1.html] -
How to retrieve information from entity beans?
Hi all!
I have a problem while trying to get information from entity beans. Here it goes:
There are two entity beans with 1:N relationship between them.
A FacadeSB is used to find a single record in one entity bean, using the findbyPrimaryKey method.
What is required now is to get information from the other entity bean matching the record found from the first entity bean.
to become more clear, the db schema is like that:
vehicle_table
vehicleid (vehicle_pkey)
name (type of vehicle i.e. car, bike, atv, etc)
brand_table
brandid (brand_pkey)
name (brand name e.g. ferrari)
vehicleid (foreign key to vehicle_table)
a FacadeSB gets the vehicle_table info and passes them to a servlet generated dropdown.
what is the best way to populate a brand dropdown based on the vehicle dropdown selection?
thanx in advance
I hope the problem definition is clear enough for you guys...thanx for the reply
i'm ok with the finder methods you suggested. my main concern in whether to create another FacadeSB to access the brand EJB. I don't believe that's the way to go on i.e. creating a session bean for every EJB created. Shall i use the VehicleFacadeSB to access brand EJB as well?
I can undestand that such an implementation would be a quick fix as well as not such a resources hungry hack but on the other hand, would it make any sense architecturally?
any suggestions?
Zac -
How to return Collection from from entity bean to servlet?
hi
is it possible to return Collection from entity bean (Which is returns form CMR field ) to servlet ?
thanksSERVLET
public class test extends HttpServlet {
@EJB
private LocalBean lookupBean;
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
for(Item i : lookupBean.getMyCollection() )
out.println(i.getItemName());
out.close();
}BEAN INTERFACE
public interface BeanLocal {
Collection<Item> getMyCollection();
}BEAN IMPLEMENTATION
@Stateless()
public class Bean implements BeanLocal {
@PersistenceContext()
private EntityManager em;
public Collection<Item> getMyCollection() {
return em.createQuery("SELECT i from ITEM i").getResultList();
} and if you create an instance of your servlet you'll have to reinitialize LocalBean
@EJB(name="myejbref", beanInterface=BeanLocal.class)
private BeanLocal lookupBean;
private BeanLocal getLookupBean() {
if(lookupBean == null) {
try {
InitialContext ic = new InitialContext();
lookupBean = (BeanLocal) ic.lookup("java:comp/env/myejbref");
catch(Exception e){
System.out.println(e.getMessage());
return lookupBean;
} -
Call bounded task flow from managed bean
Hi experts,
can we call a bounded task flow from a managed bean?
if yes , please explain.....
Thankz in advance
PMSHi john,
Thankz for ur reply........sorry if im asking stupid questions.
this is my tree selection handler
public void treeSelectionHandler(SelectionEvent selectionEvent) {
RichTree tree1 = (RichTree) selectionEvent.getSource();
RowKeySet rks2 = selectionEvent.getAddedSet();
Iterator rksIterator = rks2.iterator();
if (rksIterator.hasNext())
List key = (List)rksIterator.next();
JUCtrlHierBinding treeBinding = null;
treeBinding = (JUCtrlHierBinding) ((CollectionModel)tree1.getValue()).getWrappedData();
JUCtrlHierNodeBinding nodeBinding = nodeBinding = treeBinding.findNodeByKeyPath(key);
DCIteratorBinding _treeIteratorBinding = null;
_treeIteratorBinding = treeBinding.getDCIteratorBinding();
JUIteratorBinding iterator = nodeBinding.getIteratorBinding();
String keyStr = nodeBinding.getRowKey().toStringFormat(true);
iterator.setCurrentRowWithKey(keyStr);
JUCtrlHierTypeBinding typeBinding = nodeBinding.getHierTypeBinding();
String targetIteratorSpelString = typeBinding.getTargetIterator();
if (targetIteratorSpelString.equals("${bindings.Iascat1View1Iterator}"))
System.out.println("Tree Selected*************"+targetIteratorSpelString);*
else
if(targetIteratorSpelString.equals("${bindings.Iascat2View1Iterator}"))
*System.out.println("Tree Selected**************"+targetIteratorSpelString);*
else
*System.out.println("Tree Selected**************"+targetIteratorSpelString);*
I hav bounded task flow for each iterator for creating new record......i hav to replace code for calling bounded task flow instead of printing statement
PMS -
Retrieving auto inc primary key from entity bean (MySQL DB)
Hello,
I searched the forum intensively, but did not find an answer for the following problem.
I've set up an MySQL database "Location" with two fields (ID, Description), ID is my primary key and I've added the AUTO_INCREMENT flag to this field. This works fine, i can add a row in the table with my entity bean "Location" from my session bean :
Location l = new Location();
l.setDescription("at home");
em.persist(l);
and even when I ask this location back from the DB, there is no problem :
Location l = em.find(Location.class,1);
return l.getDescription();
The rows in the table increment nicely. The problem however is, that you don't allways know the ID. So I would like to do the following from my session bean:
Location l = new Location();
l.setDescription("at home");
em.persist(l);
int id = l.getId();
the getID method allways returns a null object. The row is added in the DB, but the auto incremented ID is not returned to the entity bean!
I know I could solve this by generating the ID's myself, but one of the strengths of autoincrement should be not to have to do this, no?
If anyone has a clue how to solve this issue, I would very much appreciate it !
Michiel
Edited by: Michiel82 on Dec 6, 2007 6:01 AMNo reactions so far ... this is a work-around for the issue :
I've created an additional table sequence with two fields: gen_key and gen_value. Then, in my Location entity bean I can add the following:
@TableGenerator(
name="locationGen",
table="sequence",
pkColumnName="gen_key",
valueColumnName="gen_value",
pkColumnValue="location",
allocationSize=1
@Id
@GeneratedValue(strategy=GenerationType.TABLE,generator="locationGen")
@Column(name = "id", nullable=false)
private Short id;
This generates the primary key in the bussiness logic, but I would like to get the autogenerated key from my MySQL database (see previous post). Is this perhaps not supported by EJB3.0?
Michiel -
Creting tables from Entity Beans
Hi, I have a question, but I'm not sure where to post it, so I'll try here. I'm using JDeveloper 10.1.3.3, and the embedded OC4J server. I have a database with some tables, tried the Entities from Tables (EJB 3.0) and worked great.
Now I defined some classes, with all the annotations needed to persist them. But whenever I try to persist (or merge), nothing happens.
Are the tables supposed to be created when the application is deployed to the OC4J server? IS the app redeployed every time I recompile and restart the server?
Cheers,
HernánThe tables are not created by default. You can configure your persistence.xml to define how you want tables to be created. The persistence.xml properties are defined in the TopLink class, EntityManagerFactoryProvider (oracle.toplink.<essentials>.ejb.cmp3).
Set the property, "toplink.ddl-generation" to "drop-and-create-tables" if you want them recreated every time your redeploy. Note this will delete all previous data in the tables, so make sure you do not leave this setting on when you go into production. -
Retrieve data from entity bean to struts and display in JSP
I am integrating Struts+EJB3.0.
Now i need to retrieve data stored in mysql database through entity bean to struts framework*(Action Form*).Then i need to display it in JSP page.(display using combo box).
Please Any one give suggestions!!!!!
Thanks in advanceI got the solution.
--Jagan.+ -
Calling webservice from webdynpro thru model(webservice created from BAPI)
Hi all
i have created one webservice from Functional module in backend system(ECC) and also i released the same webservice in backend(ECC) thru the TCODE wsconfig.
my questions are
1) how to execute that created Webservice in backend system itself(ECC). can you please send the execution steps for webservice in ECC system.
2) how to call from webdynpro thru model for that created webservice from functional module. can you please send the execution steps for the same. here there are three options while model for webservice like local server,Local file system and UDDI or URL.
Regards
Sunil
[points are always rewardable]hi!
Below are good documents on Webservices
Adaptive webservice model
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/900bbf94-a7a8-2910-e298-a651b4706c1e
Re Importing of Web Services in Simpler way
Re Importing of Web Services in Simpler way
Using RFC as WebService in WebDynpro
Using RFC as WebService in WebDynpro
Enterprise Applications with webservices and Web Dynpro
The specified item was not found.
Regards
vishal -
Calling Stateful & Statless Methods from the same Entity Bean[EJB2.0]?
Dear All,
We using EJB2.0........
Regarding segregation of stateless and stateful methods..These methods are defined in Session bean.Now my question is
Is it a good practice to call Stateful and Stateless business methods from same single entity bean("EntityBean") defined at program level by extending MainBean..
The architecture is like
public class EntityBean extends MainBean
Public Methodxyz
stfobj.MakeConn();
stlobj.getXyz();
stfobj.CloseConn();
Public Class MainBean{lookup("stl");lookup(stf) ;stl_obj=home.create;stf_obj=home.create()............}
ejb-jar.xml
{ <session>
<description>Entity Bean Employee Example</description>
<ejb-name>stl</ejb-name>
<local-home>com.packg.stlHome</local-home>
<local>com.packg.stl</local>
<ejb-class>com.packg.stlBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
<session>
<description>Entity Bean Employee Example for stateful</description>
<ejb-name>stf</ejb-name>
<local-home>com.packg.stfHome</local-home>
<local>com.packg.ejbeans.stf</local>
<ejb-class>com.packg.stfBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
</session>
<session>
<description>Session bean for System Parameters</description>
<ejb-name>SysParam</ejb-name>
<local-home>com.packg.Home</local-home>
<local>com.packg.Param</local>
<ejb-class>com.packg.Bean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<ejb-local-ref>
<ejb-ref-name>stl</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.packg.stlHome</local-home>
<local>com.packg.ejbeans.stl</local>
<ejb-link>stl</ejb-link>
</ejb-local-ref>
<ejb-local-ref>
<ejb-ref-name>stf</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>com.packg.stfHome</local-home>
<local>com.packg.stf</local>
<ejb-link>stf</ejb-link>
</ejb-local-ref>
</session>
Thanks !!
Edited by: user9052593 on Jun 18, 2012 2:20 AM
Edited by: user9052593 on Jun 18, 2012 2:25 AMAll Business logic resides in session beans[Stateful or Stateless]..For stateful beans we are opening connections in entity bean ,calling business methods and closing connection in entity bean itself..Problem is
I am doing lookup for stateful and stateless both since both objects are called by extending MainBean in same entity bean else will give null pointer exception..
So whenever i call a Stateful or Stateless method from entity bean Which ultimately extends/calling MainBean and thereby calling home.create methods of stateful and stateless both..creating objects..Is this way fine or it will affect the performance?
Do i need to segregate the Calls/invokation to Stateful / Stateless methods at entity bean level too..
For ex:- Whenever i call Methodxyz() method ..at the same time it create 2 objects as its extending MainBean...i want to extend/create 1 object either of stateful or stateless one for stateful and stateless methods call respectively..
See the code in entity bean is like
public class EntityBean extends MainBean
Public Methodxyz
stfobj.MakeConn(); call to stateful method defined in stateful bean
stlobj.getXyz();// call to stateless method defined in stateless bean
stfobj.CloseConn(); call to stateful method defined in stateful bean
------------------------------------------------------------ -
Validation of context attributes with adaptive webservice model
Hi, I am creating a Web Dynpro Java application (on top of Netweaver AS 7.0) using an adaptive webservice model to invoke a webservice.
The webservice has some request attributes of type string with limited length (for example limited to 1 character). I bound the model to component controller context and created a mapping between the component controller context and view context. In the view, I created a form which is bound to the context attributes.
When user enters string values, which are longer than the maximum length specified in webservice WSDL, and submits the form, an exception is thrown when Web Dynpro runtime is trying to assign entered values into context attributes:
com.sap.dictionary.runtime.DdCheckException: Length of character string "abcdef" must be smaller than or same as MaxLength 1;
at com.sap.dictionary.runtime.DdTypeString.checkValid(DdTypeString.java:195)
at com.sap.tc.webdynpro.model.webservice.base.model.BaseGenericModelClass.setAttributeValue(BaseGenericModelClass.java:304)
at com.sap.tc.webdynpro.model.webservice.gci.WSTypedModelClass.setAttributeValue(WSTypedModelClass.java:62)
at at.gov.bmf.demo.comp.employee.model.OrganizationalAssignment.setEmployeeGroup(OrganizationalAssignment.java:52)
at at.gov.bmf.demo.comp.employee.wdp.IPublicEmployeeDemo$IOrganizationalAssignmentElement.wdSetObject(IPublicEmployeeDemo.java:1552)
... 32 more
This exception is thrown before my non-validating action is executed, so I am not able to prevent it or handle it.
Is there any way how to catch this exception or prevent it?
Does anyone know where these model restrictions are stored? I searched the XML files generated for the model, but I haven't found anything. Does the Web Dynpro runtime access WSDL everytime it needs to validate request parameters?
Thanks,
TomasNo ,This is the preferred and safer way to separate the Model Node and and Input Node and relationship between them by using mapping.
You create your context structure for input and then on action set user input to model data.
Safer it means : Sometimes it happen that model data not populated properly due to network or wrong user input etc ,this time our presentation will be safe and display the proper error message rather the screen went away with null pointer exception.
Regarding your - it require a lot of work. It too much convince for us that rather than writing 50 lines of code
for only input length validation WebDynpro provides us a better model driven solution.
Best Regards
Satish Kumar -
Reimporting WebService from Service Registry into WD Model (DC type = WD)
Hello
We're facing a strange behaviour when trying to reimport a webservice from our service registry. We renamed some attributes in our application service / business object (within CAF), generated, built and redeployed everything and then did the reimport within our other DC (type Web Dynpro).
We did this several times already and it worked fine so far. Somehow today it happens that the reimport itself works but the renamed attributes do not show up correctly. In fact, they still have its namings as before... so no changes to observe here.
However, within web services navigator the attribute names are reflected correctly.
Because of those renamings not being applied after the reimport of the web service we're stuck on continuing our developments (java code).
We're on NWCE 7.2 SP04, NWDS is on 7.2 SP04 PAT0017
Any suggestions what to do? We tried to remove the exposed web service from within CAF, re-generating, re-building, re-deploying and then re-exposed it again as a web service before trying to reimport it again... all to no avail.
Initially importing the web service into another DC (type WD as well) works fine there, the attribute names show up correctly.
Thanks in advance
Renaud
P.S.
BTW: Does anyone know how to get rid of no more required service groups?Hi Anupama,
Create the custom node and attributes with cardinality 0 to n (refer to [Node and Node element |http://help.sap.com/saphelp_nw70/helpdata/en/92/1d3d41d4cc4c0de10000000a1550b0/content.htm]) and then popoulate node element with Array list values.
Refer to Array List iteration : [Click here|http://social.msdn.microsoft.com/Forums/en-US/csharplanguage/thread/fbb99f25-e15e-40f4-8251-e21ac44424a3/]
Populating the Custom context node : [Click here|NWDS for java 7.1;
Best Regards
Arun Jaiswal -
Setting "model" attribute from java
Hi!
I want to write this uix code in java:
< <table model="${bindings.DepartmentsView1}">
<contents>
<column>
<columnHeader>ss
</columnHeader>
<contents>
<textInput>
</textInput>
</contents>
</column>
</contents>
</table>
Can anybody tell me what should i write here?
table.setAttributeValue(table.MODEL_ATTR,???);
??? = ${bindings.DepartmentsView1}
Thanx in advance: Gabor Nyergessetting the model attribute in java is not supported.
The model attribute is a parse time property. At parse time it is resolved to individually bind the "real" properties. -
Interface Controller context model attribute error
I am trying to create a controller interface as such: I created a DC that goes out and retrieves SAP ID using a RFC call. My controller context is bound to a RFC model. I'd like to expose the SAP ID that comes back from that call within a model attribute to other components. I try to create a model node and corresponding model attribute within the Interface Controller, setting the isInputElement = true. However, as soon as I do this I get a number of compile errors:
"The context model node has not been bound to a model class", "The context model attribute has not been bound to a model property".
Are you not allowed to map model nodes to an interface?Karla,
First, set isInputElement to false. Think again, you are exposint "result" outside but not collecting "input" from outer component.
Next, calculated attributes to the rescue here.
Say, in component controller you have 1..1 / 0..1 model node <i>SapIdQuery_Input</i> with 1..1/0..1 child <i>SapIdQuery_Output</i> that holds <i>System_Id</i> attribute, type <i>string</i>.
Now create in component controller context (right below root node) attribute <i>System_Id</i> of type <i>string</i>, set read-only to true and calculated to true. Switch to source editor and write the following for generated attribute "getter":
if (wdContext.currentSapIdQuery_InputElement() != null &&
wdContext.currentSapIdQuery_OutputElement() != null)
return (String)wdContext
.currentSapIdQuery_OutputElement()
.getAttributeValue("System_Id");
else
return null;
Now add controller usage (of component controller) in interface controller and map attribute in interface controller to calculated attribute in component controller.
If you expirienced problems with mapping, try to create calculated attribute in 1..1 subnode of root context node.
Valery Silaev
SaM Solutions
http://www.sam-solutions.net -
Binding model attributes disables UI elements
Hi ,
I have created a model. and did bind its attributes to the UI elements. RFC is working fine.
But in the runtime all UI elements are disabled bydefault when i bind these to the model attributes but to the same UI element if i bind it to the local attribute its working fine...
I have tried reimpor and recreating model , and also changing the cardinality but not working...
Would not it be possible to bind UI elements to model attributes ? By using model attributes how the UI elements can be enabled ?
Please help me out...
Regards
Sireesha.hi,
this occurs becoz u would have bound the i/p element to a model attibute whose value is null.
to solve dis,
1)create a context attribute in ur view
2)bind the i/p elements to that context attr
3)while executing the rfc , get the value of this context attr and set it to the model attr.
for example if u have a model attr 'name_mo ' which u have to bind to the i/p field element
create a context attr -
name_vn
bind name_vn to the i/p field element
while executind ur rfc,
Test_Input ip = new Test_Input();
ip.setName_mo(wdContext.currentContextElement().getName_vn());
Test_Input is the name of the model node that is bound from model to the view via comp.ctller
Regards
Jayapriya
Maybe you are looking for
-
New drive - can i not use on mac and windows?
A year ago i bought a usb 2 wd external drive which i formatted on windows so that i could use it on both mac and osx - No probs. I now have a seagate 750gb firewire 400 drive (thats formatted to NT) i want to do the same as i did with the usb2 0 ie
-
Getting started in SAP Security
Hi guys, I've been in the industry working as an ETL developer, designer and DBA for a few years now, although mostly worked in a non-sap environment. I'd like to get into SAP Security. I need your input in getting started. What's a good place to sta
-
My online bank says my version of Safari, 2.0.4 (419.3), is old and needs updating inorder to use their banking services adequately. Unfortunately when I go to Apple's Downloads area, I do not see a newer version of Safari. Does anyone know what the
-
How to display Rank with specified columns.
Hi All, I have three columns in my answers. I want to develop the report mak –up looks like bellow. Region Zone Amount Rank max(Amount Count(Amount) 010 010-11 10 2 15 3 010 010-12 5
-
I created a MSVC++ project, and inserted IMAQ ActiveX controls. I compiled and linked it and it runs fine. Now however, after including "niimaq.h", when i try to compile, the compiler throws the error, "error C2872: 'uInt32' : ambiguous symbol", on e