JMeter custom soap sampler to use variables - soap

I use Custom SOAP Sampler in JMeter to send SOAP requests.
<soapenv:Envelope>
<soapenv:Header/>
<soapenv:Body>
<ser:${myvar}Upload>
...
</ser:${myvar}Upload>
</soapenv:Body>
</soapenv:Envelope>
I get following error message during execution:
Caught exception while updating attachments
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source:
at com.sun.xml.internal.messaging.saaj.soap.EnvelopeFactory.createEnvelope(Unknown Source) ~[?:1.8.0_201]
at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelopeFromSource(Unknown Source) ~[?:1.8.0_201]
at com.sun.xml.internal.messaging.saaj.soap.SOAPPartImpl.getEnvelope(Unknown Source) ~[?:1.8.0_201]
at com.jmeter.protocol.soap.sampler.CustomSOAPSampler.updateAttachmentReferences(CustomSOAPSampler.java:431) [CustomSoapSampler-1.3.jar:?]
at com.jmeter.protocol.soap.sampler.CustomSOAPSampler.sample(CustomSOAPSampler.java:259) [CustomSoapSampler-1.3.jar:?]
at org.apache.jmeter.threads.JMeterThread.doSampling(JMeterThread.java:622) [ApacheJMeter_core.jar:5.0 r1840935]
at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:546) [ApacheJMeter_core.jar:5.0 r1840935]
at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:486) [ApacheJMeter_core.jar:5.0 r1840935]
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:253) [ApacheJMeter_core.jar:5.0 r1840935]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_201]
Caused by: net.sf.saxon.trans.XPathException: org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 12; Element type "ser:" must be followed by either attribute specifications, ">" or "/>".
at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:447) ~[Saxon-HE-9.8.0-12.jar:?]
at net.sf.saxon.event.Sender.send(Sender.java:138) ~[Saxon-HE-9.8.0-12.jar:?]
at net.sf.saxon.jaxp.IdentityTransformer.transform(IdentityTransformer.java:383) ~[Saxon-HE-9.8.0-12.jar:?]
at com.sun.xml.internal.messaging.saaj.util.transform.EfficientStreamingTransformer.transform(Unknown Source) ~[?:1.8.0_201]
... 10 more
Caused by: org.xml.sax.SAXParseException: Element type "ser:" must be followed by either attribute specifications, ">" or "/>".

Add a JSR223 PreProcessor and use the MarkupBuilder in Groovy.
For your xml the script would have this form:
import groovy.xml.*
def builder = new StreamingMarkupBuilder()
builder.encoding = 'UTF-8'
def yourCustomElement = vars.get("myvar") + "Upload" // myvar is a saved variable in previous step
def Envelope = builder.bind {
mkp.xmlDeclaration()
namespaces << [soapenv:'http://schemas.xmlsoap.org/soap/envelope/'] // Or mkp.declareNamespace('soapenv':'http://schemas.xmlsoap.org/soap/envelope/')
soapenv.Envelope() {
soapenv.Header(){}
soapenv."${yourCustomElement}"() {
}
}
}
vars.put("myXML", XmlUtil.serialize(Envelope));
log.info("\n" + vars.get("myXML"))
Output:
2019/02/25 17:13:51 INFO - jmeter.modifiers.JSR223PreProcessor:
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:TestUpload/>
</soapenv:Envelope>

Related

cvc-complex-type.2.4.b: The content of element 'persistence' is not complete. One of '{"http://xmlns.jcp.org/xml/ns/persistence"...' is expected

