Currently we are trying to build a proxy with Mule ESB that provides an internal webservice and then goes to an external soap service with the provides parameters of the internal one. Once I got that, I'll alter the soap content and lay-out. Then the third step the results have to be calculated by Mule.
But before we reach step 2 and 3, lets first start with the proxy. Currently I am looking at http://www.mulesoft.org/documentation/display/MULE3USER/Proxying+Web+Services
However the WSProxyService provided does not work. The code seems to be for Mule 2.2. I tried recreating it which looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.2/mule-http.xsd">
<spring:bean name="WSProxyService" class="org.mule.module.cxf.WSProxyService">
<spring:property name="wsdlFile" value="resources/tisclientws.wsdl"/>
</spring:bean>
<flow name="HttpProxyService">
<http:inbound-endpoint address="http://localhost:8090/tis/proxy" exchange-pattern="request-response"/>
<component>
<spring-object bean="WSProxyService" />
</component>
<http:outbound-endpoint address="ADDRESSHERE/tisclientws.asmx" exchange-pattern="request-response"/>
</flow>
</mule>
This however gives the error
Exception stack is:
1. Service not set, this service has not been initialized properly. (org.mule.api.lifecycle.InitialisationException)
org.mule.module.cxf.WSProxyService:254 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/lifecycle/InitialisationException.html)
Can anyone help me? I tried various things without any luck.
Last but not least, I also looked at http://www.mulesoft.org/documentation/display/MULE3USER/Consuming+Web+Services+with+CXF but the problem there is multiple parameters and no internal WSDL from the provided internal service.
Thanks for the reply, it helped a lot. After some trial and error, I got it... sort of...
Currently the proxy gives me a local WSDL (working as intended). However upon closer inspection the SOAP 1.2 section of WSDL remains unaltered and still points towards the original location. To make matters worse, the SOAP 1.1 section when invoked, gives an error (while the original version works fine).
So I am heading in the right direction. Now just to fix these problems.
Besides that, maybe somebody can point me in the right direction. Lets say I want to take the output from the external service and only calculate all the hours and throw that back to the local service in an XML-form. Does that fall under the custom transformer category?
I used the following code:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/3.2/mule-cxf.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.2/mule-http.xsd">
<flow name="test">
<http:inbound-endpoint address="http://localhost:8090/tis/proxy" exchange-pattern="request-response"/>
<cxf:proxy-service
wsdlLocation="services/tisclientws.wsdl"
service="tisclientws"
namespace="NAMESPACEHERE"
validationEnabled="true"
enableMuleSoapHeaders="false"
/>
<http:outbound-endpoint address="EXTERNALURL/tisclientws.asmx" exchange-pattern="request-response"/>
</flow>
</mule>
The error received from SOAP 1.1:
<faultstring>Schema validation error on message from client: tag name "icTables" is not allowed. Possible tag names are: <iiBSNNummer>.</faultstring>
Upon disabling validation, the error changes to:
<faultcode>soap:Server</faultcode>
<faultstring>Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=EXTERNALADDRESS/tisclientws.asmx, connector=HttpConnector
{
name=connector.http.mule.default
lifecycle=start
this=17b79a6
numberOfConcurrentTransactedReceivers=4
createMultipleTransactedReceivers=true
connected=true
supportedProtocols=[http]
serviceOverrides=<none>
}
, name='endpoint.EXTERNALADDRESS.tisclientws.asmx', mep=REQUEST_RESPONSE, properties={}, transactionConfig=Transaction{factory=null, action=INDIFFERENT, timeout=0}, deleteUnacceptedMessages=false, initialState=started, responseTimeout=10000, endpointEncoding=UTF-8, disableTransportTransformer=false}. Message payload is of type: DepthXMLStreamReader</faultstring>
The WSProxyService is a legacy from Mule 2 and will not work with flows, only services. Instead prefer using either:
A web service proxy pattern,
A CXF proxy, if you need more control than the ws-proxy-service pattern gives you.
If it is a proxy then you may use a Web Service Proxy Pattern.
<pattern:web-service-proxy
xmlns:pattern="http://www.mulesoft.org/schema/mule/pattern"
wsdlLocation="${worker.wsdlLocation}"
name="WorkerDummy-WSProxyRequestOrder"
inboundAddress="${worker.inboundAddress}"
outboundAddress="${worker.outboundAddress}">
</pattern:web-service-proxy>
Related
I want to make the manager app to work with LDAP, at the moment i have managed to make manager app to work with the realm org.apache.catalina.realm.MemoryRealm but i need to make it work with this realm org.apache.catalina.realm.JNDIRealm. I have set the realm in the context.xml file like this:
<Realm resourceName="nalytics-web-ldap-realm" allRolesMode="authOnly"
className="org.apache.catalina.realm.MemoryRealm" connectionName="uid=admin,ou=system"
connectionPassword="myPassword" connectionURL="ldap://localhost:10389"
debug="99" userBase="ou=product,o=company,dc=com" userRoleName="memberOf"
userSearch="cn={0}" userSubtree="true" />
and my tomcat-users.xml is:
<tomcat-users xmlns="http://tomcat.apache.org/xml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://tomcat.apache.org/xml tomcat-users.xsd"
version="1.0">
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="deployer" password="deployer" roles="manager-gui,manager-script"/>
</tomcat-users>
Finally my manager.xml file is:
<?xml version="1.0" encoding="UTF-8"?>
<Context privileged="true" antiResourceLocking="false" docBase="${catalina.home}/webapps/manager">
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
</Context>
What settings/configurations do i need to do in order to make manager app to work with realm org.apache.catalina.realm.JNDIRealm? After researching i found that i have to create role names in LDAP and put there the username and then change the WEB-INF/web.xml of the manager to match the new role names but i am not sure as i haven't done something similar before.
Anyone who has achieved to make the manager app to work with LDAP it would be very helpful to share what they did.
We have one xml configuration file that we use in production. We also have a little test app that has a couple of additional needs. What I'd like to do is create a second, testing-only xml config file that references the embedded production configuration file. Is there any way to do this?
I'm aware of the "include" element, but am not sure where in the file it is supposed to be placed--in the castle node? The components node?
I feel like the answer is here but I'm too dense to figure it out.
Thanks for any help you can provide.
UPDATE
This is how our production config file is set up:
<?xml version="1.0" encoding="utf-8"?>
<OurCompany>
<Framework>
<castle>
<installers>
<!-- some installers-->
<installers>
<components>
<!--some components-->
<components>
<castle>
<Framework>
<OurCompany>
My most recent attempt at a non-production config file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<OurCompany>
<Framework>
<castle>
<include uri="assembly://AssemblyContainingEmbeddedXml/MyEmbeddedConfig.xml" />
<components>
<!--components I only want registered with container when running in non-production environment-->
<components>
<castle>
<Framework>
<OurCompany>
The exception I get reads:
Configuration parser encountered Framework, but it was expecting to find installers, facilities or components. There might be either a typo on or you might have forgotten to nest it properly.
(In the actual message, "Framework," "installers," "facilities," and "components" are enclosed in angle brackets.)
The bottom of the page you reference has an example of loading from an embedded resourced:
IResource resource = new AssemblyResource("assembly://Acme.Crm.Data/Configuration/services.xml");
container = new WindsorContainer(new XmlInterpreter(resource));
We have a Mule application with 6 or seven flows with around 5 components per flow.
Here is the setup.
We send JMS requests to an ActiveMQ Queue. Mule listens to that. Based on content of the message we forward that to corresponding flows.
<flow name="MyAPPAutomationFlow" doc:name="MyAPPAutomationFlow">
<composite-source>
<jms:inbound-endpoint queue="MyAPPOrderQ" connector-ref="Active_MQ_1" doc:name="AMQ1 Inbound Endpoint"/>
<jms:inbound-endpoint queue="MyAPPOrderQ" connector-ref="Active_MQ_2" doc:name="AMQ2 Inbound Endpoint"/>
</composite-source>
<choice doc:name="Choice">
<when expression="payload.getProcessOrder().getOrderType().toString().equals("ANC")" evaluator="groovy">
<processor-chain>
<flow-ref name="ProcessOneFLow" doc:name="Go to ProcessOneFLow"/>
</processor-chain>
</when>
<when....
...........
</choice>
</flow>
<flow name="ProcessOneFLow" doc:name="ProcessOneFLow">
<vm:inbound-endpoint exchange-pattern="one-way" path="ProcessOneFLow" responseTimeout="10000" mimeType="text/xml" doc:name="New Process Order"/>
<component doc:name="Create A">
<spring-object bean="createA"/>
</component>
<component doc:name="Create B">
<spring-object bean="createB"/>
</component>
<component doc:name="Create C">
<spring-object bean="createC"/>
</component>
<component doc:name="Create D">
<spring-object bean="createD"/>
</component>
</flow>
<spring:beans>
<spring:import resource="classpath:spring/service.xml"/>
<spring:bean id="createA" name="createA" class="my.app.components.CreateAService"/>
<spring:bean id="createB" name="createB" class="my.app.components.CreateBService"/>
<spring:bean id="createC" name="createC" class="my.app.components.CreateCService"/>
<spring:bean id="createD" name="createD" class="my.app.components.CreateDService"/>
......
......
</spring:beans>
Now I am not sure how I can write Functional tests with them.
I went through the Functional Testing documentation in Mule website but there they have very simple tests.
Is Functional Testing not supposed to make actual backend updates using DAO or Service layers or is it just an extension of Unit tests where you mock up service layer?
I was of the idea - it can take in a request and use the inmemory Mule server to pass the request-response from one component to another in a flow.
Also kindly note there is no Outbound endpoint for any of our flows as they are mostly Fire and Forget type flows and status updates are managed by the DB updates the components do.
Also why do I need to create separate mule config xml files for tests? If I am not testing the flow xml that will actually be deployed on Live what's the point of this testing? I f I am creating separate xml configs just for tests that somewhat defeats the purpose to me...
Can some expert kindly elucidate a bit more and point to example tests similar to the ones we are using.
PS: the components inside Mule are dependent on external systems like webservices, databases etc. For Functional tests do we need to have those running or are we supposed to mock out those services/Db Access?
Functional testing your Mule application is no different from testing any application that relies on external resources, like databases or JMS brokers, so you need to use the same techniques you would do with a standard application.
Usually this means stubbing the resources out with in-memory implementations, like HSQLDB for databases or a transient ActiveMQ in-memory broker for JMS. For a Mule application, this implies modularizing your configuration so "live" transports are defined in a separate file, which you replace with one that contains the in-memory variants at testing time.
To validate Mule had the correct interaction with the resource, you can either read the resource directly using its Java client (for example JDBC or JMS), which is good if you want to ensure that purely non-Mule clients have no issue reading what Mule has dispatched, or use the MuleClient to read from these resources or create flows that consume these resources and pass messages to the <test:component>.
FYI These different techniques are explained and demonstrated in chapter 12 of Mule in Action, second edition.
https://blog.codecentric.de/en/2015/01/mule-esb-testing-part-13-unit-functional-testing/
https://developer.mulesoft.com/docs/display/current/Functional+Testing
Please refer this links
As you can see, it's an ordinary JUnit test extending FunctionalMunitSuite class.
There are two thing we need to do in our test:
Prepare MuleEvent object as an input to our flow. We can do that by using provided testEvent(Object payload) method.
Execute runFlow(String flowName, MuleEvent event) method specifying flow name to test against and event we just created in the first step.
I have integrated Jenkins to C unit test library and I am parsing the output and generating XML in the schema that the jenkins understands.
while generating the xml output, I just show the gist of the errors reported, and I would like to create a link to where the actual logs are located so that the user can click on teh link in jenkins to view the actual file.
I am unable to add the HTML tags under this XML. The Jenkins turns them into encoded <.. and makes my link useless.
I even try to use . But I am still not able to get it.
Has anyone tried creating a link under jenkins report. Any help is much appreciated.
The following have not worked.
1.<failure> blah.. blah.. (my brief log summary)
ERROR
</failure>
2. <failure> blah.. blah.. (my brief log summary)
<a href=\quot;www.stackoverflow.com\quot;> ERROR </a>
</failure>
3. <failure>
<![CDATA[ ERROR]]>
</failure>
4. <failure>
//CDATA with encoded > <
Thanks in advance
Out testing framework has pluggable reporting modules - a call from a test generates output for all 'registered' modules. Among those are JUnit, HTML, and SQL.
The first one generates JUnit reports that can be immediately processed by Jenkins to decide if the build is stable or not, draw the nice trend graph, etc.
The second one generates the error log in a human-readable form. Over time it has been embellished with all kinds of bells and whistles - different colors for different kinds of status, shrinkable/expandable sections, and so on. A link to this log is displayed among the artifacts for a build.
SQL logger uploads test results into a database for eternal storage and heavy-duty analysis.
In my case I've just put the html address there and it was parsed autmatically in the page...
This works for me:
<failure message="test failure <a href="https://www.w3schools.com/">More info here!</a > " > Assertion failed </failure>
.
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="JUnitXmlReporter" errors="0" tests="0" failures="0" time="0" timestamp="2013-05-24T10:23:58" />
<testsuite name="JUnitXmlReporter.constructor" errors="0" skipped="1" tests="3" failures="1" time="0.006" timestamp="2013-05-24T10:23:58">
<properties>
<property name="java.vendor" value="Sun Microsystems Inc." />
<property name="compiler.debug" value="on" />
<property name="project.jdk.classpath" value="jdk.classpath.1.6" />
</properties>
<testcase classname="JUnitXmlReporter.constructor" name="should default path to an empty string" time="0.006">
<failure message="test failure <a href="https://www.w3schools.com/">More info here!</a > " > Assertion failed </failure>
</testcase>
<testcase classname="JUnitXmlReporter.constructor" name="should default consolidate to true" time="0">
<skipped />
</testcase>
<testcase classname="JUnitXmlReporter.constructor" name="should default useDotNotation to true" time="0" />
</testsuite>
</testsuites>
I am trying to pass a JVM parameter for a variable configured in web.xml as a context-parameter using a -D notation when starting weblogic server. I have already tried this same configuration using Tomcat 7 and it works as expected, but it DOES NOT work in weblogic server 10.3.3. Any clues?
web.xml
<?xml version="1.0" encoding="UTF-8" ?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>testeParWebXml</display-name>
<context-param>
<description>Habilita ou desabilita a configuração de debug do Facelets! Página de debug do Seam.</description>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>${habilitar.debug}</param-value>
</context-param>
<welcome-file-list>
Then when starting the jvm I pass the parameter using:
-Dhabilitar.debug=true
And I built a Servlet to test:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter pw = response.getWriter();
String valorParametro = getServletContext().getInitParameter("facelets.DEVELOPMENT");
pw.write("Param value from web.xml ==>> " + valorParametro);
}
As I mentioned using Tomcat if I change the value to false or true in the -Dhabilitar.debug flag it correctly prints the value in the servlet.
Param value from web.xml ==>> true
In weblogic I get the output like:
Param value from web.xml ==>> ${habilitar.debug}
As noticed weblogic DOES NOT parse the value of the variable set in web.xml.
Is it possible to make this work properly in weblogic 10.3.3?
Looks like there is not a consistent behavior across different containers. IMHO you should not do it that way. I have always used (and have always seen people using) web.xml containing default values (rather than parameterized values) for stuff.
Please see these additional resources (including some not-so-elegant but working approaches to your problem):
Best practices for defining and initializing variables in web.xml and then accessing them from Java code
Referencing Environment Variables in web.xml
http://www.coderanch.com/t/79094/Websphere/environment-variable-referance-Web-xml
First attempt:
I believe that filtering crucial files such as web.xml is not a good practice. However you can use ant or maven to do that.
===
Second attempt:
Ok If identical packages are mandatory, I would prefer changing doPost method. Instead of passing the value to there, it could be passed key and set by System.getProperty method at there. And also setting a default value such as development environment makes sense.