cancel
Showing results for 
Search instead for 
Did you mean: 

PI 7.3: consume webservice using SOAP

peter_wallner2
Active Contributor
0 Kudos

Dear experts,

I have to consume a webservice with SAP PI 7.3. The offered webservice uses SOAP protocol.

One of our customers offers a webservice that provides purchase orders and I have to map

those to iDoc ORDERS.ORDERS05.

I have gone through:

http://scn.sap.com/people/siva.maranani/blog/2005/03/01/testing-xi-exposed-web-services

http://scn.sap.com/people/siva.maranani/blog/2005/09/03/invoke-webservices-using-sapxi

http://scn.sap.com/people/shabarish.vijayakumar/blog/2006/03/23/rfc--xi--webservice--a-complete-walk...

http://scn.sap.com/people/shabarish.vijayakumar/blog/2006/03/28/rfc--xi--webservice--a-complete-walk...

From what I understand I need an RFC that calls the webservice through PI.

"RFC -> SAP PI -> webservice".

- So to regularly check the webservice for new orders do I have to create a job in SAP ERP that triggers a report with my RFC?

- Are there other possibilities to call a webservice regularly using SAP and SAP PI?

- Do I need a Sender Adapter to send the webservice response to PI -> RFC?

- How do I map the webservice response to an iDoc ORDERS.ORDERS05?

Thank you very much for your input on this and best regards,

Peter

Accepted Solutions (1)

Accepted Solutions (1)

iaki_vila
Active Contributor
0 Kudos

Hi Peter,

- So to regularly check the webservice for new orders do I have to create a job in SAP ERP that triggers a report with my RFC?

You can do it with a Job or directly. I think it's better to call to PI with a consumer ABAP proxy.

- Are there other possibilities to call a webservice regularly using SAP and SAP PI?

In your case i thin the best option is to use an ABAP proxy. There is more possibilities like to call with an idoc.

- How do I map the webservice response to an iDoc ORDERS.ORDERS05?

- Do I need a Sender Adapter to send the webservice response to PI -> RFC?

The scenario that you are pointig will be RFC (sender) - SOAP (receiver), but for the sender i remark that you can use an ABAP proxy.

- How do I map the webservice response to an iDoc ORDERS.ORDERS05?

If you are using an RFC or Proxy you need to do this job in ABAP code taking the metadata necessary in the RFC or Proxy interface and finally call the IDOC in the ABAP code.

There is another possiblity, the async-sync-asyinc scenario, like this wiki shows  http://wiki.scn.sap.com/wiki/pages/viewpage.action?pageId=69331, but with Proxy (or RFC) - SOAP. - IDOC, i dont know if it will works properly.

Regards.

peter_wallner2
Active Contributor
0 Kudos

Hello Iñaki Vila,

Thank you for your input. I will ask my colleague to help with the ABAP. I have never set up an ABAP proxy.

Also - which I had not mentioned before - once I received an order from the webservice I have to send a response back that I received it. Can I also handle that with the ABAP proxy?

Thank you again,

Peter

iaki_vila
Active Contributor
0 Kudos

Hi Peter,

Yes, the abap proxy can be synchrounous, then you can retrieve a response with the data neccesary. Finally, in the abap code when you take the response, the abap programmer should call the IDOC.

If you want to check how work the client (consumer) abap proxy with PI, you can read the point 1 of this document http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e0ac1a33-debf-2c10-45bf-fb19f6e15..., obviously you are not going to use the same receiver that the pointed in the document but the sender side could be helpful for you.

Regards.

Answers (3)

Answers (3)

markangelo_dihiansan
Active Contributor
0 Kudos

Hello Peter,

Apologies for replying just now. Inaki is right, please let us know if you still have doubts.

Regards,

Mark

markangelo_dihiansan
Active Contributor
0 Kudos

Hello Peter,

Check if your scenario is similar to this:

http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/01/05/michals-pi-tips-exchange-rates-fr...

The idea is to use the query string to check for new orders (e.g ?new=true) and they would just give the response.

If yes, then it can be done Soap Axis (asynch via polling mechanism) -> PI -> IDoc (async).

Regards,

Mark

peter_wallner2
Active Contributor
0 Kudos

Hello Mark,

I have thought of Axis already but in order to check for new order files I have to send a SOAP request to the webservice. I do not think I can do that with the Axis adapter, I have to use a SOAP receiver.

Best regards,

Peter

markangelo_dihiansan
Active Contributor
0 Kudos

Hello Peter,

Ask them for the webservice API (not just wsdl), if it supports HTTP GET, then it might still be possible. Sample api here: (see HTTP GET)

http://www.webservicex.net/stockquote.asmx?op=GetQuote

Regards,

Mark

iaki_vila
Active Contributor
0 Kudos

Hi Mark,

I dont understand right your scenario, if  Peter needs data from ECC to call the webservice your option cant be applied, isn it?, if he doesnt need this data, you solution is the better. Peter, do you need data from ECC to pass to the webservice?

Regards.

markangelo_dihiansan
Active Contributor
0 Kudos

Hello Inaki,

