Re: Saxon and root tag matching

2016-12-06 Thread richardgroote
Hello,

When adding a  after the
spring-ws call than the response is fine. The response of the spring
webservice call is DomSource (SAAJMessageFactory is used).


Kind regards,

Richard



--
View this message in context: 
http://camel.465427.n5.nabble.com/Saxon-and-root-tag-matching-tp5791134p5791135.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Saxon and root tag matching

2016-12-06 Thread richardgroote
Hello,

I've a question about using saxon and xslt within Apache Camel. Below is the
simplified camel configuration we're uising. The mock service returns some
XML.

When using the below xslt part than the result after the xslt is the
response of the mock service without the xml elements (namespaces are
declared).
out

When using the below xslt part (matching the root tag and declaring the
namespace) than the response is as expected.
out

When using a tool (XMLSpear or java client) matching on the '/' works. Does
anyone have a clue why this is not working?




http://localhost:8088/mockHttpBinding?timeout=1; />



Kind regards,

Richard



--
View this message in context: 
http://camel.465427.n5.nabble.com/Saxon-and-root-tag-matching-tp5791134.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Attachment & multiple components

2016-06-09 Thread richardgroote
Hello,

We have a question about attachments & HTTP & Spring. May be anyone knows a
solution.
We're using the below camel configuration. 
The direct:Test is called with XML message and some attachments.
The XML is transformed and than send trough HTTP (the HTTP should not
receive the attachments)
After the HTTP call the attachments are no longer available
The next call is sends a MTOM message through Spring-WS and here the
attachment should be send but after the HTTP call the attachment are no
longer available.

Currently the solution is to make two camel calls (direct:Test) which does
the HTTP call and a new camel route direct:Test2 which does the spring-ws
call. In the future more complex integration is necessary and it would be
nice if it could be done within one camel route. Is there another solution?






//*[local-name()='Include']/@href




http://acme.com"/>

   

http://localhost:18081/mySoapService?messageFactory=#mtomAxiomMessageFactorymessageFilter=#soap11MTOMMessageFilter;
/>



Kind regards,

Richard



--
View this message in context: 
http://camel.465427.n5.nabble.com/Attachment-multiple-components-tp5783763.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: How to set decrypted db password for camel quartz component

2015-03-23 Thread richardgroote
Hello,

I'am not sure if this is possible on the QuartzComponent by default. But you
could override the quartzcomponent it self and override the method
createSchedulerFactory.

Kind regards,

Richard



--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-set-decrypted-db-password-for-camel-quartz-component-tp5764559p5764628.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: MethodInfo evaluate expression

2015-03-19 Thread richardgroote
Thanx, it should be fixed by https://issues.apache.org/jira/browse/CAMEL-8437



--
View this message in context: 
http://camel.465427.n5.nabble.com/MethodInfo-evaluate-expression-tp5764359p5764399.html
Sent from the Camel - Users mailing list archive at Nabble.com.


MethodInfo evaluate expression

2015-03-18 Thread richardgroote
Hello,

We're trying to split the body at a specific position with the below
statement.

from(direct:abc).setHeader(tmp,
constant((?=\\G.{3}))).setBody(simple(${body.split(${header.tmp})}));

The above does not work because the regular expression contains ')'.
Within the MethodInfo#evaluate the method parameters are determined. This is
done with the ObjectHelper.between(methodName, (, )) and than the
regular expression is not correctly anymore.

A solution for the above is to create a bean which does the splitting and
refer this bean in the splitter.


Kind regards,

Richard







--
View this message in context: 
http://camel.465427.n5.nabble.com/MethodInfo-evaluate-expression-tp5764359.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Cacehe-Controle header

2015-03-16 Thread richardgroote
Hello,

We used the below header strategy on the servlet component to allow some
headers.


public class ParameterizedHttpHeaderFilterStrategy extends
DefaultHeaderFilterStrategy {
private final String[] allowedOutHeaders;

public ParameterizedHttpHeaderFilterStrategy(String allowedOutHeaders) {
this.allowedOutHeaders = allowedOutHeaders.split(,);
}

protected void initialize() {
setOutFilter(getParameterizedOutFilter());

setLowerCase(true);

// filter headers begin with Camel or org.apache.camel
// must ignore case for Http based transports
   
setOutFilterPattern((?i)(Camel|org\\.apache\\.camel)[\\.|a-z|A-z|0-9]*);
}

protected SetString getParameterizedOutFilter() {
SetString outFilter = new HashSetString();
outFilter.add(content-length);
outFilter.add(content-type);
outFilter.add(host);
// Add the filter for the Generic Message header
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.5
outFilter.add(cache-control);
outFilter.add(connection);
outFilter.add(date);
outFilter.add(pragma);
outFilter.add(trailer);
outFilter.add(transfer-encoding);
outFilter.add(upgrade);
outFilter.add(via);
outFilter.add(warning);

for(String allowedOutHeader: allowedOutHeaders){
outFilter.remove(allowedOutHeader.toLowerCase());
}

return outFilter;
}
}


