Spring-WS provides the following support as part of their template.
http://docs.spring.io/spring-ws/site/apidocs/org/springframework/ws/client/core/WebServiceTemplate.html#setCheckConnectionForFault(boolean)
Trying to determine if Spring Integration exposes this. Found the following from 2012, however I was hoping it would be part of the framework.
http://forum.spring.io/forum/spring-projects/integration/119981-ws-outbound-gateway-and-soap-fault
No, we don't support yet.
As I said there: feel free to raise a JIRA issue! :-)
Example configuration based on explanation from 2012 link ...
#Bean
#Description("Workaround for non conforming services")
AbstractWebServiceOutboundGateway initializeWebserviceGateway(
#Qualifier("wsOutboundGateway.handler") Object bean) {
Advised advised = (Advised) bean;
AbstractWebServiceOutboundGateway gateway = null;
try {
gateway = (AbstractWebServiceOutboundGateway) advised
.getTargetSource().getTarget();
} catch (Exception e) {
throw new IllegalStateException("Unable to configure webServiceTemplate for non conforming services");
}
DirectFieldAccessor dfa = new DirectFieldAccessor(gateway);
WebServiceTemplate wst = (WebServiceTemplate) dfa
.getPropertyValue("webServiceTemplate");
wst.setCheckConnectionForError(false);
wst.setCheckConnectionForFault(false);
return gateway;
}
Related
I am trying to inlcude tax calculation on the site that I am building and I want to use the out of the box SimpleTaxProvider
I am trying to follow this link
https://www.broadleafcommerce.com/docs/core/current/broadleaf-concepts/pricing/tax/simple-tax-provider#
I have to include the bean definition within my Spring application context file
This may be a noob question but I am confused. Where I am supposed to find this file?
*EDIT:
I understand that I have to do an annotation based configuration but it is not clear to me how
Thanks in advance!!
solved by one of the contributors at github:
https://github.com/BroadleafCommerce/DemoSite/issues/45
I am posting a solution here for anyone interested:
#Configuration
public class MyTaxConfiguration {
#Merge("blTaxProviders")
public List<?> myTaxProviders(SimpleTaxProvider blSimpleTaxProvider) {
//merge
return Arrays.asList(blSimpleTaxProvider);
}
#Bean
SimpleTaxProvider blSimpleTaxProvider(){
SimpleTaxProvider smpl=new SimpleTaxProvider();
Map<String,Double> map= new HashMap();
map.put("SPAIN", 0.08); //example1
map.put("US", 0.1); //example2
map.put("FRANCE", 0.2); //example3
smpl.setItemCountryTaxRateMap(map);
return smpl;
}
}
I am Spring Integration 4.3.13 and trying to pass patterns when configuring #GlobalChannelInterceptor
Here is the example
#Configuration
public class IntegrationConfig{
#Bean
#GlobalChannelInterceptor(patterns = "${spring.channel.interceptor.patterns:*}")
public ChannelInterceptor channelInterceptor(){
return new ChannelInterceptorImpl();
}
}
properties file has following values:
spring.channel.interceptor.patterns=*intchannel, *event
I am using direct channels with names that end with these two string
springintchannel
registrationevent
With the above config, both the channels should have interceptor configured but it is not getting configured.
The comma-separate value isn't support there currently.
I agree that we need to fix it, so feel free to raise a JIRA on the matter and we will file a solution from some other place.
Meanwhile you can do this as a workaround:
#Bean
public GlobalChannelInterceptorWrapper channelInterceptorWrapper(#Value("${spring.channel.interceptor.patterns:*}") String[] patterns) {
GlobalChannelInterceptorWrapper globalChannelInterceptorWrapper = new GlobalChannelInterceptorWrapper(channelInterceptor());
globalChannelInterceptorWrapper.setPatterns(patterns);
return globalChannelInterceptorWrapper;
}
My PLUGIN is firing on Entity A and in my code I am invoking a web service that returns an XML file with some attributes (attr1,attr2,attr3 etc ...) for Entity B including GUID.
I need to update Entity B using the attributes I received from the web service.
Can I use Service Context Class (SaveChanges) or what is the best way to accomplish my task please?
I would appreciate it if you provide an example.
There is no reason you need to use a service context in this instance. Here is basic example of how I would solve this requirement. You'll obviously need to update this code to use the appropriate entities, implement your external web service call, and handle the field updates. In addition, this does not have any error checking or handling as should be included for production code.
I made an assumption you were using the early-bound entity classes, if not you'll need to update the code to use the generic Entity().
class UpdateAnotherEntity : IPlugin
{
private const string TARGET = "Target";
public void Execute(IServiceProvider serviceProvider)
{
//PluginSetup is an abstraction from: http://nicknow.net/dynamics-crm-2011-abstracting-plugin-setup/
var p = new PluginSetup(serviceProvider);
var target = ((Entity) p.Context.InputParameters[TARGET]).ToEntity<Account>();
var updateEntityAndXml = GetRelatedRecordAndXml(target);
var relatedContactEntity =
p.Service.Retrieve(Contact.EntityLogicalName, updateEntityAndXml.Item1, new ColumnSet(true)).ToEntity<Contact>();
UpdateContactEntityWithXml(relatedContactEntity, updateEntityAndXml.Item2);
p.Service.Update(relatedContactEntity);
}
private static void UpdateContactEntityWithXml(Contact relatedEntity, XmlDocument xmlDocument)
{
throw new NotImplementedException("UpdateContactEntityWithXml");
}
private static Tuple<Guid, XmlDocument> GetRelatedRecordAndXml(Account target)
{
throw new NotImplementedException("GetRelatedRecordAndXml");
}
}
I'm trying to use JDT SearchEngine to find references to a given object. But I'm getting a "NullPointerException" while invoking the "search" method of org.eclipse.jdt.core.search.SearchEngine.
Following is the error trace:
java.lang.NullPointerException at
org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:214)
at
org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:515)
at
org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:582)
And following is the method I'm using to perform search:
private static void search(String elementName) { //elementName -> a method Name
try {
SearchPattern pattern = SearchPattern.createPattern(elementName, IJavaSearchConstants.METHOD,
IJavaSearchConstants.REFERENCES, SearchPattern.R_PATTERN_MATCH);
IJavaSearchScope scope = SearchEngine.createWorkspaceScope();
SearchRequestor requestor = new SearchRequestor() {
#Override
public void acceptSearchMatch(SearchMatch match) {
System.out.println("Element - " + match.getElement());
}
};
SearchEngine searchEngine = new SearchEngine();
SearchParticipant[] searchParticipants = new SearchParticipant[] { SearchEngine
.getDefaultSearchParticipant() };
searchEngine.search(pattern, searchParticipants, scope, requestor, null);
} catch (Exception e) {
e.printStackTrace();
}
}
Refer the "Variables" window of the following snapshot to check the values of the arguments passing to the "searchEngine.search()":
I think the the issue is because of the value of "scope" [Highlighted in 'BLACK' above].
Which means "SearchEngine.createWorkspaceScope()" doesn't return expected values in this case.
NOTE: Please note that this is a part of my program which runs as a stand-alone java program (not an eclipse plugin) using JDT APIs to parse a given source code (using JDT-AST).
Isn't it possible to use JDT SearchEngine in such case (non eclipse plugin program), or is this issue due to some other reason?
Really appreciate your answer on this.
No. You cannot use the search engine without openning a workspace. The reason is that the SearchEngine relies on the eclipse filesystem abstraction (IResource, IFile, IFolder, etc.). This is only available when the workspace is open.
I have developed a Application using pointcut(AOP Around) in java.i.e.
pointcut ps(String s,int iTemp1,int iTemp2) :
call (void java.awt.Graphics.drawString(String,int,int)) && args(s,iTemp1,iTemp2);
void around(String s,int i1,int i2) : ps(s,i1,i2)
{
if(flag1)
{
try
{
//Some code
}
catch(Exception ex)
{
}
}
s=image_applet.foo(s);
if(flag2)
{
try
{
//code
}
catch(Exception ex)
{
}
}
proceed(s,iTemp1,iTemp2);
}
and I want to develop same pointcut in our methods which is used in my c# code.If it is possible den please give me some directions.
I've used Spring.NET's AOP implementations with great success - maybe that could work for you?
Checkout the NKalore project #
http://aspectsharpcomp.sourceforge.net/
There are loads of AOP spoofs in .NET including the handicapped Code Contracts. However to my knowledge NKalore is the only one that mirrors AspectJ grammar and patterns. Other frameworks like LinFu, post sharp (starter edition) require you to place attributes and follow a different pattern. There is no AOP grammar support because they lack AOP compilers.