Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Create BAPI as Web Service

Former Member
0 Likes
2,775

Hi,

I have expose a BAPI as a web service.

Application : PA

BAPI : EmployeePersonalData

Method : Create

When i try to test the web serive with the following test data:

Employeenumber (String) = 12345678

Validitybegin (String) = 2001-01-01

Validityend (String) = 2003-01-01

It give me the following error:

=============================================

HTTP/1.1 500 Internal Server Error

Set-Cookie: <value is hidden>

content-type: text/xml; charset=utf-8

content-length: 803

sap-srt_id: 20080128/122539/v1.00_final_6.40/DCCD591434D56BF19BA300145E6770F3

server: SAP Web Application Server (1.0;700)

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"><soap-env:Body><soap-env:Fault><faultcode>soap-env:Client</faultcode><faultstring xml:lang="en">Deserialisation failed</faultstring><detail><n0:SimpleTransformationFault xmlns:n0="http://www.sap.com/transformation-templates"><MainName>/1BCDWB/WSS0080123034217187000</MainName><ProgName>/1BCDWB/WSS0080123034217187000</ProgName><Line>128 </Line><Valid>X</Valid><ReferenceFault><DescriptionText>Error accessing the ref. node 'EMPLOYEENUMBER'</DescriptionText><RefName>EMPLOYEENUMBER</RefName></ReferenceFault><Caller><Class>CL_SRG_RFC_PROXY_CONTEXT</Class><Method>IF_SXML_PART~DECODE</Method><Positions>1 </Positions></Caller></n0:SimpleTransformationFault></detail></soap-env:Fault></soap-env:Body></soap-env:Envelope>

============================================

What wrong with it? Any idea how to resolve this problem?

Regards,

Rayden

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,764

Hi Rayden

It will surely help you.

Please reward pts if help.

Deepanker

Expose BAPI as a Web Service

1. Go to transaction SE80.Select Function Group from drop down menu; enter the function group in which the BAPI (which is to be exposed as Web Service) comes. You can find this Function Group from function module (BAPI) itself. Go to transaction SE37 and enter function module name (BAPI name) and click on display. You can see the function group here under attribute tab .

2. Then from Function Modules list choose the BAPI to which you want to expose as a

Web Service .

3. On right clicking on the BAPI a context menu appears. Click on create and Web Service option .

4. New window will pop up. Click on Continue.

5. Give the name for Enterprise service and short description. Click on continue.

6. New window will pop up.Click on Continue

7. New window pop up. Click on 'Release service for runtime'. Click on Continue.

8. This window pops up. Click on Complete.

9. New pop up window come up asking for Package. Give the package name and click on SAVE button.

10. New window pop up asking for Request . Give request and click on OK.

11. New window comes displaying service definition.

12. Now go to transaction WSADMIN and choose your web service. Go to Web Service menu and choose WSDL option.

13. New pop up window come.Check on Include SAP Feature in WSDL and click on OK.

14. Internet browser will be opened and asking for User Name and Password .

15. After giving values for user name and password, you will get WSDL file opened in internet explorer. SAVE this locally on your computer for further use.

6 REPLIES 6
Read only

Former Member
0 Likes
1,765

Hi Rayden

It will surely help you.

Please reward pts if help.

Deepanker

Expose BAPI as a Web Service

1. Go to transaction SE80.Select Function Group from drop down menu; enter the function group in which the BAPI (which is to be exposed as Web Service) comes. You can find this Function Group from function module (BAPI) itself. Go to transaction SE37 and enter function module name (BAPI name) and click on display. You can see the function group here under attribute tab .

2. Then from Function Modules list choose the BAPI to which you want to expose as a

Web Service .

3. On right clicking on the BAPI a context menu appears. Click on create and Web Service option .

4. New window will pop up. Click on Continue.

5. Give the name for Enterprise service and short description. Click on continue.

6. New window will pop up.Click on Continue

7. New window pop up. Click on 'Release service for runtime'. Click on Continue.

8. This window pops up. Click on Complete.

9. New pop up window come up asking for Package. Give the package name and click on SAVE button.

10. New window pop up asking for Request . Give request and click on OK.

11. New window comes displaying service definition.

12. Now go to transaction WSADMIN and choose your web service. Go to Web Service menu and choose WSDL option.

13. New pop up window come.Check on Include SAP Feature in WSDL and click on OK.

14. Internet browser will be opened and asking for User Name and Password .

15. After giving values for user name and password, you will get WSDL file opened in internet explorer. SAVE this locally on your computer for further use.

Read only

0 Likes
1,764

Hi Deepanker,

I have already expose the BAPI to Web Service. What the BAPI do is to create an employee detail.

The problem now is i enter the required field Employeenumber, and submit it it return an error:

============================================

An error has occurred. Maybe the request is not accepted by the server:

Deserialisation failed

Error accessing the ref. node 'EMPLOYEENUMBER'

============================================

Why is that so?

Regards,

Rayden

Read only

Former Member
0 Likes
1,764

give a sap logon userid and password and store it as a wsdl extension.

Or

Check your SAP logon userid validity with the BASIS team.

may be it will help you.

Reward if help.

Read only

Former Member
0 Likes
1,764

I am also having the same error with a custom function.

this is the trace from sm59

XRFC> ERROR 16:48:08: SOAP Message CL_SOAP_MESSAGE->IF_SOAP_MESSAGE <

XRFC> PART~DESERIALIZEBODY() SOAP Fault Exception caught: : <

XRFC> Deserialisation failed <

I have exposed other web services and i am able to execute those just fine. However, this WS fails. I am using the same user, same auths & i have no problems running the function module in r3.

Read only

Former Member
0 Likes
1,764

I was able to fix my issue.

I was passing the date incorrectly. Originally I passed the date as "20080501", the WS wanted the date passed "2008-05-01".

Read only

0 Likes
1,764

Hello Daniel,

How we can make use of the WSDL file for calling the Webservice from outside the SAP system? I have a RFC FM pointed to a service definition and I have the WSDL file with me.

Can you please guide me how I can make use of this WSDL for the Webservice call?

Thanks for your help in advance.

Thanks,

Greetson