web services - Apache Camel upgrade from 2.13.0 to 2.17.2 route not working -
after upgrading java implementation of camel 2.13.0 2.17.2 (and cxf-rt-frontend-jaxrs 2.7.10 3.1.5, , spring framework 3.2.8 4.3.2), webapp serving proxy stopped working correctly.
the app supposed intercept webservice request, modify fields defined in properties file throught contextmanager class, , forward request correct endpoint.
after upgrade, app unable set missing fields in original request, returning following message: "request_message_not_compliant_with_schema - request message not comply web service schema".
this of course expected since missing fields not being set.
any appreciated.
update:
the problem seems coming xpath method in previous version returned correct node information needs set , returning null.
my camel route definition follows:
creditlimitrequestserviceroute.class
public class creditlimitrequestserviceroute extends abstractehroute { @autowired private contextmanager contextmanager; @override public void configure() throws exception { namespaces ns = new namespaces("ns1", "http://ehsmartlink/commonerror"); onexception(soapfault.class) .to("consoleflux:message?level=error&text=${exception.message}&content=${exception.detail}") .setheader("soapfaultdetail", simple("${exception.detail}")) .choice() .when(and(header("soapfaultdetail").isnotnull(), xpath("//ns1:commonerror/errortype/text() = 'businesserror'", ns, "soapfaultdetail"))) .to("consoleflux:finish?ignorecontent=true") .otherwise() .to("consoleflux:error?ignorecontent=true"); onexception(exception.class) .to("consoleflux:error"); from("cxf:bean:creditlimitrequestserviceproxy?dataformat=payload").routeid("creditlimitrequestserviceroute") .log(logginglevel.info, "invocation du ws").streamcaching() .to("consoleflux:start?source=soa&dest=eh&type=credit_limit") .to("consoleflux:message?ignorecontent=true&text=affectation du contexte eh") .setheader("context").xpath("//context") .bean(contextmanager, "setcontext") .to("consoleflux:message?ignorecontent=true&text=invocation du ws eh ${headers.operationname}") .to("cxf:bean:creditlimitrequestservice?dataformat=payload") .to("consoleflux:finish"); } } abstractehroute.class
public abstract class abstractehroute extends routebuilder { protected xpathbuilder xpath(string text, namespaces namespaces, string headername) { xpathbuilder xpath = xpathbuilder.xpath(text).namespaces(namespaces); xpath.setheadername(headername); return xpath; } } contextmanager
package com.stef.soa.eh.integration.beans; import static com.google.common.base.objects.firstnonnull; import static com.google.common.base.strings.isnullorempty; import java.util.map; import java.util.uuid; import org.apache.camel.header; import org.springframework.beans.factory.annotation.value; import org.springframework.stereotype.component; import org.w3c.dom.document; import org.w3c.dom.element; import org.w3c.dom.node; import org.w3c.dom.nodelist; import com.google.common.base.preconditions; import com.google.common.collect.maps; @component public class contextmanager { private static final string user_name = "username"; private static final string user_password = "userpassword"; private static final string language_text_identifier = "languagetextidentifier"; private static final string transaction_identifier = "transactionidentifier"; private static final string policiy_identifier = "policyidentifier"; private static final string policy_extension_identifier = "policyextensionidentifier"; private static final string policy_ehbu_identifier = "policyehbuidentifier"; private static final string ip_adress = "ipadress"; @value("${eh.context.username}") private string username; @value("${eh.context.userpassword}") private string userpassword; @value("${eh.context.languagetextidentifier}") private string languagetextidentifier; @value("${eh.context.policyidentifier}") private string policyidentifier; @value("${eh.context.policyextensionidentifier}") private string policyextensionidentifier; @value("${eh.context.policyehbuidentifier}") private string policyehbuidentifier; @value("${eh.context.ipadress}") private string ipadress; public void setcontext(@header("context") node context) { preconditions.checknotnull(context, "le contexte doit être renseigné"); // suppression des noeuds enfants avec sauvegarde les valeurs courantes dans une map map<string, string> currentvalues = maps.newhashmap(); nodelist list = context.getchildnodes(); (int = list.getlength() - 1; >= 0; i--) { node child = list.item(i); if (child.getnodetype() == node.element_node && !isnullorempty(child.gettextcontent())) { currentvalues.put(child.getnodename(), child.gettextcontent()); } context.removechild(child); } // ajout des noeuds enfants appendchild(context, user_name, username, currentvalues); appendchild(context, user_password, userpassword, currentvalues); appendchild(context, language_text_identifier, languagetextidentifier, currentvalues); appendchild(context, transaction_identifier, uuid.randomuuid().tostring(), currentvalues); appendchild(context, policiy_identifier, policyidentifier, currentvalues); appendchild(context, policy_extension_identifier, policyextensionidentifier, currentvalues); appendchild(context, policy_ehbu_identifier, policyehbuidentifier, currentvalues); appendchild(context, ip_adress, ipadress, currentvalues); } private void appendchild(node node, string name, string value, map<string, string> currentvalues) { document document = node.getownerdocument(); element child = document.createelement(name); child.settextcontent(firstnonnull(currentvalues.get(name), value)); node.appendchild(child); } } context.xml
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:property-placeholder location="classpath:eh.properties, file:///${eh.home}/conf/eh.properties" ignore-resource-not-found="true" system-properties-mode="override" /> <context:component-scan base-package="com.stef.soa.eh" /> <context:annotation-config /> <import resource="classpath:meta-inf/eh/spring/broker.xml" /> <import resource="classpath:meta-inf/eh/spring/camel.xml" /> <import resource="classpath:meta-inf/eh/spring/cxf.xml" /> <import resource="classpath:meta-inf/soa-console-flux-client/spring/context.xml"/> </beans> camel.xml
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:http="http://cxf.apache.org/transports/http/configuration" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd" > <!-- camel context --> <camelcontext xmlns="http://camel.apache.org/schema/spring" id="ehcontext"> <properties> <property key="org.apache.camel.xmlconverter.output.indent" value="yes"/> <property key="org.apache.camel.xmlconverter.output.{http://xml.apache.org/xslt}indent-amount" value="4"/> </properties> <package>com.stef.soa.eh.integration</package> </camelcontext> </beans> cxf.xml
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:cxf="http://camel.apache.org/schema/cxf" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:sec="http://cxf.apache.org/configuration/security" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd" > <!-- serveur proxy, certificat --> <http:conduit name="*.http-conduit"> <http:client proxyserver="${proxy.host}" proxyserverport="${proxy.port}" connectiontimeout="${http.client.connectiontimeout}" receivetimeout="${http.client.receivetimeout}" /> <http:proxyauthorization> <sec:username>${proxy.username}</sec:username> <sec:password>${proxy.password}</sec:password> </http:proxyauthorization> <http:tlsclientparameters> <sec:keymanagers keypassword="${eh.keystore.password}"> <sec:keystore type="pkcs12" password="${eh.keystore.password}" file="${eh.home}/${eh.keystore.file}" /> </sec:keymanagers> </http:tlsclientparameters> </http:conduit> <!-- services proxy et cible --> <cxf:cxfendpoint id="creditlimitrequestserviceproxy" address="/creditlimitrequestservice" wsdlurl="meta-inf/eh/wsdl/creditlimitrequestservice/eh_smartlink_creditlimitrequestservicev4.wsdl" servicename="ns:creditlimitrequestservicev4" endpointname="ns:creditlimitrequestservicev4" xmlns:ns="http://ehsmartlink/creditlimitrequestservice/v4" /> <cxf:cxfendpoint id="creditlimitrequestservice" address="${eh.creditlimitrequestservice.url}" wsdlurl="meta-inf/eh/wsdl/creditlimitrequestservice/eh_smartlink_creditlimitrequestservicev4.wsdl" servicename="ns:creditlimitrequestservicev4" endpointname="ns:creditlimitrequestservicev4" xmlns:ns="http://ehsmartlink/creditlimitrequestservice/v4" loggingfeatureenabled="true" /> <cxf:cxfendpoint id="customerlistretrieveserviceproxy" address="/customerlistretrieveservice" wsdlurl="meta-inf/eh/wsdl/customerlistretrieveservice/customerlistretrievev2.wsdl" servicename="ns:customerlistretrieveservicev2" endpointname="ns:customerlistretrieveservicev2" xmlns:ns="http://ehsmartlink/customerlistretrieve/v2" /> <cxf:cxfendpoint id="customerlistretrieveservice" address="${eh.customerlistretrieveservice.url}" wsdlurl="meta-inf/eh/wsdl/customerlistretrieveservice/customerlistretrievev2.wsdl" servicename="ns:customerlistretrieveservicev2" endpointname="ns:customerlistretrieveservicev2" xmlns:ns="http://ehsmartlink/customerlistretrieve/v2" loggingfeatureenabled="true" /> <cxf:cxfendpoint id="firsteurolistrepertoirereadserviceproxy" address="/firsteurolistrepertoirereadservice" wsdlurl="meta-inf/eh/wsdl/firsteurolistrepertoirereadservice/eh_smartlink_firsteurolistrepertoirereadservice-v1.wsdl" servicename="ns:firsteurolistrepertoirereadservice-v1" endpointname="ns:firsteurolistrepertoirereadserviceport-v1_soap11" xmlns:ns="http://eulerhermes.com/smartlink/services/firsteurolistrepertoirereadservice/v1" /> <cxf:cxfendpoint id="firsteurolistrepertoirereadservice" address="${eh.firsteurolistrepertoirereadservice.url}" wsdlurl="meta-inf/eh/wsdl/firsteurolistrepertoirereadservice/eh_smartlink_firsteurolistrepertoirereadservice-v1.wsdl" servicename="ns:firsteurolistrepertoirereadservice-v1" endpointname="ns:firsteurolistrepertoirereadserviceport-v1_soap11" xmlns:ns="http://eulerhermes.com/smartlink/services/firsteurolistrepertoirereadservice/v1" loggingfeatureenabled="true" /> <cxf:cxfendpoint id="firsteurolistrepertoireupdateserviceproxy" address="/firsteurolistrepertoireupdateservice" wsdlurl="meta-inf/eh/wsdl/firsteurolistrepertoireupdateservice/eh_smartlink_firsteurolistrepertoireupdateservice-v1.wsdl" servicename="ns:firsteurolistrepertoireupdateservice-v1" endpointname="ns:firsteurolistrepertoireupdateserviceport-v1" xmlns:ns="http://eulerhermes.com/smartlink/services/firsteurolistrepertoireupdateservice/v1" /> <cxf:cxfendpoint id="firsteurolistrepertoireupdateservice" address="${eh.firsteurolistrepertoireupdateservice.url}" wsdlurl="meta-inf/eh/wsdl/firsteurolistrepertoireupdateservice/eh_smartlink_firsteurolistrepertoireupdateservice-v1.wsdl" servicename="ns:firsteurolistrepertoireupdateservice-v1" endpointname="ns:firsteurolistrepertoireupdateserviceport-v1" xmlns:ns="http://eulerhermes.com/smartlink/services/firsteurolistrepertoireupdateservice/v1" loggingfeatureenabled="true" /> <cxf:cxfendpoint id="limitdetailreadserviceproxy" address="/limitdetailreadservice" wsdlurl="meta-inf/eh/wsdl/limitdetailreadservice/eh_smartlink_limitdetailreadservice-v2.wsdl" servicename="ns:limitdetailreadservice-v2" endpointname="ns:limitdetailreadserviceport-v2" xmlns:ns="http://eulerhermes.com/smartlink/services/limitdetailreadservice/v2" /> <cxf:cxfendpoint id="limitdetailreadservice" address="${eh.limitdetailreadservice.url}" wsdlurl="meta-inf/eh/wsdl/limitdetailreadservice/eh_smartlink_limitdetailreadservice-v2.wsdl" servicename="ns:limitdetailreadservice-v2" endpointname="ns:limitdetailreadserviceport-v2" xmlns:ns="http://eulerhermes.com/smartlink/services/limitdetailreadservice/v2" loggingfeatureenabled="true" /> </beans>
Comments
Post a Comment