Kind regards,

Richard



--
View this message in context: 
http://camel.465427.n5.nabble.com/Cacehe-Controle-header-tp5764045p5764220.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: beginner: download json transform to xml send to ftp

2015-03-13 Thread richardgroote
Hello,

I'am using Spring configuration to configure the camel. Below is a example
of the things you described may be it's usefull

beans xmlns=http://www.springframework.org/schema/beans;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:camel=http://camel.apache.org/schema/spring;
xsi:schemaLocation=http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
 http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd 


bean id=xml2json
class=org.apache.camel.dataformat.xmljson.XmlJsonDataFormat
property name=typeHints value=YES/
property name=expandableProperties value=objects/
property name=forceTopLevelObject value=true/
property name=trimSpaces value=true/
property name=rootName value=request/
property name=skipNamespaces value=true/
property name=removeNamespacePrefixes value=true/
/bean

camel:camelContext id=biStandardCamelContext trace=true
xmlns=http://camel.apache.org/schema/spring;

camel:route
camel:from uri=direct:RetrieveJSONAndSendToFTP/

camel:to uri=http://www.mypage.com/stuff/my-stuff/


camel:unmarshal ref=xml2json/


camel:to uri=xslt:file:///some.xslt /


camel:to
uri=ftp:www.myftpServer.com/suppage?username=adminpassword=secret/
/camel:route

/camel:camelContext   
/beans






--
View this message in context: 
http://camel.465427.n5.nabble.com/beginner-download-json-transform-to-xml-send-to-ftp-tp5764007p5764078.html
Sent from the Camel - Users mailing list archive at Nabble.com.


SpringWebserviceProducer WebServiceMessageExtractor

2015-03-13 Thread richardgroote
Hello,

We're currently using SpringWS for sending and receiving soap messages.

When sending a soap call and the response of the soap call contains
attachments than those are not handled by the SpringWebserviceProducer.

It would be nice if the SpringWebserviceProducer support a custom
WebServiceMessageExtractor.
In the WebServiceMessageExtractor on the mimemessage the attachment could be
retrieved.

If needed i could supply some code.

Kind regards,

Richard



--
View this message in context: 
http://camel.465427.n5.nabble.com/SpringWebserviceProducer-WebServiceMessageExtractor-tp5764097.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Cacehe-Controle header

2015-03-12 Thread richardgroote
Hello,

For https://issues.apache.org/jira/browse/CAMEL-1975 a lot of headers are
filtered on the response.

We're using the servlet component and like to set the cache-control header
with values no-cache, no-store, must-revalidate. Is there a way to do this
without specifying a custom filter strategy?


Kind regards,

Richard



--
View this message in context: 
http://camel.465427.n5.nabble.com/Cacehe-Controle-header-tp5764045.html
Sent from the Camel - Users mailing list archive at Nabble.com.


HttpServletResolveConsumerStrategy improvement?

2015-03-12 Thread richardgroote
Hello,

At this moment we're replacing restlet by the servlet component.

In the spring camel configuration there are two routes defined (see below
for the URI) with overlapping URI parts. The client uses for example the
uri: http://localhost:8080/contextroot/servlet/ui/api/a/b/c/d.

The restlet component is capable of matching the above example on /ui/api
consumer. The servlet component matches the client call on the /ui consumer.

I created a extension on the HttpServletResolveConsumerStrategy for the
support on matching overlapping URI. May be this can be integrated in the
HttpServletResolveConsumerStrategy it self. See below for the changes


 URI in camel configuration 
servlet:///ui?matchOnUriPrefix=trueamp;httpMethodRestrict=GET,POST
servlet:///ui/api?matchOnUriPrefix=trueamp;httpMethodRestrict=GET,POST

 CHANGED Code ---