I'm trying to deploy a sample JSF 2.3 Application in development, using Eclipse 2018-09 and Payara 5 but it returns me this error:
2018-10-14T15:19:42.783-0300|Severe: Exception during lifecycle processing java.io.IOException: org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 15; Deployment descriptor file META-INF/persistence.xml in archive [classes]. cvc-complex-type.2.4.b: The content of element 'persistence' is not complete. One of '{"http://xmlns.jcp.org/xml/ns/persistence":persistence-unit}' is expected.
Here is my persistence.xmlfile:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"
version="2.2">
<!-- JPA configuration here. -->
</persistence>
And here is an excerpt of my Console output:
2018-10-14T15:19:38.525-0300|Info: Virtual server server loaded default web module 2018-10-14T15:19:42.779-0300|Severe:enterprise.deployment.backend.invalidDescriptorFailure
2018-10-14T15:19:42.781-0300|Severe: enterprise.deployment.backend.saxParserError
2018-10-14T15:19:42.782-0300|Severe: Exception while deploying the app [project]
2018-10-14T15:19:42.783-0300|Severe: Exception during lifecycle processing
java.io.IOException: org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 15; Deployment descriptor file META-INF/persistence.xml in archive [classes]. cvc-complex-type.2.4.b: The content of element 'persistence' is not complete. One of '{"http://xmlns.jcp.org/xml/ns/persistence":persistence-unit}' is expected.
at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:207)
at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:223)
at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:91)
at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:933)
at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:873)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepare(ApplicationLifecycle.java:383)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:540)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:549)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:545)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:544)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:575)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:567)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:566)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1475)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1300(CommandRunnerImpl.java:111)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1857)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1733)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:564)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:251)
at org.glassfish.grizzly.http.server.StaticHttpHandlerBase.service(StaticHttpHandlerBase.java:166)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:516)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:213)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:182)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:156)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:218)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:524)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:94)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:33)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:114)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 15; Deployment descriptor file META-INF/persistence.xml in archive [classes]. cvc-complex-type.2.4.b: The content of element 'persistence' is not complete. One of '{"http://xmlns.jcp.org/xml/ns/persistence":persistence-unit}' is expected.
at com.sun.enterprise.deployment.io.DeploymentDescriptorFile.read(DeploymentDescriptorFile.java:331)
at com.sun.enterprise.deployment.archivist.ExtensionsArchivist.open(ExtensionsArchivist.java:179)
at com.sun.enterprise.deployment.archivist.PersistenceArchivist.readPersistenceDeploymentDescriptor(PersistenceArchivist.java:158)
at com.sun.enterprise.deployment.archivist.WarPersistenceArchivist.open(WarPersistenceArchivist.java:99)
at com.sun.enterprise.deployment.archivist.Archivist.readRestDeploymentDescriptors(Archivist.java:403)
at com.sun.enterprise.deployment.archivist.Archivist.readDeploymentDescriptors(Archivist.java:394)
at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:269)
at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:278)
at com.sun.enterprise.deployment.archivist.Archivist.open(Archivist.java:239)
at com.sun.enterprise.deployment.archivist.ApplicationFactory.openArchive(ApplicationFactory.java:161)
at org.glassfish.javaee.core.deployment.DolProvider.processDOL(DolProvider.java:199)
... 42 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 15; cvc-complex-type.2.4.b: The content of element 'persistence' is not complete. One of '{"http://xmlns.jcp.org/xml/ns/persistence":persistence-unit}' is expected.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:453)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3231)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.elementLocallyValidComplexType(XMLSchemaValidator.java:3207)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.elementLocallyValidType(XMLSchemaValidator.java:3154)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processElementContent(XMLSchemaValidator.java:3056)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleEndElement(XMLSchemaValidator.java:2135)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:854)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2967)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
at com.sun.enterprise.deployment.io.DeploymentDescriptorFile.read(DeploymentDescriptorFile.java:321)
... 52 more
How can I fix this?
Thanks.
You need to provide persistence-unit information to persistence.xml file
Here is an example: https://www.thoughts-on-java.org/jpa-persistence-xml/
Hope it help!

Huge SOAP response using Spring cxf being truncated

