cancel
Showing results for 
Search instead for 
Did you mean: 

Creation of OData service using SOAP based service using Kepler

Former Member
0 Kudos

Hi,

We are trying to create OData services using SOAP based WSDL and deploy to SMP server.

We have SMP 3.0 SP07 with PL03 patch with Kepler SR2.

We have soap based service which has header level authentication and apart from that we have backend level authentication to fetch the data from backend.

We have created few sample Odata services to confirm that SMP server is working fine and able to deploy OData services.

Now in this case we have different kind of payload which has two authentication: Header level service authentication and backend level authentication.

Attached are the request payload and response payload from SOAPUI tool.

Since this is complex services we are not able to do request and response mapping directly from design time from Kepler, we will have to go for custom query and here we required valuable inputs

Kindly help us Please.

Accepted Solutions (0)

Answers (4)

Answers (4)

fenil_doshi
Participant
0 Kudos

Hi,

Actually as per this scenario as you have header level authorization which can be injected in the odata call directly and also the other body level auth data also should be passed in the header in the oData request itself and in the custom script assign it separately to Header and Body and try to generate the whole request XML as similar as in SOAP UI with injecting the namespace as well from the script. What said is correct, coming to your scenario you can have separate field names at header level for that request and w.r.t that name access that in the custom script and then try to create the request XML similar as you have is SOAP UI.

Hope this helps.

Regards,

Fenil.

midhun_vp
Active Contributor
0 Kudos

Hi Reshma,

These blogs might be helpful:

Regards,Midhun

SAP Technology RIG

Former Member
0 Kudos

Thanks Midhun,

We saw this post, but problem is we have two tags with similar names like username and password.

Not sure how to manage two tags which has similar names in request.

bjoernw
Participant
0 Kudos

Thanks Jitendra.

could you kindly share some more details what you mean by "backend level authentication."? I couldn't figure it out from the request/response you shared.

This blog explains how to do authentication agains a SOAP service:

Kind regards

Björn

Former Member
0 Kudos

Bjoern,

We have services from Oracle and those are mapped again using SOA which is another mapping tool of Oracle.

In general we have two authentications:

1. SOA (authentication for SOA SOAP URL)

2. Authentication for Oracle system which will fetch the data according to user logged in to the application.

I have attached the SOAP UI request and response.

Kindly help us please.

If possible, i will share my screen?

bjoernw
Participant
0 Kudos

This shouldn't be a problem.What you can do, in the OData request that you send against the IGW, you include four header attributes:

username1: un1

password1: pw1

username2: un2

password2: pw2


Then in the custom scripting you extract these attributes from the OData call, and then you create the hashmaps for the outgoing SOAP request:

The first username/password combination goes in the header, the second username/password combination goes in the body of the outgoing SOAP request.

How this can be achieved you can find in the blog I posed above:

Kind regards

Björn

Former Member
0 Kudos

Bjoern,

We tried below code:

function processRequestData(message) { 

  importPackage(java.util); 

  importPackage(org.apache.olingo.odata2.api.processor); 

  importPackage(com.sap.gateway.ip.core.customdev.logging);

  var context = message.getHeaders().get("odatacontext"); 

  var username_s = context.getRequestHeaders().get("username_s").get(0);

  var password_s = context.getRequestHeaders().get("password_s").get(0); 

  childMap = new LinkedHashMap(); 

  childMap.put("username_s", username_s); 

  childMap.put("password_s", password_s); 

  message.setHeader(childMap);

  var InterfaceID = context.getRequestHeaders().get("InterfaceID").get(0);

  var username_b= context.getRequestHeaders().get("username_b").get(0);

  var password_b = context.getRequestHeaders().get("password_b").get(0); 

  childMap1 = new LinkedHashMap(); 

  childMap1.put("InterfaceID ", InterfaceID); 

  childMap1.put("username_b", username_b); 

  childMap1.put("password_b", password_b); 

  message.setBody(childMap1);

 

 

return message; 

But no luck yet.

bjoernw
Participant
0 Kudos

Hi Reshma,

looking at your SOAP query screenshot, the header fields need to be called Username and Password, not username_s and password_s.

The fields in your body need to be called UserName and Password, not username_b and password_b.

If you are continuing to face issues, please look into debugging your custom code:

Regards

Björn

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos

This looks a new scenario, i would loop experts , for their views.