cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping with multiple adaptive web service model-how to map?

Former Member
0 Kudos

Hi experts,

I hope, someone can help me.

I have a component with TWO adaptive web service model. The first read data from backend system. The second should trigger/start a process in BPM. When I test this two web services in two different components it works without any problems. My problem is: how can I map the params from the first web service, to an other?

My steps are: In the first View I trigger the ws 'readdata', this data are shown in the second view where I can edit them. The next step is to map the edited data from the component controllers context to the second web service model, but this step does not work, I can not map the data with drag and drop.

How are the steps here?

Thanks in advance and best regards

Anna

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi,

After editing the values in second view, you have to write the code in the Action which is bind to to the button for submiting the data to second Web Service.

for that you have to take/read the values from the attributes which are bind to the UI elements in second view and set to the second webservice by using the following code.

wdContext.current<NodeName>Element().set<AttributeName>(wdContext.current<NodeName>Element().get<AttributeName>());

revert back if have any quaries and post the full error details if this code is not worked.

Thanks & Regards,

Bhargava.

Former Member
0 Kudos

Hi,

thank you very much! This resolve this problem!

best regards

Anna

Former Member
0 Kudos

Hi Kumar,

I have an other question: I added this line of code for each attribut. My problem is now: each attibute can have more then one value. When I map the attributes between screens in one component, all values are passed to the next context. But when I map the attributes with the web service, only the first value is passed.

What can I do to resolce this? Can you please tell me this step by step?

Thank you very much!

best regards

Anna

Answers (1)

Answers (1)

Former Member
0 Kudos

the problem is not resolved completely

0 Kudos

Hi Anna,

Can you please give the detailed node structure of your webservice.

Thnaks & Regards,

Bhargava.

Former Member
0 Kudos

Hi Bhargava,

thank you for your effort.

The node structure of web service looks like this:

NewAWS2Model

-Context

-


Number

-


NameFirst

-


NameLast

-


Street

-


HouseNo

-


PostCode

-


City

-NewOperartion

-


In

-Request_NewOperation

---NewOperation

---Response

-Response_NewOperation

This web service give no response back. He just starts the BPM Process. Everything works well, except for passing ALL values of the parameters in Context: Number, Name, Street...

When I have two streets, I want that two streets will be saved in parameter street and so on...

Additionally, here is the method created by application for this web service:

