cancel
Showing results for 
Search instead for 
Did you mean: 

How to expose a SOAP web service from HCP

SwenFuchs
Employee
Employee
0 Kudos

Hello All,

Currently I am trying to create a SOAP web service within a HCP Java application to allow backend systems to consume data stored in HCP.

This is the planned scenario:

1. Create data in HCP - therefor I am using JPA and a oData Model.

2. Backend uses web service to consume data from HCP - with this point I do have some problems.. I do want to create a SOAP web service in order to achieve this.

Is there an easy way to create a SOAP web service in HCP? There are many tutorials in the internet of how to create a SOAP web service in 20 sec´s, but non of these helped me. I do was able to consume a SOAP web service in HCP coming from the ByD, but the other way around seems pretty complicated...

Can I make use of the Eclipse functions to create a web service? (New --> Other... --> Web Services --> Web Service and than choose the Button up Java bean Web Service type)

Have any of you some coding snippets that would probably help me out?

I have unsuccessfully tried to use the @WebService, @SOAPBinding, @WebMethod notation in my java classes...

Thank you,

Swen

Accepted Solutions (1)

Accepted Solutions (1)

former_member185231
Active Participant
0 Kudos

Hello Swen,

this should not be so complicated.

Just use some of the Java based frameworks to create your WAR:

List of web service frameworks - Wikipedia, the free encyclopedia

Then deploy it on the SAP HANA Cloud Platform and it should work out of the box.

Best regards,

Dobri

SwenFuchs
Employee
Employee
0 Kudos

Hello Dobromir,

Sorry, forgot to mention: I am using Apache CXF 2.7.12

Best regards,

Swen

0 Kudos

Hi Swen,

Do you bundle all the cxf* and dependent jar files in your WEB-INF/lib directory of the WAR file?

Regards,

Nedelcho

SwenFuchs
Employee
Employee
0 Kudos

Hello Nedelcho,

Yes. All the required jar files are in the lib directory.

Currently I am able to create a web service locally.

But when I deploy that to the cloud server my JPA service is not working any more.

Receiving the following error message:

<?xml version='1.0' encoding='UTF-8'?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><code/><message xml:lang="en">javax.naming.NamingException: Error while attempting to resolve reference [Root exception is javax.naming.NamingException: Cannot create resource  object instance due to exception in the object factory [Root exception is javax.naming.NamingException: Data source 'jdbc/DefaultDB' not available.]]</message></error>

The web.xml contains the following:

Any advice?

Best regards,

Swen

SwenFuchs
Employee
Employee
0 Kudos

I figured it out. It was a indeed a problem with the libraries.

Thanks very much!

0 Kudos

Hello Swen,

Can you please tell me how to resolve this issue?

I am facing same problem with my HCP application "javax.naming.NamingException: Error while attempting to resolve reference [Root exception is javax.naming.NamingException: Cannot create resource object instance due to exception in the object factory [Root exception is javax.naming.NamingException: Data source 'jdbc/DefaultDB' not available.]]"  when trying to access the Odata Service.

Thanks and Regards,

Sriram

former_member273892
Discoverer
0 Kudos

Hi Swen,

Can u plz explain this process "create a SOAP web service within a HCP Java application to allow backend systems to consume data stored in HCP".

Thanks,

Faheem

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Swen,

could you please tell me how you were able to consume a SOAP web service in HCP coming from ByD? I´ve got some issues consuming soap webservices....

Many thanks in advance!

Best regards,

Rufat

0 Kudos

Hello Rufat,

You can create stubs from the WSDL and import the same classes to the libraries. Then using Servlet calls you can push messages to ByD.

Thanks and Regards,

Sriram

former_member273892
Discoverer
0 Kudos

Hi Sriram,

Could u plz explain it through an example, m facing issue to consume SOAP web service in HCP coming from the ByD....

Thanks,

Faheem

Former Member
0 Kudos

Hi Faheem,

HCP only offers the possibility to deploy the Java Based WebService Client application in order to consume e.g. in SAP UI5/Fiori APP.

It is not possible to expose the SOAP based Webservices directly. You need to develop a Java Client application  (with entitiy classes) and use servlets for the communication with ByDesign.

For example NetBeans offers you the possibility to generate Java Clients based on the SOAP WSDL which you need to import. Then, you need to adapt these clients.

If you don´t want to develop java based clients, SAP HCI offers now the possibility to expose SOAP based Webservices as OData. Then, after generating the OData you should be able to consume those. I don´t have practical experience with HCI OData exposition but only read about it. It is a brand new feature. Have a look here:

Best regards,

Rufat