public class HttpServletResolveConsumerStrategy implements
ServletResolveConsumerStrategy {

@Override
public HttpConsumer resolve(HttpServletRequest request, MapString,
HttpConsumer consumers) {
String path = request.getPathInfo();
if (path == null) {
return null;
}
HttpConsumer answer = consumers.get(path);

MapString, HttpConsumer matchedConsumers = new HashMapString,
HttpConsumer();
if (answer == null) {
for (String key : consumers.keySet()) {
//We need to look up the consumer path here
String consumerPath = consumers.get(key).getPath();
HttpConsumer consumer = consumers.get(key);
// Just make sure the we get the right consumer path first
if (consumerPath.equals(path) ||
(consumer.getEndpoint().isMatchOnUriPrefix() 
path.startsWith(consumerPath))) {
matchedConsumers.put(consumerPath, consumers.get(key));
}
}
}

int pathParts = 0;
HttpConsumer bestMatchedConsumer = null;
for(String consumerPath: matchedConsumers.keySet()){
String[] consumerPathParts = consumerPath.split(/);
if(consumerPathParts.length  pathParts){
pathParts = consumerPathParts.length;
bestMatchedConsumer = matchedConsumers.get(consumerPath);
}
}
if(bestMatchedConsumer != null){
answer = bestMatchedConsumer;
}

return answer;
}

}






--
View this message in context: 
http://camel.465427.n5.nabble.com/HttpServletResolveConsumerStrategy-improvement-tp5763993.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: HttpServletResolveConsumerStrategy improvement?

2015-03-11 Thread richardgroote
Hello,

In the above URI the parameter httpMethodRestrict is used. This options is
currently not documented on http://camel.apache.org/servlet.html. 


Kind regards,

Richard





--
View this message in context: 
http://camel.465427.n5.nabble.com/HttpServletResolveConsumerStrategy-improvement-tp5763993p5763994.html
Sent from the Camel - Users mailing list archive at Nabble.com.


XmlJsonDataFormat data format definition cannot set typeHints

2015-01-30 Thread richardgroote

Good day,

When using the dataformats with the help of
org.apache.camel.model.dataformat.XmlJsonDataFormat than the typeHints
cannot be set.

I think there is a bug in method configureDataFormat. The second parameter
in the method call
setProperty(camelContext, typeHints, TYPE_HINTS, typeHints);  should be
dataFormat.




dataFormats
xmljson id=xmljson typeHints=YES/
/dataFormats


bean id=xml2json
class=org.apache.camel.dataformat.xmljson.XmlJsonDataFormat
property name=typeHints value=YES/
property name=expandableProperties value=objects/
property name=forceTopLevelObject value=true/
property name=trimSpaces value=true/
property name=rootName value=request/
property name=skipNamespaces value=true/
property name=removeNamespacePrefixes value=true/
/bean


Kind regards,

Richard



--
View this message in context: 
http://camel.465427.n5.nabble.com/XmlJsonDataFormat-data-format-definition-cannot-set-typeHints-tp5762258.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Http 3 Component and Credential delegation

2015-01-30 Thread richardgroote
Hello,

I've overriden the HttpProducer, HttpEndpoint and parts of the HttpComponent
to support credential delegation on the HTTP Client.

It would be nice if this was standard available in the Http Component.

KInd regards,

Richard



--
View this message in context: 
http://camel.465427.n5.nabble.com/Http-3-Component-and-Credential-delegation-tp5762175p5762259.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Http 3 Component and Credential delegation

2015-01-28 Thread richardgroote
Good day,

When using the HTTP(3) component of Apache Camel it is possible to define a
HttpClientConfigurer to add additional authentication / security. The
HttpClientConfigurer is used when the http client is created.

In our case we'd like to add a kerberos ticket when the http method is
called. Therefore we do not know the credentials when the camel
configuration (spring config) is loaded / created. So just before the http
call is made the credentials should be set on the http client. 

I've tried the HttpClientConfigurer but this one is created when the
HttpProducer is created and at that time i do not know the credentials. 

When the HttpProducer#process is called i know the credentials and can add
them to the client. A possible solution is to override HttpComponent,
HttpEndpoint and HttpProducer but i hope that is a better solution for it.

Does anyone have a better solution to add credentials to the httpclient just
before the http method is executed?

KInd regards,

Richard








--
View this message in context: 
http://camel.465427.n5.nabble.com/Http-3-Component-and-Credential-delegation-tp5762175.html
Sent from the Camel - Users mailing list archive at Nabble.com.


XSLT Component empty elements

2015-01-08 Thread richardgroote
Hello,

We are upgrading from Apache Camel version 2.12.2 to 2.14.0 but have some
problems with XSLT component.

The input for the XSLT component is xml with no namespaces in it (see
below). 
The result after the transformation does not contain any elements because
tests on the elements do not succeed. 

With the below test XSLT if tried to determine if the namespace is a problem
but both test elements are not within the response when using version 2.14.0

If changed the stylesheet to copy everything than i get a NPE in
org.apache.xml.serializer.ToXMLStream.addAttribute(ToXMLStream.java:451)

I've tried a couple of things but could not get it working.
(allowStAX, true or false does not matter)
(transformer is in both situation the same xalan transformer of JBoss)


