cancel
Showing results for 
Search instead for 
Did you mean: 

Consuming external Web Service using PI ESR tools

Former Member
0 Kudos

Hi all,

I`m facing problem with generating Web Service consumer in SAP PI using ESR tools.

I have downloaded this wsdl: http://www.webservicex.com/globalweather.asmx?wsdl to local  machine and would like to configure this Web Service in PI. Next there should be communication (RFC) between SAP PI and SAP ERP, so ERP is sending request via FM with RFC destination  to PI and PI is responding via RFC.

What I have done:

1. Created appropriate entries in SLD.

2. In Enterprise Services Builder

  • Tools -> Import External Definitions  giving WSDL from hdd



  • Tools -> Import Service Interface giving WSDL from hdd




  • Almost empty Message Mappings (screen)

  • Created Communication Channel Templates (screens)




Everything activated.

3. In Integration Builder:

  • Created Party, Communication Component and Business Component



  • Created Communication Channels (Receiver + Sender)




  • and Receiver Agreement



4. In SPROXY I generated and activated one proxy (... SOAP)

but during standard test (F8) with method "GetCitiesByCountry" I get this error:

Could you please tell me what am I doing wrong?

Maybe something is not needed, missing, wrongly configured?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Marius,

  I don't know the ECC version you have, what you can try is to use transaction SPROXY and the magic wand button to create service call:

Option Service Consumer, click on Cont.:

Use the external service definition, click on continue:

Your external definition comes from an URL, select URL option and click on continue, enter the URL of the WSDL and then create the proxy:

After that, you can use the transaction SOAMANAGER to create the logical port. The logical port will contain port and binding to the webservice.

For more information see SAP help file:

7.1

http://help.sap.com/saphelp_nwpi71/helpdata/en/9e/c7a3591dc74a679bbc9716354e42af/content.htm

7.11

http://help.sap.com/saphelp_nwpi711/helpdata/en/69/8a1e9553dc4baba6026a3db510cadb/content.htm

I wouldn't advise use the use of RFC<->PI<->SOAP as Best Efforts scenario can be resource intensive. PI still best at asynchronous communications. In your case a Point-to-point communication using consumer proxy is best.

Hope it helps

Regards

Yan Wong

Former Member
0 Kudos

Hi,

Developing Web Service consumer on ECC side is impossible in this case. Only PI is able/allowed to connect to external hosts.

So scenario RFC <-> PI <-> SOAP or PROXY <-> PI <-> SOAP is needed.

Best regards

Former Member
0 Kudos

Hello,

  Does the type of your service is an inbound (PI calling ECC) or outbound (ECC calling PI)?

  It may explain why you have the error. You'll need to create a service interface outbound in ESR (ECC service call to PI) With it, you will generate the  proxy type outbound on ECC.

  Use the other to call the webservice with the SOAP adapter you mentioned. between the two, no operation mapping service interface is generated with the WSDL...

Regards,

Yan Wong

Former Member
0 Kudos

Hi,

It is weather WebService and ECC is calling PI so outbound type.

So I have to import wsdl to ESR (ESB) and set type as Outbound.

As far as I remember there will be appropriate Service Consumer on ECC side (SE80) but during Test I have to specify logical port from LPCONFIG (and in LPCONFIG there is connection with RFC to WebService). Is it correct? ECC does not have connection to this IP, but only to PI.

Do I have to create inbound interface too?

I have checked yours latest links but there is not too much informations.

Maybe you have any link to simple tutorial (RFC or PROXY) which I have not found yet?

Former Member
0 Kudos
Former Member
0 Kudos

Hello again,

Here is my progress with Weather WS:

On ESB side:

- 2 Service Interfaces: Outbound + Inbound

- 2 Message mappings for each method ( MM_ ... _Request + MM_ ... _Response)

- Operation Mappings integrating SI and MM

On IB side:

Created:

Party, Communication Component, Business Component,

Receiver Determination

Interface Determination

Sender Agreement

On ECC side:

- Created proxy (from Outbound Service Interface)

- for test purpose in LPCONFIG I have defined default logical port for generated proxy. On Call Parameters tab selected "PI_INTEGRATION" as HTTP Destination

During test (in SE80) I use default logical port (so no selection needed) and method: GET_CITIES_BY_COUNTRY.

After sending Request I have following error:

SoapFaultCode:4  Error during conversion of XI message

Exception of class CX_AI_SYSTEM_FAULT

I hope now I`m closer to complete solution