public void initRequest_NewOperation( ) {

//@@begin initRequest_NewOperation()

//$$begin Service Controller1(-482113598)

{

com.sap.demo.changedataportaldc.wd.models.newaws2model.NewAWS2Model newAWS2ModelModel = createAndMapModelInstance_0("com.sap.demo.changedataportaldc.wd.models.newaws2model.NewAWS2Model");

com.sap.demo.changedataportaldc.wd.models.newaws2model.Request_NewOperation request_NewOperation = wdContext.nodeRequest_NewOperation().createAndAddRequest_NewOperationElement().modelObject();

com.sap.demo.changedataportaldc.wd.models.newaws2model.NewOperation newOperation = new com.sap.demo.changedataportaldc.wd.models.newaws2model.NewOperation(newAWS2ModelModel);

request_NewOperation.setNewOperation(newOperation);

com.sap.demo.changedataportaldc.wd.models.newaws2model.Context in = new com.sap.demo.changedataportaldc.wd.models.newaws2model.Context(newAWS2ModelModel);

newOperation.setIn(in);

com.sap.demo.changedataportaldc.wd.models.newaws2model.Response_NewOperation response_1 = new com.sap.demo.changedataportaldc.wd.models.newaws2model.Response_NewOperation(newAWS2ModelModel);

request_NewOperation.setResponse(response_1);

}

I hope this are the inforamtion you need? Or is there something else?

Thank you very much

best regards

Anna

0 Kudos

Hi Anna,

First check whether the Webservice parameters in Context: Number, Name, Street... will accept the multiple values or not.

If no, then change the websrvice parameters accordingly. for example in RFC if parameters are mentioned suparatly in Input parmeters then these will not accept multiple values. if parameters are mentioned in internal table under Table parameters then they will accept multiple values.

If Webservice is accepting multiple values then change your code like

IPrivate<ViewName>view.I<SourceNodeName>Node snode = wdContext. node<SourceNodeName>();

IPrivate<ViewName>view.I<SourceNodeName>Element sele;

IPrivate<ViewName>view.I<DestinationNodeName>Node dnode = wdContext. node<DestinationNodeName>();

IPrivate<ViewName>view.I<DestinationNodeName>Element dele;

for(int i=0; i<snode.size(); i++)

{

sele = snode.get<SourceNodeName>ElementAt(i);

dele = dnode.create<DestinationNodeName>Element();

dele.set<AttributeName>( sele.get<attributeName());

.

.

.

dnode.addElement(dele);

}

Alter this code according to your Source and Destination node stucture.

Hope this will help you.

Revert back if you have any quaries.

Thanks & Regards,

Bhargava.

Former Member
0 Kudos

Do you mean that I have to edit the method initRequest_NewOperation? Do I have to replace this lines of code I sent you with the code you send me?

the params accept multiple values...

thank you very much. it is very important for me to resolve this problem, thank you.

0 Kudos

Hi Anna,

You already witten the code for setting values to 2nd webservice right.

So, replace that code with the code given by me.

Here, change the code according to your requierment.

If stiil you are facing the issue then post the code writen for setting the values to webservice.

Thanks & Regards,

Bhargava.

Former Member
0 Kudos

Hi Bhargavaa,

here is the Code I written before:

wdContext.currentInElement().setBPNO(wdContext.currentItemElement().getNumber());

wdContext.currentInElement().setNameFirst(wdContext.currentItemElement().getNameFirst());

wdContext.currentInElement().setLastName(wdContext.currentItemElement().getNameLast());

wdContext.currentInElement().setStreet(wdContext.currentItemElement().getStreet());

This part of your COde works:

IPrivateChangeBPDataCompView.IItemNode snode = wdContext.nodeItem();

IPrivateChangeBPDataCompView.IItemElement sele;

IPrivateChangeBPDataCompView.IInNode dnode = wdContext.nodeIn();

IPrivateChangeBPDataCompView.IInElement dele;

for(int i=0; i<snode.size(); i++)

{

sele = snode.getItemElementAt(i);

the next line show an error. Sorry, but I´m not a good coder. If you show me the last few lines, I think it will work.

Thank you very very much!

0 Kudos

Hi Anna,

if the cordinality of ItemNode is 0..n/ 1..n (which is source node) and cordinality of InNode is 0..n/ 1..n

then write the following code.

IPrivateChangeBPDataCompView.IItemNode snode = wdContext.nodeItem();

IPrivateChangeBPDataCompView.IItemElement sele;

IPrivateChangeBPDataCompView.IInNode dnode = wdContext.nodeIn();

IPrivateChangeBPDataCompView.IInElement dele;

for(int i=0; i<snode.size(); i++)

{

sele = snode.getItemElementAt(i);

dele = dnode.creatednodeElement();

dele.setBPNO(sele.getNumber());

dele.setNameFirst(sele.getNameFirst());

dele.setLastName(sele.getNameLast());

dele.setStreet(sele.getStreet());

dnode.addElement(dele);

}

if you got any error or exception on this code post that error/exception and pst the line of code wher it is getting.

hope this will help you.

Thanks 7 Regards,

Bhargava.

Former Member
0 Kudos

I have set the cardinality of both(item(source) and In(destnation)) to 0..n.

this line don´t work: dele = dnode.creatednodeElement(); I have to put a model into the bracket.

Eclipse give me this sample: dele = dnode.createInElement(); but here I need a model between the brackets too.

Do you know how to resolve this?

0 Kudos

Hi Anna,

Re-setting the cordinality of model is not the best practice and it will not work properly.

it is very simple. try to understand.

i think while i gone through your code which is writen in initRequest_NewOperation( ) method you have to set the values to context node( which is under NewAWS2Model node.

Thanks & Regrds,

bhargava.

Former Member
0 Kudos

can you please tell me how to resolve this? please..

Edited by: Anna_von_Landsberg on Jan 13, 2011 6:08 PM

Former Member
0 Kudos

here are the affected methods:

public void initRequest_NewOperation( )

{

com.sap.demo.changedataportaldc.wd.models.newaws2model.NewAWS2Model newAWS2ModelModel = createAndMapModelInstance_0("com.sap.demo.changedataportaldc.wd.models.newaws2model.NewAWS2Model");

com.sap.demo.changedataportaldc.wd.models.newaws2model.Request_NewOperation request_NewOperation = wdContext.nodeRequest_NewOperation().createAndAddRequest_NewOperationElement().modelObject();

com.sap.demo.changedataportaldc.wd.models.newaws2model.NewOperation newOperation = new com.sap.demo.changedataportaldc.wd.models.newaws2model.NewOperation(newAWS2ModelModel);

request_NewOperation.setNewOperation(newOperation);

com.sap.demo.changedataportaldc.wd.models.newaws2model.Context in = new com.sap.demo.changedataportaldc.wd.models.newaws2model.Context(newAWS2ModelModel);

newOperation.setIn(in);

}

and the second which is in the view:

public void onActionSave(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

wdContext.currentInElement().setBPNO(wdContext.currentItemElement().getPartner());

wdContext.currentInElement().setNameFirst(wdContext.currentItemElement().getNameFirst());

wdContext.currentInElement().setLastName(wdContext.currentItemElement().getNameLast());

wdContext.currentInElement().setStreet(wdContext.currentItemElement().getStreet());

wdContext.currentInElement().setHouseNo(wdContext.currentItemElement().getHouseNum1());

wdThis.wdGetChangeBPDataCompController().executeNewOperation();

wdThis.wdFirePlugOut();

}

Edited by: Anna_von_Landsberg on Jan 13, 2011 9:09 PM

Former Member
0 Kudos

.

Edited by: Anna_von_Landsberg on Jan 13, 2011 6:23 PM

0 Kudos

This message was moderated.