cancel
Showing results for 
Search instead for 
Did you mean: 

Consume Web service in ABAP

debdatta_panda
Participant
0 Kudos

Hi All,

         I have one scenario..Our client is using AMT software..I have created one RFC Function Module and developed Webservice for that Function Module..I have created service consumer also..In SOAMANAGER I have created one logical port..I want to know that when client access webservice and send data to web service then How I access those data in sap abap..Where I have to write the code???This code will automatically trigger and return a result data to client  through webservice...Please help..

Accepted Solutions (0)

Answers (1)

Answers (1)

PeterJonker
Active Contributor
0 Kudos

You developed a function module and created a service consumer ?

it should be a service provider in soamanager if you are the one who exposes SAP functionality through a webservice based on your function module.

If you want to call a webservice outside SAP from your client in ABAP then you will need to create a consumer in soamanager from the wsdl provided by your client and implement the generated proxy in your abap code

debdatta_panda
Participant
0 Kudos

Hi Peter,

Actually the scenario is that,this is the integration between AMT s/w and SAP..The client's has AMT..They have pressed the button(Create Work Order) in AMT,which is web based..After that automatically a Plant Maintenance Work Order will be created in SAP..This purpose will be solved through Web Service..They have given me the the XML data which I have to consume from SAP side..

I have done the following steps..

1.First I have developed a RFC function module..Then I have created Web Service from that function module.

2.Then I have created service in SOAMANAGER..Then copy the service WSDL URL from overview tab..

3.Then I have created Service Consumer..tick the radio button external WSDL..Then paste the WSDL URL copied from SOAMANAGER..Then I have activated the Service Consumer..Direction is created OUTBOUND..Here Proxy name is shown in Service consumer..I didn't find where in the proxy class I have to write the code..Also please tell me the how to consume the XML data to ABAP  for creation of PM maintenance Order..They will give the detail of data for create the PM maintenance Order.

4. At last I have created Logical Port For Consumer Proxy which has the configuration type "WSDL Based Configuration" and WSDL base is "Via HTTP Access"..Then also put the WSDL URL and user id and password..

When the client will press the button "Create WO" in their AMT S/W then a XML data will send to Web service and I have to capture this data automatically in SAP and process these data and create PM maintenance Work Order and send the No. Of PM work Order to AMT side...

These total process will be automatically..

Please tell me what step I have skipped to achieve this Interface...

If you demonstrate me step by step then It will be very helpful for me...

Please help...

PeterJonker
Active Contributor
0 Kudos

In AMT is the push a button which needs to lead to a PM order in SAP.

In that case AMT is the consumer and SAP is the provider (service). So instead of creating a consumer proxy in soamanager you need to create a service/endpoint in soamanager.

The RFC function module (if no BAPI exist already, I think there is) is the abap code that creates the order after the web service call.

So create or find this function module/BAPI. Create a webservice out of this function module and configure the service in SOAMANGER (AS a service/endpoint NOT as a consumer proxy).

Now send the wsdl from soamanager to AMT so they can implement the webservice call.

That is it.

Peter

debdatta_panda
Participant
0 Kudos

Hi Peter,

             I have already created service in SOAMANAGER..I want to know that when I consume the WSDL data in the form of XML,then how can I transform it in ABAP??

Also please tell me that Can I develop the code for consume XML data and then put these data into BAPI and create PM Work Order in the RFC which I have created..Or I have to write the code in Proxy class...

PeterJonker
Active Contributor
0 Kudos

Hi Debdatta,

I am a bit confused right now. The function module that you say you have created should be the function module that creates the order. So all code is in there.

Once you have created  a webservice out of this function module and configured an endpoint (so NOT a consumer proxy !!!!!!!) you are basically finished.

You give the wsdl from soamanager to the counterpart (AMT) so they now how and where to call the SAP service.

There is nothing else for you to do. There is no proxy to call because you (SAP) are the service provider.

If you need to call a webservice from abap then you would create a consumer proxy and need to call this proxy in your abap code, but that is not the case in your scenario.

I hope I have been clear. Please read my posts carefully, because by your responses it looks to me that you do not know what to do.

You say they have given you the xml data which you need to consume, but that is wrong.  You need to give them the wsdl because you are the service provider since you are creating a work order in SAP. There is nothing to give by AMT. You are the leading party and need to give them the wsdl.

debdatta_panda
Participant
0 Kudos

Hi Peter,

             Thanks.

debdatta_panda
Participant
0 Kudos

Hi peter,

              How are you??I hope you are fine right now.I am facing one problem regarding web service access..Because when I am accessing the web service from SOAP tool it is working fine for my user id..But when I want to access it by another user id then its not working..Error is occurred..error is "The remote server returned an error:(401) Unauthorized"..Please give me the way out...

PeterJonker
Active Contributor
0 Kudos

Hi Debdatta,

I am fine thanks. I hope you are fine as well.

The message 401 not authorized means that the user id you are using to call the webservice lacks the proper authorizations.

I am not sure but maybe you can check this with transaction SU53 in the SAP backend after you have had this error message.

If you start transaction SU53 it will give you the authorization checks of your user, but in the main screen you can change the user to the user which gave the error by clicking

fill in the user name and it should show you which authorizations are missing.

Ask basis team to add the missing authorizations for this user.

debdatta_panda
Participant
0 Kudos

Hi Peter,

              I have faced one problem in webservice.I have developed one RFC and created webservice for that function module.Also created a service consumer..When I have called my function module in my SAP server,it is working fine.But when I am going to test it through SOAP testing tool then it is showing the following error..

<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">

   <soap-env:Header xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">

      <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">

         <wsu:Timestamp wsu:Id="ts-D2765CAD8E121ED48FF67C2078E90A01">

            <wsu:Created>2014-09-19T04:17:33Z</wsu:Created>

            <wsu:Expires>2014-09-19T04:19:03Z</wsu:Expires>

         </wsu:Timestamp>

      </wsse:Security>

   </soap-env:Header>

   <soap-env:Body>

      <soap-env:Fault>

         <faultcode>soap-env:Server</faultcode>

         <faultstring xml:lang="en">Processing Error. More details in WS Error Log (transaction SRT_UTIL) by selection with UTC timestamp 20140919041733</faultstring>

         <detail/>

      </soap-env:Fault>

   </soap-env:Body>

</soap-env:Envelope>

Please help...

PeterJonker
Active Contributor
0 Kudos

I have answered you in the other message that you have opened for the same problem.

Don't know why you started another message, that is not ging to speed up anything, but rather slow down a possible solutyion, because people who read one message might give you an answer that you already received in the other thread. So please close one of the two threads you started for this issue.

Thanks.

debdatta_panda
Participant
0 Kudos

Hi Peter,

              sorry for that.I will close it.Please give me the solution of my query.

PeterJonker
Active Contributor
0 Kudos

Did you follow the instruction in the error message and can you tell us what did you see in transaction SRT_UTIL in SAP ?