Publish a custom web service to JBoss SOA

I am on the wall with this, I currently have two web service endpoints configured and running in JBoss Soa 5, and, like in the ESB standard, each endpoint is published as a separate operation.

One endpoint for sending a transaction:

<service description="writes Transactions to DB." name="TransactionsSubmit"> <listeners> <jms-listener busidref="transactionSubmitChannel" name="transactionSubmit" /> </listeners> <actions faultXsd="/resources/xsd/transactions-fault.xsd" inXsd="/resources/xsd/ws-submit-trx.xsd" mep="RequestResponse" outXsd="/resources/xsd/ws-trx-response.xsd"> <action class="org.timo.service.SubmitTransaction"> </action> </actions> </service> 

and others for sending errors:

 <service description="writes errors to DB." name="ErrorsSubmit"> <listeners> <jms-listener busidref="errorSubmitChannel" name="errorSubmit" /> </listeners> <actions faultXsd="/resources/xsd/transactions-fault.xsd" inXsd="/resources/xsd/ws-errorsubmit-trx.xsd" mep="RequestResponse" outXsd="/resources/xsd/ws-errorsubmit-response.xsd"> <action class="org.timo.service.SubmitError"> </action> </actions> </service> 

What I want to do is create a custom web service using my own WSDL file to publish these two operations in one proxy service, redirecting flows to the already defined ErrorsSubmit and TransactionsSubmit services.

It can be done?

Note. I can deploy my own WSDL service by adding a WAR application to the ESB package, but I cannot redirect the stream to internal services.

+4
source share
2 answers

After a few weeks, I was able to find a way to do this. By default, there is no custom way to redirect from a WS operation to an ESB service, but you can do this programmatically.

This is a WS operation:

 public Response submitTransaction(final TransactionRequest request) throws CommonFault { log.info("submitTransaction : "+ request.getId()); JAXBElement<TransactionResponse> response = invokeService("TransactionsSubmit", objectFactory.createSubmitTransactionRequest(request)); return response.getValue(); } private <T> JAXBElement<T> invokeService(final String serviceName, final JAXBElement<?> request) { log.info("Invoking service : " + serviceName + "()"); JAXBElement<T> response = null; try { ServiceInvoker serviceInvoker = new ServiceInvoker("myservice", serviceName); Message message = org.jboss.soa.esb.message.format.MessageFactory.getInstance().getMessage(); message.getBody().add(jaxbHandler.serialize(request)); Message esbResponse = serviceInvoker.deliverSync(message, 5000); log.info("Response : " + esbResponse.getBody().get().toString()); response = deserialize(esbResponse.getBody().get().toString()); } catch (Exception e) { log.error(e, e); } return response; } 
0
source

I believe that all you need is a content-based router with soap clients.

0
source

Source: https://habr.com/ru/post/1338752/


All Articles