Kind Regards,

Richard

Environment:
- MAC
- JBoss EAP 6.3.0
- Java 7







camel:route
camel:from uri=direct:SelectUsersFromDatasource/

   camel:to uri=sql:select * from CMFUSER/
   camel:marshal
  camel:xstream/
  /camel:marshal

   camel:to uri=file:///data/tmp?fileName=beforeXSLT.txt/
camel:to
uri=xslt:file:///tmp/transform_resultset_to_event_response.xslt /
camel:to uri=file:///data/tmp?fileName=afterXSLT.txt/
/camel:route




?xml version=1.0 encoding=UTF-8?
list
org.springframework.util.LinkedCaseInsensitiveMap
serialization=custom
unserializable-parents/
map
default
loadFactor0.75/loadFactor
threshold24/threshold
/default
int32/int
int24/int
stringID/string
long1/long
stringORGANISATIONID/string


?xml version=1.0 encoding=UTF-8?
xsl:stylesheet version=2.0
xmlns:xsl=http://www.w3.org/1999/XSL/Transform; 
xmlns:know=http://someuri; 
xmlns:cas=http://someuri2;

xsl:output method=xml version=1.0 encoding=UTF-8 indent=yes/

xsl:template match=/
cas:eventResponse 
xsl:if test=/list
  xsl:element name=test1/xsl:element
/xsl:if
xsl:if test=/*[local-name()='list']
  xsl:element name=test2/xsl:element
/xsl:if
test3/test3
/cas:eventResponse
/xsl:template


/xsl:stylesheet


xsl:template match=node()|@*
xsl:copy
xsl:copy-of select=@*/
xsl:apply-templates select=node()/
/xsl:copy
/xsl:template




--
View this message in context: 
http://camel.465427.n5.nabble.com/XSLT-Component-empty-elements-tp5761456.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: XSLT Component empty elements

2015-01-08 Thread richardgroote
Hello,

When altering the camel route and adding convertBody to java.io.InputStream
just before the xslt solves this problem.
Also adding the streamcache option solves this problem.

I' am still curious why the caching or converting is necessary.

Kind regards,

Richard



--
View this message in context: 
http://camel.465427.n5.nabble.com/XSLT-Component-empty-elements-tp5761456p5761468.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Spring WS and Soap Action

2014-03-05 Thread richardgroote
Hello,

We currently are using REST component and SOAP component for receiving
messages within our application.

The below part of the camel configuration has a dynamic URL for the restlet
call and part of the URI is used within the onMessage of the bean. The below
works fine and makes it easy to define one route for all incoming rest calls
and within the bean we can address / find the correct code.

camel:route
camel:from
uri=restlet:/{endpoint}/{storeidentifier}/search?restletMethod=#getMethod
/
camel:to uri=bean:someBean?method=onMessage(${header.endpoint}) /
/camel:route

If we try the same for Spring WS with a soapAction. It will not find the
endpoint. Because the
org.apache.camel.component.spring.ws.bean.CamelEndpointMapping.getEndpointInternal(MessageContext)
does not resolve the dynamic part.
 
camel:from
uri=spring-ws:soapaction:{endpoint}?endpointMapping=#endpointMapping /

I can solved it by using the spring-ws:uri mapping type and create a
processor for retrieving the soap action. 

My question is the above solution the only way to go or do i miss something?
Also it would be great if the SpringWSConsumer makes the HTTP Headers
available as headers (same as the restlet component)

Kind regards,

Richard



--
View this message in context: 
http://camel.465427.n5.nabble.com/Spring-WS-and-Soap-Action-tp5748327.html
Sent from the Camel - Users mailing list archive at Nabble.com.


DefaultClassResolver and schemes

2013-05-06 Thread richardgroote
Hello,

In our project we'd like to resolve uri within the camel configuration.
For instance camel:to uri=xslt:myScheme://myProject/test.xslt /.
It's not possible to resolve the resources through file, classpath, etc.

We created an extension on the org.apache.camel.impl.DefaultClassResolver
and override the method loadResourceAsStream with our own resolving. This
was working fine camel 2.10.1 but it's not working anymore within 2.11.
Within the org.apache.camel.builder.xml.XsltUriResolver the '//' within my
url is replaced with '/'. I fixed it in our extension but now i have the
following questions:

- Is the above solution the correct solution or are there are ways to
resolve uri's.
- Is it correct that slashes are removed

Kind regards,

Richard



--
View this message in context: 
http://camel.465427.n5.nabble.com/DefaultClassResolver-and-schemes-tp5732075.html
Sent from the Camel - Users mailing list archive at Nabble.com.