cancel
Showing results for 
Search instead for 
Did you mean: 

Call S/4 SOAP API for posting journal entries within a java application

scurry888
Participant
0 Kudos

I need to learn how to call the S/4 SOAP API for posting journal entries within a java application that would run on SAP Cloud Platform.   I found a blog on using Apache Axis2 for S/4 SOAP APIs (Deep Dive 18 with SAP S/4HANA Cloud SDK: Convenient Consumption of SAP S/4HANA SOAP APIs), and have generated a stub from the asynchronous version's wsdl.  However, when I attempt to execute my test java servlet on an SAP Cloud Platform subaccount, I get:

2019 05 17 20:28:00#+00#ERROR#org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/postjournalentry-application].[com.cfindustries.scpjava.HelloWorldServlet]##anonymous#https-jsse-nio-8041-exec-5#na#hc8b40d36#postjournalentryapplication#web#hc8b40d36#na#na#na#na#Servlet.service() for servlet [com.cfindustries.scpjava.HelloWorldServlet] in context with path [/postjournalentry-application] threw exception org.apache.axis2.deployment.DeploymentException: org.apache.axis2.transport.local.LocalTransportSender

From the logging statements I placed in the program, it appears this is happening when it tries to execute " _serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext, _service);"   (configurationContext is null).

Accepted Solutions (1)

Accepted Solutions (1)

MartyMcCormick
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Steve

I think the deployment exception means you are missing jar files. Can you share your pom file and the updates you made?

Thanks,

Marty

scurry888
Participant
0 Kudos

I tried researching/experimenting on my own for a while, but have so far been unable to resolve this.

scurry888
Participant
0 Kudos

Thanks, Marty. Since posting my original message, I had added axis2-transport-http and axis2-transport-local to the plug-ins in the pom, changed the passed Axis2 configuration context from null to ConfigurationContextFactory.createEmptyConfigurationContext(), and changed the target to be the URL of the communication arrangement for posting journal entries asynchronously of our S/4HANA Cloud sandbox. I am now getting "The system cannot infer the transport information from the https://my301840-api.s4hana.ondemand.com/sap/bc/srt/scs_ext/sap/journalentrybulkcreationreques URL." I will investigate this on my own, however, in case you have a quick answer, I've attached the pom, as well as the servlet and the stub in a zip file.

MartyMcCormick
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Steve

Not sure, but in the wsdl the soap endpoint should be--maybe this will work?

https://my301840-api.s4hana.ondemand.com/sap/bc/srt/scs_ext/sap/journalentrycreaterequestconfi?sap-c...

Thanks,

Marty

scurry888
Participant
0 Kudos

Thanks, Marty. The endpoint was already set to that. I have reached out to the author of the blog, and have also posted a question on StackOverflow (with an axis2 tag), in the hopes that I can hook up with an Axis2 expert.

snaks4hana
Explorer
0 Kudos

Hi Steve,

Do you have any luck with soap asynchronous call? Do you mind share your approach?

I am trying to post clearing and in SAP Business Hub, it only provides Async endpoint.

The only class available in SDK to make soap call is SoapRequest and it does not have capability to register callback handler. I played around with Axis and hit the dead end.

Anyone else face the same issue? Please let me know if there is work around.

marty.mccormick

Thanks

Anthony

Answers (1)

Answers (1)

scurry888
Participant
0 Kudos

As an alternative to Axis2, I am trying to use JAXM - we would like to get the asynchronous version of the journal entry posting API to work. According to the JAXM documentation (https://docs.oracle.com/cd/E19644-01/817-5452/wsgjaxm.html#wp41528), a "messaging provider" is required for asynchronous calls.

I see that I would need to use the ProviderConnectionFactory for asynchronous calls (http://www.inf.fu-berlin.de/lehre/SS03/19560-P/Docs/JWSDP/tutorial/doc/JAXM4.html), but I don't know how to obtain (or set up) a "messaging provider": Is there a certain "messaging provider" that SAP would advise we use?