I was trying to make a SOAP call with the following codes:
MessageContentsList response = producerTemplate
.requestBodyAndHeaders(endpoint, request, headers, MessageContentsList.class);
The codes were returning truncated SOAP response. The logs were showing:
at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1772) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:695) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:515) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:511) ~[camel-core-2.19.0.jar:2.19.0]
at org.apache.camel.impl.DefaultProducerTemplate.requestBodyAndHeaders(DefaultProducerTemplate.java:362) ~[camel-core-2.19.0.jar:2.19.0]
at com.sia.csl.schema.cmservicingpax.services.getpaxrecord.GetPaxRecordService.getVendorResponse(GetPaxRecordService.java:94) [classes/:?]
Caused by: org.apache.cxf.interceptor.Fault: Unmarshalling Error: Unexpected end of input block; expected an identifier
at [row,col {unknown-source}]: [1,878852]
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:908) ~[cxf-rt-databinding-jaxb-3.1.11.jar:3.1.11]
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:714) ~[cxf-rt-databinding-jaxb-3.1.11.jar:3.1.11]
at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:179) ~[cxf-rt-databinding-jaxb-3.1.11.jar:3.1.11]
at org.apache.cxf.wsdl.interceptors.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:109) ~[cxf-rt-wsdl-3.1.11.jar:3.1.11]
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) ~[cxf-core-3.1.11.jar:3.1.11]
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:780) ~[cxf-core-3.1.11.jar:3.1.11]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1680) ~[cxf-rt-transports-http-3.1.11.jar:3.1.11]
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:1176) ~[cxf-rt-transports-http-3.1.11.jar:3.1.11]
at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$3.run(AutomaticWorkQueueImpl.java:428) ~[cxf-core-3.1.11.jar:3.1.11]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_91]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_91]
at org.apache.cxf.workqueue.AutomaticWorkQueueImpl$AWQThreadFactory$1.run(AutomaticWorkQueueImpl.java:353) ~[cxf-core-3.1.11.jar:3.1.11]

SOAP Response error -must not contain the < character

Getting error as
java.lang.RuntimeException: Exception in preInvoke : javax.xml.soap.SOAPException: org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 47; The value of attribute "arasAML" associated with an element type "tcin:applyAMLInTCInputData" must not contain the '<' character.
I am testing my Webservice in SOAP UI , below is the SOAP request.
<soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/soap/envelope/"; xmlns:tcin="de4.com/Schemas/TCIntgn/2013-05/TCIntegration">; <soapenv:Header/> <soapenv:Body> <tcin:ApplyAMLInTCInput> <tcin:applyAMLInTCInputData arasAML="<XML><REVISIONS><ITEM_REVISION><itemNo>000147</itemNo><type>PDF,DirectM‌​odel,MSPowerPointX</type></ITEM_REVISION></REVISIONS></XML>" message="DownloadDatasetFile" > </tcin:applyAMLInTCInputData> </tcin:ApplyAMLInTCInput> </soapenv:Body> </soapenv:Envelope>
getting SOAP response as below
<faultstring>java.lang.RuntimeException: Exception in preInvoke : javax.xml.soap.SOAPException: org.xml.sax.SAXParseException; lineNumber: 6; columnNumber: 47; The value of attribute "arasAML" associated with an element type "tcin:applyAMLInTCInputData" must not contain the '<' character.</faultstring>
You need to URL encode your data or put it into a CDATA block if it's going to contain special characters like < and >.

Caused by: ognl.NoSuchPropertyException: org.springframework.webflow.engine.impl.RequestControlContextImpl

