cancel
Showing results for 
Search instead for 
Did you mean: 

How to call an ABAP webservice?

Former Member
0 Kudos

First of all forgive me as i am very new to this advance web development and this is my first time to study webservices. so please bear with me.

I have managed to create my own webservice and has been successful up to the point of having a WSDL document via soamanager. However when i try to call the webservice, i only able to get the actual WSDL document (XSD or the schema).

I'm trying to use python (Using urllib2) to try to call up on the webservice. On tutorial it mentioned that it is using the URI, but i'm not sure if it is the same as its url shown when you click on 'Open WSDL document for selected binding or service' option but on screenshots it seems to be right.

If I go and test the webservice via SE80, it works and i was able to retrieve data, but one thing noticable is it has sort of XML request parameters like this:

<n0:Ztest xmlns:n0="urn:sap-com:document:sap:soap:functions:mc-style">
 <Connid>0000</Connid>
 <Sflight/>
</n0:Ztest>

on tutorials it never mentioned on this format so i'm not quite sure what this is or where should i do this.

If you can provide some helpful links that would be great. most of the tutorials i found are consuming webservices from abap. I want to learn the other way around.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

managed to make it work. so there is no problem in sap side. if your curious (or still not annoyed) i used suds as web service client.

0 Kudos

Hi

can you send me a code example on how you used the suds client.

Regards.

Former Member
0 Kudos

Hi C Z,

we are currently also trying to use suds from Python to call our own remote capable function module. Could you please show a few lines of example code?

We use as a test case so far:

from suds.client import Client, Method

from suds.transport.http import HttpAuthenticated

def main():

    transport = HttpAuthenticated( username="***", password="***" )

    url = "http://192.168.11.4:8099/sap/bc/srt/wsdl/sdef_Z_CCAG_PIB_GET_CUST_FOR_OBJECT/wsdl11/ws_policy/docume..."

 

    client = Client( url, username="***", password="***" )

We fail to see how to call the method/ service afterwards ... Any help really appreciated!

Thanks!

Cheers

   Frank

edgar_almonte
Participant
0 Kudos

this old but i will answer anyway because maybe somebody will looking for the answer:

from suds.client import Client

url = ' wsdl url here'

client = Client(url, username='***', password="***")

then yo do:
print client

and you will find a line like:

Methods (1):

            ZGETDETAILS(ns0:char10 CODENUMBER)


and that name is the name you use for call the service , example:

client.service.ZGETDETAILS('CodeNumber'ValueHere)

Answers (1)

Answers (1)

Srdjan
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

if you want to consume ABAP functionality from Python, you can skip web services and call ABAP RFCs directly. It could be easier and faster - see following examples

http://scn.sap.com/community/scripting-languages/blog/2012/11/04/revisiting-python-and-sap-with-pyrf...

http://scn.sap.com/community/scripting-languages/blog/2012/11/20/calling-python-from-erp-with-pyrfc

Regards,

srdjan