cancel
Showing results for 
Search instead for 
Did you mean: 

How to process web service response in ABAP Proxy

peter_wallner2
Active Contributor
0 Kudos

Dear experts,

I am having a scenario ABAP Proxy - SOAP receiver. My earlier post: http://scn.sap.com/thread/3448583

Right now I am able to send the SOAP request to the webservice and retrieve messages using PI. My operation mapping looks like this:

The response I get from the web service I am mapping to ORDERS.ORDERS05 iDoc

I manually trigger my outbound ABAP Proxy and I get back the web service response. The response I can see in SAP ERP:

But now I am getting confused. Do I need to generate an inbound proxy to properly receive the web service response?

But I get the response in the outbound proxy so I think that should be enough!?

I opened question Process iDoc XML from ABAP-Proxy trying to pick up the web service response and create an iDoc from the XML.

I am getting confused and appreciate any input on this.

Thank you very much,

Peter

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Peter,

If it is a synchronous interface (which seems to be the case), you properly receive the SOAP answer in the proxy. My question now is: Do you want to create IDOCs out of that response or why are you mapping to the IDOC structure? Usually the response would be processed in the proxy.

BR

Harald

peter_wallner2
Active Contributor
0 Kudos

Hello Harald,

Thank you for your quick reply. Yes, I want to make ORDERS iDocs from the web service response. That is why in PI I have the orders mapping. My idea was to do the mapping there so I have it in the correct format already before it comes into SAP ERP.

I do not want to map the web service response to iDoc in the proxy.

Can I save the web service response on the SAP ERP server as an XML file and do a separate interface in PI and pick the saved XML file up from there, map to iDoc ORDERS and integrate using an iDoc receiver channel? This is the only alternative I can think of...

Thank you again for your help.

Best regards,

PEter

Former Member
0 Kudos

Hi Peter,

You could use the following code to call your synchronous proxy on ERP:

    CALL METHOD lo_clientProxy->execute_synchronous

             EXPORTING output  = ls_request

             IMPORTING input   = ls_response.

In ls_response you should have the response data.

Afterwards you can create IDOCs in the ABAP coding by using the data from ls_response, i.e. via MASTER_IDOC_DISTRIBUTE.

But I would rather create a synchronous proxy via PI and use the IDOC data structure for the interface response (in the ESR service interface). This ensures that the response in ECC has the same structure as needed for the IDOC creation. Then you only need to move the structure 1:1 in ABAP. That should work.

Best Regards

Harald

peter_wallner2
Active Contributor
0 Kudos

Hello Harald,

I tested my ABAP Proxy again and saw that I am getting an error similar to this one: http://scn.sap.com/thread/3275434 which I had ignored before. It expects a certain namesapce in the response coming in. Since I am mapping to iDoc XML in PI right before it gets back into ERP I do not have that namespace anymore.

So now I wanted to ask what you mean by


But I would rather create a synchronous proxy via PI and use the IDOC data structure for the interface response (in the ESR service interface).

I get the second part to use the IDOC data structure as the Response message in my service interface. But how do I create a proxy via PI?

Thank you again for your input on this.

Best regards,

Peter

Former Member
0 Kudos

Hi Peter

The easiest design for your requirement will be a async- sync bridge using BPM. Design the interface like below

ECC---> Async Proxy --->BPM ------> Sync SOAP Call

BPM ---> Async response ----ECC Idoc

Let me know if you have any doubt on any steps.

gagandeep_batra
Active Contributor
0 Kudos

Hello Peter,

If i am not wrong I think you can first  download idoc structure  to local machine & upload as external definition and then create interface proxy.

Regards

GB

peter_wallner2
Active Contributor
0 Kudos

Hello Gagandeep,

Thank you. I think in the service interface I can just change the response type to iDoc:

and regenerate my ABAP Proxy after that.

But my biggest concern now is the ABAP coding. Harald suggested the following code to call the ABAP Proxy:

CALL METHOD lo_clientProxy->execute_synchronous

      EXPORTING output  = ls_request

      IMPORTING input   = ls_response.

According to the blog http://scn.sap.com/community/pi-and-soa-middleware/blog/2009/06/20/pixi-abap-proxies-say-goodbye-to-... the method "execute_synchronous" cannot be used anymore but instead the method that is in the Service interface.

So I am using this code:

DATA:

ld_output         TYPE ZZA_WS_GET_NEW_ORDERS,

ld_input          TYPE ZZA_WS_GET_NEW_ORDERS_RESPONSE.

   

CALL METHOD lo_clientProxy->IM_SHOPRITE_GETNEWORDERS_OUT

    EXPORTING output  = ld_output

    IMPORTING input   = ld_input.

But my ld_output and ld_input are both empty. When I look at them in debugging I can see a component called "CONTROLLER" which constists of structure "PRXCTRL".

Why do I not see my input and output?

I must be doing something wrong in my ABAP.

Do you have an idea?

Thank you again for your help.

Best regards,

Peter



former_member192851
Active Participant
0 Kudos

Controller is generated, do not need to worry about it.

Check your proxy in sproxy (external view tab), there you should see your input-output structures.


First you should create lo_clientProxy object.

CREATE OBJECT lo_clientProxy.

Then You should fill ld_output with data.

And then call sync method.

Former Member
0 Kudos

Hi Peter,

That was exactly what I meant: Change the response type to the IDOC structure.

Ignore my comment "But I would rather create a synchronous proxy via PI and use the IDOC data structure for the interface response (in the ESR service interface).". I was thinking that you didn't create the proxy via ESR, but that is wrong.

So with the synchronous interface you should get a proper proxy and with the coding mentioned by Artem this should work properly then.

Any other issues?

BR

Harald

peter_wallner2
Active Contributor
0 Kudos

Hello Artem,

Thank you.

Not filling ld_output first is my problem I think.

I am not sure how to fill it though.

It consists of structure PRXCTRL: Field and Value.

Value I have to fill with my SOAP request. But what do I have to use for "Field"?

Thank you again for your help,

PEter

former_member192851
Active Participant
0 Kudos

Plz, show ZZA_WS_GET_NEW_ORDERS

peter_wallner2
Active Contributor
0 Kudos

Hello Artem,

Now it works! Here is the ZZA_WS_GET_NEW_ORDERS with the CONTROLLER

now I am running the report I created and I am calling the method after creating the proxy object:

TRY.
CALL METHOD LO_PROXY_OUT->IM_SHOPRITE_GETNEWORDERS_OUT
   EXPORTING
     OUTPUT = ld_output
   IMPORTING
     INPUT  = ld_input
     .
  CATCH CX_AI_SYSTEM_FAULT .
  CATCH CX_AI_APPLICATION_FAULT .
ENDTRY.
COMMIT work.


And in "ld_input" I can see the iDoc now.

Thanks again for your help. I am not sure what was wrong with the other structure I had defined as "ld_input".

I will have a look now on the "MASTER_IDOC_DISTRIBUTE" that Harald had suggested.

Best regarsd,

PEter

Answers (0)