Could you help me what can be wrong now?

Former Member
0 Kudos

Hello,

  Did you check on SXMB_MONI what could be the root cause of your exception?

Regards,

Yan Wong

Former Member
0 Kudos

Hello again,

  You did checked the basis thing arround your PI destination:

  SXMB_ADM, Integration Engine Configuration: It is pointing on the PI Integration Server (it should be something like dest://<RFC destination of PI server>).

  SM59: The RFC destination respond with a HTTP 500 Empty HTTP request received when you do a connection test...

  In Integration Directory, check that you are using on sender adapter a XI adapter and not a SOAP. On receiver adapter, you use a SOAP adapter...

  On PI > 7.11, you can use a SOAP adapter using XI protocol if I recall correctly... It is useful if you want to use Integrated Configuration Objects but it is not the case here.

  You don't need to configure a logical port here as the abap outbound proxy will make an HTTP call using XI protocol to the integration engine... XI protocol is SOAP with SAP specific header.

  You can try an outbound proxy call using another Abap outbound proxy for example FlightBookingOrderConfirmation_Out from software component SAP BASIS, namespace http://sap.com/xi/XI/Demo/Airline

   no LPCONFIG, everything set by default, generate an XML using sproxy:

After having triggered the proxy call (menu Extras -> Trigger COMMIT WORK) because this is an asynchronous call, you should have this:

on ECC and PI using transaction SXMB_MONI, you will see the proxy call. on PI it will be in error as no scenario uses it.

Regards,

Yan Wong

PS: You are very near of the complete solution...

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

>>>Next there should be communication (RFC) between SAP PI and SAP ERP, so ERP is sending request via FM with RFC destination  to PI and PI is responding via RFC.

1. you did not do RFC communication but proxy - RFC is started from a remote function module

2. if you want to use proxy messages create a normal SI (not on the basis of the WSDL) in inbound (only outbound will be WSDL)

3. you're mapping - country name looks like it's not mapped

Regards,

Michal Krawczyk


Former Member
0 Kudos

Hi,

So what I understand I have to change Category type for GlobalWeatherSoap from Inbound to Outbound.

After Categoy change (Inbound to Outbound), deleting and creating proxy I have error like:

"

INTERNAL.PROXY_NOT_ALLOWED_ON_IS Proxy calls are not permitted on sender or receiver side on the IS (client)

Exception of class CX_AI_SYSTEM_FAULT

"

Is it also necessary to create additional SI Category Inbound? Or should I change, check something more?

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

>>>So what I understand I have to change Category type for GlobalWeatherSoap from Inbound to Outbound.

no, if you want to use RFC your inbound needs to be RFC (created in ABAP backend)

>>>INTERNAL.PROXY_NOT_ALLOWED_ON_IS Proxy calls are not permitted on sender or receiver side on the IS (client)

you cannot create proxies on PI server (unless you do it on another client)

what you need to do in short:

a) decide if you want to use RFC or proxy

b) in both cases create the RFC or proxy in ECC (not on PI)

Regards,

Michal Krawczyk

Former Member
0 Kudos

Hi,

Better option was using proxy so now there is proxy generated on ECC side based on ESR generated element.

Now I`m facing some technical problems so I can`t check if it is correct now.

I will post right after technical problems be resolved and some tests could be done.

Former Member
0 Kudos

Hi again,

Now I have Server Proxies generated - ZWE_II_GLOBAL_WEATHER_SOAP  with Provider Class ZWE_CL_GLOBAL_WEATHER_SOAP1.

Now method:

ZWE_II_GLOBAL_WEATHER_SOAP~GET_CITIES_BY_COUNTRY

is empty...

What I have found to enter is:

"

