Please let me know how to throw custom SOAP faults from service activators in spring integration. If I have a service activator for errorChannel, what should be the return value from the handling method ?
The Spring Integration WS module is fully based on the Spring WS project. The best way to address your requirements is to follow with standard approach from there: http://docs.spring.io/spring-ws/docs/current/reference/html/server.html#server-endpoint-exception-resolver.
I'd follow with something like #SoapFault on some business Exception and won't worry about error-channel at all!
Related
I am trying to instruct DispatcherServlet to delegate to MessageDispatcher using WebServiceMessageReceiverHandlerAdapter instead of delegating to Controllers.
But the request payload is of JSON . Do we have default messageDispatcher for JSON similar to org.springframework.ws.soap.server.SoapMessageDispatcher for XML?
The concern isn't clear. If we talk about SOAP, then it definitely should be Spring WS, but when the story is about JSON, then it exactly about Spring REST support in Spring MVC. Why would one try to overcomplicate with JSON SOAP when you simply can use REST service.
On the other hand there is nothing about Spring Integration in your question. Please, be specific when you select tags for the question here.
I am new to spring integration. I have very specific requirement.
I have two Database to fetch.
Created two SP.
I have to get the data calling their respective stored procedure and create a JAXB object to make webservice call.
I am able to call one SP but not able to call 2nd SP. I think I can use enricher pattern but dont know how to configure.
Please help.
Well, trying to answer to your so broad question I only may suggest:
Configure <int-jdbc:stored-proc-outbound-gateway> to call first SP
Configure <int:enricher> with a request-channel for sub-flow to call the second SP similar way like a previous one
with this <int:enricher> you will be able to store additional info in some your Customer model property (which is payload) or headers
And so on until WS call.
Everything rest you can find in the Spring Integration Reference Manual and samples project.
UPDATE
I still need help.
Since it looks like you still don't understand Spring Integration principles properly, I'd suggest you to have one <service-activator> and call both stored procedures in custom code using Spring JDBC directly.
Eventually with an experience you will be able to refactor it really to separate components with the <enricher> on board.
OTOH your scenario recalls me Scatter-Gather pattern.
I have a situation where I have to pull the attachments from sfdc webservice and put it into some other ftp location. I need a suggestion, if anybody faced this situation please share approach.
please help to develop this interface
thanks in advance
Samba
You question isn't clear, so that would be better to share more info on the matter and maybe some code, config.
Anyway, Spring Integration WS module is fully based on the Spring WS projects and deals exactly with the WebServiceMessage abstraction.
Which you can cast to the MimeMessage in case of MTOM enabled on request/response.
And that one getAttachments() method.
In case of Inbound Gateway you can use extractPayload = false option and receive a full WebServiceMessage as a payload in downstream flow.
When you send request to the external service and receive response with an attachments, you should take a look into custom DefaultSoapHeaderMapper extension, where you can populate your attachments into headers in the extractUserDefinedHeaders overridden method.
Please let me know if there is a way to override the default soap fault thrown by spring integration XSD validator. By default the fault generated is a client fault, But I want to change it to a custom fault code. Is AbstractSoapFaultDefinitionExceptionResolver.getFaultDefinition() the right place to do this?
The Spring Integration XSD Validator doesn't throw any Fault exceptions.
The Fault is a specific of the SOAP protocol and Spring WS wraps anyway service downstream Exception to the SOAP Fault using default strategy in face of:
org.springframework.ws.server.EndpointExceptionResolver=org.springframework.ws.soap.server.endpoint.SimpleSoapExceptionResolver,\
org.springframework.ws.soap.server.endpoint.SoapFaultAnnotationExceptionResolver
That is only way to customize it: implement your own EndpointExceptionResolver with desired logic.
Yes, perhaps AbstractSoapFaultDefinitionExceptionResolver.getFaultDefinition() is for your case.
We need to know more context on the matter.
From other side looks like we have talked with you about similar issue in other your questions...
I am new to the Spring integration. Previously I developed an application using Weblogic Integration where I poll a database table for any new rows. If there is one, I obtain that data, modify it and send it to a different database. I have seen several examples on Spring integration where it integrates web pages, emails etc. I want to set up a poll for a table and get the message to the gateway from where I can handle it. Any help or advice is appreciated.
This example is the basic Db poller..
<int-jdbc:inbound-channel-adapter query="select * from item where status=2"
channel="target" data-source="dataSource"
update="update item set status=10 where id in (:id)" />
For channel 'target', you can put your service-activator to handle message.. You may also need a row-mapper..
Tell me more about your problem if you need more advice.,
See the inbound-channel-adapter in the reference documentation and/or the jdbc sample.
The sample doesn't show the use of the adapter, but it might help you with a general understanding of Spring Integration. Another useful resource is the test cases... integration tests and polling* parser tests.