cancel
Showing results for 
Search instead for 
Did you mean: 

How to assign values in the webservice and execute it

Former Member
0 Kudos

Hi ,

I m using web Dynpro JAVA and want to execute web service by setting the parameter as the values taken after execution of BAPI.

I m able to display the values fetched from the BAPI in the view controller but when I m trying to set those same values as a parameter of the web service and execute it then it is not displayed in the view controller.

I have initialized the web service and assign the values by using the structure binding and copying all the values from model node to value node and then I assigned the values node as a parameter of the web service and then I execute it.

But the web servide doesnot execute properly.It is not showing me any error.But the problem is unexecution of web service.

Please solve my querry ASAP.

Edited by: dkjha123 on Oct 4, 2010 2:27 PM

Accepted Solutions (1)

Accepted Solutions (1)

former_member214651
Active Contributor
0 Kudos

Hi,

If you are using Adaptive WebService Model, then use the following code to execute a WS Model:

//For Initializing model
MyModel model = new MyModel();
wdContext.nodeRequest_<nodename>().bind(new Request_<nodename>(model));

//Execute the model
wdContext.currentRequest_<nodename>Element().set<inputparameter>(<parametervalue>);
wdContext.currentRequest_<nodename>Element().modelObject().execute();

The above code will be auto-generated if you perform the following steps:

1. Right click on the component controller-->apply template

2. Choose service controller-->next

3. Select the model which u have imported.

4. Select the operation which u want to execute

5. Click finish

Regards,

Poojith MV

Former Member
0 Kudos

Hi Poojith,

I have already done the steps that you have mentioned but in slight different way.

I have initialized the BAPI and Webservice in the custom controller by using the same steps that you have mentioned(Template->Apply Template)and then executed the web service from the view controller.Before that I have made the context in the view controller by using the structure binding and then I executed the Web service by using the same method what you have suggested,but this all i have done in view controller. I have also created the table from the (Apply template) in the view controller .

now please suggest me what should I do next so that my web service should execute .My intention towards executung the web service is to insert some values in the Portal Database.

I am able to fetch the same value from the BAPI and I want to execute the Web service by sending the same values as a parameter of the web service so that the output can be inserted in the Portal Database tables.

former_member214651
Active Contributor
0 Kudos

Hi,

Is your WS giving an error or is it not working the way u want it to? Try testing the WS from WSNavigator to see the behavior.

Regards,

Poojith MV

Former Member
0 Kudos

Hi Poojith,

My web service is not giving any error .I have already tested it through web service navigator and it is working the way I want. But the same is not working when I want to execute it through Web Dynpro Application .I have already executed the steps what you have suggested .Now guide me to the completion of this issue.

Regards,

Deepak Jha

former_member214651
Active Contributor
0 Kudos

Hi,

Please let me know the answers for the below points:

1. Is the WS throwing any error when u try to execute from the WDJ application?

2. Did u import the WS model using logical destinations or any other method?

3. Have you set the input parameters in the expected form for WS?

Also, try printing some statements to check the flow of execution. i.e before setting parameters, before calling execute statement and after execute statement.

It would be easier to single out the problem and may be we can know what is the reason.

Regards,

Poojith MV

Former Member
0 Kudos

Hi Poojith,

1. It is not throwing any error when I try to execute it through WDJ application.

2.I imported the WS model using logical destinations .

3.Yes I set the input parameters in the expected form for WS.

For your refrence

-


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

{

wdContext .currentRequest_R2WebswsViDocument_SOWriteBackElement().setSocc(wdContext.nodeR2So().getR2SoElementAt(i).getComp_Code());

wdContext .currentRequest_R2WebswsViDocument_SOWriteBackElement().setSoid( wdContext.nodeR2So() .getR2SoElementAt( i).getEmployee());

wdContext .currentRequest_R2WebswsViDocument_SOWriteBackElement().setSoname( wdContext .nodeR2So() .getR2SoElementAt(i).getEe_Sname());

wdContext .currentRequest_R2WebswsViDocument_SOWriteBackElement().setSoso( wdContext .nodeR2So() .getR2SoElementAt(i).getSales_Off() );

wdContext .currentRequest_R2WebswsViDocument_SOWriteBackElement().setSostatus( wdContext .nodeR2So() .getR2SoElementAt(i).getEmplstatus());

String msg1= wdContext .nodeR2So() .getR2SoElementAt(i).getEe_Sname();

wdComponentAPI.getMessageManager().reportSuccess("Successfully submited values"msg1"<BR>");

}

// for the execution:-

-


wdThis .wdGetSoWriteBackCustController() .executeRequest_R2WebswsViDocument_SOWriteBack() ;

//for checking the execution

-


wdComponentAPI.getMessageManager().reportSuccess("Successfully submited values");

former_member214651
Active Contributor
0 Kudos

Hi,

Does the WS return any output after execution? i.e after this line?

// for the execution:-
wdThis .wdGetSoWriteBackCustController() .executeRequest_R2WebswsViDocument_SOWriteBack() ;

If there is no error from the WDJ program in calling the WS, u will have to check with the person, who has developed this WS. maybe there are some data type mismatch when updating the Portal DB.

Regards,

Poojith MV

former_member185879
Active Contributor
0 Kudos

Hi,

C_Item c_Item = new C_Item(createCWSModel);

C_Item_Item c_Item_Item;

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

{

c_Item_Item = new C_Item_Item(createCWSModel);

if(wdContext.nodeChnIt_Create_C_Item().getChnIt_Create_C_ItemElementAt(i).getAmount()!=null)

c_Item_Item.setAmount(wdContext.nodeChnIt_Create_C_Item().getChnIt_Create_C_ItemElementAt(i).getAmount().toString());

if(wdContext.nodeChnIt_Create_C_Item().getChnIt_Create_C_ItemElementAt(i).getMaterial()!=null)

c_Item_Item.setMaterial(wdContext.nodeChnIt_Create_C_Item().getChnIt_Create_C_ItemElementAt(i).getMaterial());

c_Item.addC_Item_Item(c_Item_Item);

}

Try this snippet and let me still u r facing any problem?

Regards

Nizamudene SM

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Which kind of web-service you are executing after BAPI. If it is java web-service, then try executing it in the wsnavigator.

Also check logs for exceptions.

Regards,

Manoj

junwu
Active Contributor
0 Kudos

what's your environment? the configuration will differ on different nw release.

have you test the ws with other tool like soapUI?

there must be some log info, please check it carefully.

debug it if possible.