DATA:
   lo_clientProxy  TYPE REF TO  ZWE_II_GLOBAL_WEATHER_SOAP, "ZWE_II_GLOBAL_WEATHER_SOAP,
   lo_method       TYPE string VALUE 'GET_CITIES_BY_COUNTRY'" Method ó Operation
   out_msg         TYPE ZWE_GET_CITIES_BY_COUNTRY_SOAP,         " Data è Message Type
   in_msg          TYPE ZWE_GET_CITIES_BY_COUNTRY_SOA1.


     CREATE OBJECT lo_clientProxy.

*   Call our abap proxy to send data to PI…
     CALL METHOD lo_clientProxy->(lo_method)
         EXPORTING
           output = out_msg
         IMPORTING
           input = in_msg.
      COMMIT WORK.   " Do not forget it

"

but there is error:

" lo_clientProxy is not an object reference"

How this method should be filled so I can perform Service Provider Test in SE80?


Former Member
0 Kudos

Hi,

you are talking about a server proxy ZWE_II_GLOBAL_WEATHER_SOAP which has been created. But further below you are trying to call a method of a client proxy to send data to PI: lo_clientProxy  TYPE REF TO  ZWE_II_GLOBAL_WEATHER_SOAP?

What do you want to achieve in the end? Trigger the data send from the ABAP backend system or send an answer back from a request via a server proxy?

Basically if you are using a client proxy (a proxy which can be called from ABAP to send data from an ABAP system to PI) you have to call the proxy method just as any other ABAP method with the correct data types (check method signature).

If you are using a server proxy (a proxy which is delivering data based on a request back to the requestor), you can implement all logic of the proxy on your own. Important is that you also check the output parameters of the proxy method which you want to implement since the data needs to be filled exactly as specified in the signature.

BR

H.

Former Member
0 Kudos

Hi,

So using server proxy is while we are delivering informations, not asking for them...

My goal is to send query to Web Service and get simple response.

As I understand correctly in ESR my wsdl imported Interface should be Outbout not Inbound as it is now. Probably something simillar was in post.

To be host I can use proxy or RFC since there is no much difference for me.

Do I have to create Inbound and Outbound Interface always?

I was searching for any simple example how to create simple Web Service (external) consumer using PI ESR but havn`t found any working.

Maybe you can give me any helpful links using proxy or RFC?

Best regards

Former Member
0 Kudos

Yes correct:

Client proxy => Pushing the information from ABAP system to PI

Server proxy => An external request is coming in to the proxy which then sends the answer back  (if it is a synchronous server proxy)

So I understand that you want to call an external web service triggered from the ABAP backend? This would mean that you need to configure a sender communication channel (proxy) in the Integration directory. The structure of the message needs to be defined before in the ESR as well as the outbound interface (since it is outgoing from ECC to PI and from PI to the other web service).

You only need an inbound interface if someone wants to send data to the ABAP system (ABAP system inbound). If you want to send data from the ABAP system to any other party via PI then you need an outbound interface.

For Proxy -> PI -> SOAP you need:

1. One outbound interface on ECC (defined in ESR) and an XI3.0 (proxy) communication channel as sender communication channel (defined in the Integration Repository)

2. An inbound SOAP communication channel in which you need to define the URL and the SOAP action of this external SOAP service

Hope this helps!

Former Member
0 Kudos

Hi Harald,

I am pretty new to PI and wondering if you can help me to understand how PI and webservice work together.

We currently will have pull data from NON-SAP (.NET) system.
in term of in bound interface, should we ask them  to create the webserive
and connect with PI using SOAP interface?

Or we should create our own webservice on PI and ask them to
consume our webservice and pass data into PI?  Which one will be more practical and easy to implement? The data can be xml
structured data with PDF attachment.

If they are providing us webservice, I know PI will have
SOAP inbound interface, but how to consume /trigger the non-SAP web service in
SAP?

Thanks in advance,

Former Member
0 Kudos

Hi Hailan,

That depends who should trigger the service.It is easier for you if they provide a WebService and give you the WSDL which you can use. Thus, the whole structure of the service is already provided by them. The other way round you have the whole work.

You need to trigger the service from the backend system. Is it ECC in your case? You could do it via ABAP client proxy for example.

Best Regards

H.

Former Member
0 Kudos

Thanks Harald. That is very helpful