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...
Related
In Spring integration app, you can send message to channel in different ways. Two of them are, you can use channel.send(msg) and MessageTemplate.convertAndSend(channel,msg).
Can anyone tell me the difference and which is recommended? What is the drwaback of others?
There is another more high-level way to send message - #MessagingGateway, where your source client is fully free from Messaging API.
On the other hand it is up to use what to use on the matter.
The MessageChannel.send() API is very low and don't provide so much control over the message.
The MessagingTemplate can be configured as a bean with some common options like MessageConverter, which is really used by the aforementioned convertAndSend(). But in the end it is, of course, just MessageChannel.send().
There is no any recommendations, but MessagingTemplate has been introduced for convenience.
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.
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!
I want to validate the SMO XML flowing in Websphere Enterprise Service Bus(WESB) mediation module.
Is it possible to do it inside the Custom Mediation or I have to create a Java class for that?
And how can I do that? I'm clueless on how to approach this.
Also, if you can suggest any useful links to read more on this, I would appreciate that.
Thanks :)
Custom mediation is a java class behind scene.
In ESB, you can do schema validation of messages by setting the validation checkbox on xslt transformation primitive or you can use code in a custom mediation:
BOInstanceValidator validator = (BOInstanceValidator) new
ServiceManager().locateService("com/ibm/websphere/bo/BOInstanceValidator");
boolean valid = validator.validate(dataObject, diagnosticList);
Documentation
I have a JAXB web service that does not expect the element Id to be passed across, and a client that passes that element anyhow.
The version of the web service currently in production silently ignores that unexpected element, but the version in QA complains. Tracing the XML of inbound requests, I confirmed the Id element is sent both to the production and QA versions of the service.
The error message in QA is:
org.apache.cxf.interceptor.Fault:
Unmarshalling Error: unexpected
element
(uri:"http://mydomain.com/transaction",
local:"Id"). Expected elements are...
The message is pretty clear, but the solution is not as the client is widely deployed.
As a first step, I would like to try and understand why the production version accepts this extra element while the QA version does not. There are not many differences between the two releases.
Suggestions where to look?
i dont know whether i got you question correct, but what i understand that you are creating xml using jaxb Marshaller and sending it to service. in prod your service accepts element which ever you pass..i assume that you have restfull webservice which unmarshalls the xml and validation by code. i suggest instead of inspecting inbound xml request check the code deployed in QA and PROD.. since the exception will be thrown during the validation which happens after unmarshalling of xml.. hope this helps :).