As I understood it, he is getting some data from a website and then mapping it to idoc. But he first suggested RFC <-> SOAP

Regards,

Mark

peter_wallner2
Active Contributor
0 Kudos

Hello Inaki Vila, Hello Mark,

The webservice expects a SOAP message from me with 2 variables (number of orders to retrieve at once and a constant). So my idea was in order to create that message I need an RFC that sends those 2 variables to a SOAP receiver on PI which adds the SOAP envelope and then it goes to the webservice.

So I need to send this SOAP request and also it should be sent every 10 minutes to get waiting orders back.

This is why I thought my RFC (or ABAP proxy) needs to be scheduled evey 10 minutes. Maybe there is an easier way, also a BPM was suggested here. But I have never done BPM, that is why I am hesitant about that.

Best regarsd,

PEter

markangelo_dihiansan
Active Contributor
0 Kudos

Hello Peter,

If you'll be running a background job, then that means that the number of orders to retrieve would also be constant. Would you be able to share to us the webservice description for HTTP GET?

The reasons I see Michal's blog now working is:

1. HTTP GET is not supported by the webservice

2. The URL formed is too long (more than 200 characters)

You could also connect to the webservice directly using CL_HTTP_CLIENT

Hope this helps,
Mark

peter_wallner2
Active Contributor
0 Kudos

Hello Mark,

HTTP GET is not supported by the webservice. I have to go with SOAP.

I found your paper http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/80104882-c7a8-2f10-c3a3-81f182917...

and was able to test the Calculator webservice successfully using an ABAP Proxy and SAP PI.

My next steps would be:

- implement a test szenario for retrieving the orders from the webservice of our customer.

- write a report that runs the ABAP Proxy and also calls IDOC_INPUT_ORDERS. Is that correct?

My other question is:

Once I retrieve order files from the webservice I have to send back a reply with the order numbers of retrieved files.

How would I do that?

Do I need another ABAP Proxy for sending back that reply (because it is a separate message structure)?

Then in my report I would call the ABAP Proxy retrieving orders and then call the one sending back the answer with the order numbers?

Thank you again for your help with this.

Best regards,

Peter

iaki_vila
Active Contributor
0 Kudos

Hi Peter,

My next steps would be:

- implement a test szenario for retrieving the orders from the webservice of our customer.

- write a report that runs the ABAP Proxy and also calls IDOC_INPUT_ORDERS. Is that correct?

You are right, you can do an ABAP Proxy - SOAP scenario, you would continue after the call proxy code the IDOC call or you can store the data in a Z table and to do an extra report.

Do I need another ABAP Proxy for sending back that reply (because it is a separate message structure)?

Then in my report I would call the ABAP Proxy retrieving orders and then call the one sending back the answer with the order numbers?

It depends about your third-party. Does It offer to you a synchrounous webservice?, you could do all in one call, the request and response message structure can be different in one webservice. If they have an asynchronous webservice to get the input order, they will show you a second one for the response.

As you said, you can do all in one report, the request, idoc proccessing, and the response.

Hope this helps.

Regards.

Former Member
0 Kudos

Hi Peter

I think the best way to design this would be using a BPM sync-async bridge.

So your scenario will be like this

RFC or Proxy --->To---->BPM ( async call )

BPM<--------> Webservice (SOAP)  ( sync call )

BPM ( webservice response ) ....>to IDOC  ( async call )

Since your main intention is to call the webservice periodically from PI and then map the response back to IDOC you can do this in one step as well.

You can achive this in the below way

1. Use file adapter in the sender side and use a dummy file in any directory

2. schedule the channel based on the time

3. write an java mapping which will call the webservice uisng SOAP look up and return the response   of webservice as xml

4.Design an message mapping and do the response xml to IDOC mapping. Use this map after java mapping.

Let me know if you have any doubts or conerns.

peter_wallner2
Active Contributor
0 Kudos

Hello Indrajit Sarkar,

thank you for your input.

My idea was to use a SOAP receiver channel that sends the request coming from RFC/ABAP proxy to the webservice.

If I understand you right I should use the file adapter for scheduling. But I think I do not need a BPM if I do it that way. I would like to avoid the BPM.

Also - which I had not mentioned before - once I received an order from the webservice I have to send a response back that I received it. I would do that from the ABAP side or I think I could do it with a BPM?

Thank you again for your help,

Peter

Former Member
0 Kudos

Hi Peter

Yes if you use BPM then u can easily pass the response back to ECC but I don't know how to do that from abap side.

peter_wallner2
Active Contributor
0 Kudos

Hello Indrajit Sarkar,

This question is already solved and I figured it out using ABAP Proxy.

But I would like to know about your solution. I found this document using no BPM:

AsyncSync & SyncAsync Bridge without BPM

Would you know any blog that describes it with BPM like you had suggested originally?

Thank you and best regards,

Peter

Former Member
0 Kudos

Hi

Please check the link below. This will give you the idea how the sync async bridge in BPM works

XI/PI: A Step-by-Step Guide to BPM &amp;#8211; Asynch/Sync Bridge