I'm kind of new to Spring Web Flow, My application uses Spring web flow version 2.0 and I've just started trying to implement some unit testing into my application(had no previous unit testing). This is my simple flow.
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd"
abstract="false" start-state="isDynamicMenu" >
<action-state id="isDynamicMenu">
<evaluate expression="menuMakerTestAction.isDynamicMenu" result="res"/>
<transition on="yes" to="setDynamicMenu"/>
<transition on="no" to="setCommonMenu"/>
</action-state>
<view-state id="setDynamicMenu" />
<view-state id="setCommonMenu" />
</flow>
and this is the test code:
public class FlowTest1 extends AbstractXmlFlowExecutionTests {
private MenuMakerTestAction menuMakerTestAction;
protected void setUp() {
menuMakerTestAction = mock(MenuMakerTestAction.class);
}
#Override
protected FlowDefinitionResource getResource(
FlowDefinitionResourceFactory resourceFactory) {
FlowDefinitionResource resource = resourceFactory
.createResource("classpath:spring-webflow/config/menuMakerTest.xml");
Assert.notNull(resource);
return resource;
}
#Override
protected void configureFlowBuilderContext(
MockFlowBuilderContext builderContext) {
builderContext.registerBean("menuMakerTestAction", menuMakerTestAction);
}
#Test
public void testFlow() throws GlobalException {
MutableAttributeMap attrMap = new LocalAttributeMap();
attrMap.put("res", "no");
MockExternalContext context = new MockExternalContext();
startFlow(attrMap, context);
assertCurrentStateEquals("setCommonMenu");
}
}
And this is the error I am getting:
org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing [AnnotatedAction#12f1bf0 targetAction = [EvaluateAction#1797795 expression = menuMakerTestAction.isDynamicMenu, resultExposer = [ActionResultExposer#19a0203 result = res, resultType = [null]]], attributes = map[[empty]]] in state 'isDynamicMenu' of flow 'menuMakerTest' -- action execution attributes were 'map[[empty]]'
at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:60)
at org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:101)
at org.springframework.webflow.engine.State.enter(State.java:194)
at org.springframework.webflow.engine.Flow.start(Flow.java:535)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:350)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.start(FlowExecutionImpl.java:221)
at org.springframework.webflow.test.execution.AbstractFlowExecutionTests.startFlow(AbstractFlowExecutionTests.java:123)
at ivr.latam.icg.view.menu.FlowTest1.testFlow(FlowTest1.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:176)
at junit.framework.TestCase.runBare(TestCase.java:141)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:129)
at junit.framework.TestSuite.runTest(TestSuite.java:255)
at junit.framework.TestSuite.run(TestSuite.java:250)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.springframework.binding.expression.PropertyNotFoundException: Property 'menuMakerTestAction.isDynamicMenu' not found on context of class [org.springframework.webflow.engine.impl.RequestControlContextImpl]
at org.springframework.binding.expression.ognl.OgnlExpression.getValue(OgnlExpression.java:87)
at org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:77)
at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)
at org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145)
at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51)
... 26 more
Caused by: ognl.NoSuchPropertyException: com.view.action.config.MenuMakerTestAction$$EnhancerByMockitoWithCGLIB$$9f5b5273.isDynamicMenu
at ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:122)
at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1657)
at ognl.ASTProperty.getValueBody(ASTProperty.java:92)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
at ognl.SimpleNode.getValue(SimpleNode.java:210)
at ognl.ASTChain.getValueBody(ASTChain.java:109)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
at ognl.SimpleNode.getValue(SimpleNode.java:210)
at ognl.Ognl.getValue(Ognl.java:333)
at org.springframework.binding.expression.ognl.OgnlExpression.getValue(OgnlExpression.java:85)
... 30 more
Its my first time posting in a forum. I can't get past this. The method isDynamicMenu receives nothing at all, and returns just a string. Any help would really be appreciated.
Thanks!
SWF will not implicitly find Your "menuMakerTestAction" bean or any Spring bean registered to the application context. However, SWF will automatically register service classes (annotated with #Service,#Component) inside of SWF. (note: you can also call static methods from SWF)
So you must either:
A. explicitly initialize the menuMakerTestAction inside the flow definition
B. use a service method/static call to lookup the menuMakerTestAction bean
so if you have a service called myService then you can use myService.getMyMenuMakerTestAction() inside the evaluate expression in the flow.
or
Call a static method like such Printing log from flow.xml
also make sure:
"isDynamicMenu" is actually the attribute name on the class (and not the 'get' method name)

Consuming a JAX-WS in a Mule ESB flow

I want to consume a JAX-WS service method. the methode is named find and accept a String as argument.
this the Mule flow :
<flow name="InvokeAWebServiceFlow1" doc:name="InvokeAWebServiceFlow1">
<file:inbound-endpoint path="C:\MuleStudio\SandBox\input" pollingFrequency="3000" responseTimeout="10000" doc:name="File"/>
<file:file-to-string-transformer encoding="UTF-8" mimeType="text/xml" doc:name="File to String"/>
<cxf:jaxws-client port="douaneWSPort" serviceClass="WSDL.DouaneWS" doc:name="SOAP" enableMuleSoapHeaders="true" operation="find"/>
<echo-component doc:name="Echo"/>
<file:outbound-endpoint path="C:\MuleStudio\SandBox\output" outputPattern="#[function:datestamp:dd-MM-yy]_#[function:systime].xml" responseTimeout="10000" doc:name="File"/>
</flow>
I put a argument into a file, in this exampl the argument is "ctr1" after i put the file into the inbound endpoint, after that the file is transformed into a String and goes to the JAX-WS client, finally the respponse is written into an output file.
when I run the flow I get as an output :
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:find xmlns:ns2="http://douane.ws/">
<id>ctr1</id>
</ns2:find>
</soap:Body>
</soap:Envelope>
the output is the SOAP the request instead of the expected SOAP Response, that should be somthing like:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:findResponse xmlns:ns2="http://douane.ws/">
<return>
<quality>medium</quality>
<price>150</price>
<idProd>ctr1</idProd>
</return>
</ns2:findResponse>
</S:Body>
</S:Envelope
>
.
The error generate is
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Started app 'invokeawebservice' +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
INFO 2013-05-14 11:13:15,024 [[invokeawebservice].connector.file.mule.default.receiver.01] org.mule.transport.file.FileMessageReceiver: Lock obtained on file: C:\MuleStudio\SandBox\input\input.txt
INFO 2013-05-14 11:13:15,155 [[invokeawebservice].InvokeAWebServiceFlow1.stage1.02] org.mule.component.simple.LogComponent:
********************************************************************************
* Message received in service: InvokeAWebServiceFlow1. Content is: *
* '<soap:Envelope *
* xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:find *
* xmlns:ns2...[100 of 173]' *
********************************************************************************
INFO 2013-05-14 11:13:15,184 [[invokeawebservice].connector.file.mule.default.dispatcher.01] org.mule.lifecycle.AbstractLifecycleManager: Initialising: 'connector.file.mule.default.dispatcher.2917880'. Object is: FileMessageDispatcher
INFO 2013-05-14 11:13:15,184 [[invokeawebservice].connector.file.mule.default.dispatcher.01] org.mule.lifecycle.AbstractLifecycleManager: Starting: 'connector.file.mule.default.dispatcher.2917880'. Object is: FileMessageDispatcher
INFO 2013-05-14 11:13:15,200 [[invokeawebservice].connector.file.mule.default.dispatcher.01] org.mule.transport.file.FileConnector: Writing file to: C:\MuleStudio\SandBox\output\14-05-13_1368522795199.xml
WARN 2013-05-14 11:13:15,261 [[invokeawebservice].InvokeAWebServiceFlow1.stage1.02] org.apache.cxf.phase.PhaseInterceptorChain: Interceptor for {http://douane.ws/}DouaneWSService#{http://douane.ws/}find has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unexpected wrapper element {http://douane.ws/}find found. Expected {http://douane.ws/}findResponse.
at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:106)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:799)
at org.mule.module.cxf.transport.MuleUniversalConduit.dispatchMuleMessage(MuleUniversalConduit.java:280)
at org.mule.module.cxf.transport.MuleUniversalConduit$2.handleMessage(MuleUniversalConduit.java:194)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:533)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:375)
at org.mule.module.cxf.CxfOutboundMessageProcessor.doSendWithClient(CxfOutboundMessageProcessor.java:235)
at org.mule.module.cxf.CxfOutboundMessageProcessor.process(CxfOutboundMessageProcessor.java:125)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorNotificationExecutionInterceptor.execute(MessageProcessorNotificationExecutionInterceptor.java:61)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:95)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:70)
at org.mule.execution.ExceptionToMessagingExceptionExecutionInterceptor.execute(ExceptionToMessagingExceptionExecutionInterceptor.java:27)
at org.mule.execution.MessageProcessorExecutionTemplate.execute(MessageProcessorExecutionTemplate.java:47)
at org.mule.processor.AbstractInterceptingMessageProcessorBase.processNext(AbstractInterceptingMessageProcessorBase.java:106)
at org.mule.interceptor.AbstractEnvelopeInterceptor.process(AbstractEnvelopeInterceptor.java:55)
at org.mule.processor.AsyncInterceptingMessageProcessor.processNextTimed(AsyncInterceptingMessageProcessor.java:122)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:192)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker$1.process(AsyncInterceptingMessageProcessor.java:185)
at org.mule.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:20)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:34)
at org.mule.execution.HandleExceptionInterceptor.execute(HandleExceptionInterceptor.java:18)
at org.mule.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:58)
at org.mule.execution.ResolvePreviousTransactionInterceptor.execute(ResolvePreviousTransactionInterceptor.java:48)
at org.mule.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:54)
at org.mule.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:44)
at org.mule.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:44)
at org.mule.execution.ExternalTransactionInterceptor.execute(ExternalTransactionInterceptor.java:52)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:32)
at org.mule.execution.RethrowExceptionInterceptor.execute(RethrowExceptionInterceptor.java:17)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:113)
at org.mule.execution.TransactionalErrorHandlingExecutionTemplate.execute(TransactionalErrorHandlingExecutionTemplate.java:34)
at org.mule.processor.AsyncInterceptingMessageProcessor$AsyncMessageProcessorWorker.doRun(AsyncInterceptingMessageProcessor.java:184)
at org.mule.work.AbstractMuleEventWork.run(AbstractMuleEventWork.java:43)
at org.mule.work.WorkerContext.run(WorkerContext.java:311)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
ERROR 2013-05-14 11:13:15,271 [[invokeawebservice].InvokeAWebServiceFlow1.stage1.02] org.mule.exception.DefaultMessagingExceptionStrategy:
********************************************************************************
Message : Unexpected wrapper element {http://douane.ws/}find found. Expected {http://douane.ws/}findResponse.. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: String
Code : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. Unexpected wrapper element {http://douane.ws/}find found. Expected {http://douane.ws/}findResponse. (org.apache.cxf.interceptor.Fault)
org.apache.cxf.interceptor.DocLiteralInInterceptor:106 (null)
2. Unexpected wrapper element {http://douane.ws/}find found. Expected {http://douane.ws/}findResponse.. Failed to route event via endpoint: org.mule.module.cxf.CxfOutboundMessageProcessor. Message payload is of type: String (org.mule.api.transport.DispatchException)
org.mule.module.cxf.CxfOutboundMessageProcessor:144 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transport/DispatchException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
org.apache.cxf.interceptor.Fault: Unexpected wrapper element {http://douane.ws/}find found. Expected {http://douane.ws/}findResponse.
at org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:106)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:799)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
Any help ??
If the webservice you want to consume is hosted, let's say at http://domain.com/ws , than your configuration should look like this:
<flow name="InvokeAWebServiceFlow1" doc:name="InvokeAWebServiceFlow1">
<file:inbound-endpoint path="C:\MuleStudio\SandBox\input" pollingFrequency="3000" responseTimeout="10000" doc:name="File"/>
<file:file-to-string-transformer encoding="UTF-8" mimeType="text/xml" doc:name="File to String"/>
<cxf:jaxws-client port="douaneWSPort" serviceClass="WSDL.DouaneWS" doc:name="SOAP" enableMuleSoapHeaders="true" operation="find"/>
<http:outbound-endpoint address="http://domain.com/ws" />
<echo-component doc:name="Echo"/>
<file:outbound-endpoint path="C:\MuleStudio\SandBox\output" outputPattern="#[function:datestamp:dd-MM-yy]_#[function:systime].xml" responseTimeout="10000" doc:name="File"/>
</flow>
You can find more informations on the topic here