Mule- error: cvc-complex-type.2.4.a: Invalid content was found starting with element 'magento:config' - maven

I am trying to run in Anypoint Studio a project with maven using magento connector ver 2.2.0.
This is my project's xml file:
<mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:magento="http://www.mulesoft.org/schema/mule/magento" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/magento http://www.mulesoft.org/schema/mule/magento/current/mule-magento.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<magento:config name="Magento" username="test" password="test$" address="http://127.0.0.1:8000.com/api/v2_soap/" doc:name="Magento"/>
<flow name="magentoFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/magento" doc:name="HTTP"/>
<magento:get-product config-ref="Magento" doc:name="Magento" productId="1"/>
<json:object-to-json-transformer doc:name="Object to JSON"/>
</flow>
</mule>
and this is the error:
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'magento:config'. One of '{"http://www.springframework.org/schema/beans":beans, "http://www.springframework.org/schema/beans":bean, "http://www.springframework.org/schema/context":property-placeholder, "http://www.springframework.org/schema/beans":ref, "http://www.mulesoft.org/schema/mule/core":global-property, "http://www.mulesoft.org/schema/mule/core":configuration, "http://www.mulesoft.org/schema/mule/core":notifications, "http://www.mulesoft.org/schema/mule/core":abstract-extension, "http://www.mulesoft.org/schema/mule/core":abstract-shared-extension, "http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-extension, "http://www.mulesoft.org/schema/mule/core":abstract-agent, "http://www.mulesoft.org/schema/mule/core":abstract-security-manager, "http://www.mulesoft.org/schema/mule/core":abstract-transaction-manager, "http://www.mulesoft.org/schema/mule/core":abstract-shared-transaction-manager, "http://www.mulesoft.org/schema/mule/core":abstract-connector, "http://www.mulesoft.org/schema/mule/core":abstract-shared-connector, "http://www.mulesoft.org/schema/mule/core":abstract-global-endpoint, "http://www.mulesoft.org/schema/mule/core":abstract-exception-strategy, "http://www.mulesoft.org/schema/mule/core":abstract-flow-construct, "http://www.mulesoft.org/schema/mule/core":flow, "http://www.mulesoft.org/schema/mule/core":sub-flow, "http://www.mulesoft.org/schema/mule/core":abstract-model, "http://www.mulesoft.org/schema/mule/core":abstract-interceptor-stack, "http://www.mulesoft.org/schema/mule/core":abstract-filter, "http://www.mulesoft.org/schema/mule/core":abstract-transformer, "http://www.mulesoft.org/schema/mule/core":processor-chain, "http://www.mulesoft.org/schema/mule/core":custom-processor, "http://www.mulesoft.org/schema/mule/core":abstract-empty-processor, "http://www.mulesoft.org/schema/mule/core":invoke, "http://www.mulesoft.org/schema/mule/core":set-payload, "http://www.mulesoft.org/schema/mule/core":abstract-global-intercepting-message-processor, "http://www.mulesoft.org/schema/mule/core":custom-queue-store, "http://www.mulesoft.org/schema/mule/core":abstract-processing-strategy}' is expected.
What's missing?

Does the following work?
<?xml version="1.0" encoding="UTF-8"?>
<mule
xmlns:json="http://www.mulesoft.org/schema/mule/json"
xmlns:magento="http://www.mulesoft.org/schema/mule/magento"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.7/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.7/mule-http.xsd
http://www.mulesoft.org/schema/mule/magento http://www.mulesoft.org/schema/mule/magento/1.2/mule-magento.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/3.7/mule-json.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<magento:config name="Magento" username="test" password="test$" address="http://127.0.0.1:8000.com/api/v2_soap/" doc:name="Magento"/>
<flow name="magentoFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/magento" doc:name="HTTP"/>
<magento:get-product config-ref="Magento" doc:name="Magento" productId="1"/>
<json:object-to-json-transformer doc:name="Object to JSON"/>
</flow>
</mule>
Changes from your snippet:
Added the XML declaration line
Changed the location of the XSDs to specific versions instead of 'current'.
(Am not sure if this is needed since the XSDs might be coming from jars on the classpath)

Related

Mulesoft AMQP connector

Receving error Message : "org.mule.runtime.api.exception.MuleRuntimeException - Could not read from file store, while reading payload as Xml.
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:amqp="http://www.mulesoft.org/schema/mule/amqp"
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/amqp http://www.mulesoft.org/schema/mule/amqp/current/mule-amqp.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<amqp:config name="AMQP_Config" doc:name="AMQP Config" doc:id="e0e4ca51-72e7-4d3b-bf01-705aacee16f0" >
<amqp:connection host="orangutan.rmq.cloudamqp.com" port="5672" virtualHost="xxxx" username="xxxx" password="xxxx" />
</amqp:config>
<flow name="artvanFlow" doc:id="59d15f19-3a12-491a-90a0-b2c980dbb05a" >
<amqp:listener doc:name="Listener" doc:id="ea9cb6d6-ccad-4a7f-8925-5879b561910e" config-ref="AMQP_Config" queueName="PIMQueue" outputMimeType="application/xml"/>
<ee:transform doc:name="Transform Message" doc:id="cddf8b22-91af-46b4-a8d6-c4237de75307" >
<ee:message >
<ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
{
INVMSTP: {
IMDEL: payload.Root.STG_SKU.Activity_Code default ""
}
}]]></ee:set-payload>
</ee:message>
</ee:transform>
<logger level="INFO" doc:name="Logger" doc:id="a3411653-aff7-4363-8d24-6c10334d816f" message="#[payload]"/>
</flow>
</mule>
Apple to resolve the issue. There is no issue with the mule code. Input XML has
<?xml version="1.0" **encoding="WINDOWS-1251"** standalone="yes"?>
if I change to
<?xml version="1.0" **encoding="utf-8"** standalone="yes"?>
Things are fine.

Mule 3.6.1 HTTPS ountbound GET/POST

Hi I am trying to use(Mule 3.6.1) https outbound endpoint in order to get a response. With this conditions I couldnt make any response. But however if I use
Mule 3.4.0 depricated http outbound(which is commented in below xml file) I can get a response. Is there any possible way to get the response from "https://httpbin.org/ip" by using Mule 3.6.1 https outbound endpoint.
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:https="http://www.mulesoft.org/schema/mule/https"
xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/https http://www.mulesoft.org/schema/mule/https/current/mule-https.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" basePath="miraj" doc:name="HTTP Listener Configuration"/>
<http:request-config name="HTTP_Request_Configuration" protocol="HTTPS" host="httpbin.org" port="443" doc:name="HTTP Request Configuration"/>
<!-- <https:connector name="HTTPS_Connector" cookieSpec="netscape" validateConnections="false" sendBufferSize="0" receiveBufferSize="0" receiveBacklog="0" sendTcpNoDelay="true" clientSoTimeout="40000" serverSoTimeout="40000" socketSoLinger="0" doc:name="HTTP\HTTPS">
</https:connector> -->
<flow name="testmulehttpsFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="hamid" doc:name="HTTP"/>
<logger message="Hiiiii" level="INFO" doc:name="Logger"/>
<http:request config-ref="HTTP_Request_Configuration" path="ip" method="GET" doc:name="HTTPS"/>
<!--<https:outbound-endpoint exchange-pattern="request-response" method="GET" connector-ref="HTTPS_Connector" address="https://httpbin.org/ip" doc:name="HTTPS" contentType="application/xml">
</https:outbound-endpoint> -->
</flow>
</mule>
I found the solution.
We need to remove a jar called async-http-client from you CE Runtime located at /Eclipse/plugins/org.mule.tooling.server.3.8.1_6.0.0.201612271237/mule/lib/user folder.
Restart mule and it will work fine.
It works fine, when I changed http request config to HTTP instead of HTTPS
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" basePath="miraj" doc:name="HTTP Listener Configuration"/>
<http:request-config name="HTTP_Request_Configuration" host="httpbin.org" port="80" doc:name="HTTP Request Configuration"/>
<flow name="testmulehttpsFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="hamid" doc:name="HTTP"/>
<logger message="Hiiiii" level="INFO" doc:name="Logger"/>
<http:request config-ref="HTTP_Request_Configuration" path="ip" method="GET" doc:name="HTTPS"/>
</flow>
For HTTPS try to add TLS configuration to request config.
Hope this helps.

cvc-complex-type.2.4.a: Invalid content was found starting with element 'dw:transform-message'

I am trying to deploy a mule app on mule standalone 3.7.0 EE, but
when running I occur this error: cvc-complex-type.2.4.a: Invalid content was found starting with element 'dw:transform-message'
This is my flow:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:magento="http://www.mulesoft.org/schema/mule/magento" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/magento http://www.mulesoft.org/schema/mule/magento/current/mule-magento.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<magento:config name="Magento" username="test" password="test" address="http://127.0.0.1:8000/api/v2_soap/" doc:name="Magento"/>
<flow name="proFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="test" doc:name="HTTP"/>
<magento:get-order config-ref="Magento" orderId="100000000" doc:name="Magento"/>
<dw:transform-message doc:name="Transform Message">
<dw:set-payload><![CDATA[%dw 1.0
%output application/json
---
{
orderId: payload.increment_id
}]]></dw:set-payload>
</dw:transform-message>
<set-payload value="#[payload]" doc:name="Set Payload"/>
</flow>
</mule>
also, I have this dependency in pom.xml:
<dependency>
<groupId>com.mulesoft.weave</groupId>
<artifactId>mule-plugin-weave_2.11</artifactId>
<version>${mule.version}</version>
<scope>provided</scope>
</dependency>
Looks like you are missing this schema locations:
http://www.mulesoft.org/schema/mule/ee/dw
http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
Try to add it in xsi:schemaLocation list.
Hope this helps
Regards

Durable flag on my topic consumer doesn't work?

trying to implement the Durable feature on a Topic consumer.
Placed a name to the jms consumer and also clientID. (Obviously added the durable="true")
Now as far as i've read. The Topic will register the consumer as "durable" when it gets running for the first time.
So basically i did this, deployed the producer and consumer. It gets registered as a durable consumer. Publish a message to the topic, the consumer gets it. Now i undeploy the consumer and publish another message the consumer should be receive whenever gets up. When I deploy the consumer again, i get the common temp-topic://XXXXXXXXXXXX destination doesn't exist.
Why is this happening? Shouldn't i be getting the "lost" message?
This is my current jms activemq connector configuration for the publisher:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:jbossts="http://www.mulesoft.org/schema/mule/jbossts" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" version="CE-3.3.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/jbossts http://www.mulesoft.org/schema/mule/jbossts/current/mule-jbossts.xsd ">
<jms:activemq-connector name="Active_MQ" specification="1.1" brokerURL="tcp://localhost:61616" validateConnections="false" doc:name="Active MQ" maxRedelivery="1" persistentDelivery="true" durable="true" clientId="RoutingTopic">
<reconnect count="5" />
</jms:activemq-connector>
<message-properties-transformer name="MessagePropertiesTransformer" doc:name="Message Properties" overwrite="true">
<add-message-property key="BACKEND_SUBSCRIBER" value="#[flowVars['backend']]"/>
<add-message-property key="MULE_EVENT_TIMEOUT" value="60000"/>
</message-properties-transformer>
<flow name="jmsFlow1" doc:name="jmsFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="jms" doc:name="HTTP"/>
<set-variable variableName="#['id']" value="#[message.inboundProperties['id']]" doc:name="set dynamic id"/>
<set-variable variableName="#['backend']" value="#[message.inboundProperties['backend']]" doc:name="setting backend"/>
<set-payload value="#['This is a message test for id '] #[flowVars['id']]" doc:name="set random string as payload"/>
<choice doc:name="Choice">
<when expression="#[true]">
<processor-chain>
<jms:outbound-endpoint exchange-pattern="request-response" connector-ref="Active_MQ" doc:name="JMS Topic Requestor" transformer-refs="MessagePropertiesTransformer" topic="ESB.Topic">
</jms:outbound-endpoint>
</processor-chain>
</when>
<otherwise>
<processor-chain>
<logger message="This is the default case" level="INFO" doc:name="Logger"/>
</processor-chain>
</otherwise>
</choice>
</flow>
</mule>
This is one of the consumers, i got 2, but both are basically the same thing
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:jbossts="http://www.mulesoft.org/schema/mule/jbossts" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" version="CE-3.3.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/jbossts http://www.mulesoft.org/schema/mule/jbossts/current/mule-jbossts.xsd ">
<jms:activemq-connector name="UpCity_Connector" specification="1.1" brokerURL="tcp://localhost:61616" validateConnections="false" maxRedelivery="0" doc:name="Active MQ" clientId="RandomName" durable="true"/>
<flow name="jmsAdapterConsumerFlow1" doc:name="fmsAdapterConsumerFlow1">
<jms:inbound-endpoint exchange-pattern="request-response" connector-ref="UpCity_Connector" doc:name="JMS Replier Consumer" topic="ESB.Topic">
<jms:selector expression="BACKEND_SUBSCRIBER='randombackend'"/>
</jms:inbound-endpoint>
<set-payload value="#[payload + ' returned from a random backend']" doc:name="Add string to payload"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
</flow>
</mule>
Thanks.
Durable Messaging is a little tricky in JMS, as your config/code will have to meet several criteria to get this to work correctly:
enable persistence in your broker's config (in ActiveMQ this is either done in the connection string as David posted, or in your configuration xml
create a durable subscriber (ActiveMQ API)
I'm not sure that mule creates durable subscribers. However, you can check that in ActiveMQ's web console. There you can get a list of the current durable subscriptions.

Insertinto database with xpath query and multiple xpath expressions

I am new to xpath and I'm trying to use multiple expressions with the "|" Separator, however when I have the configuration xml set to:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" version="EE-3.4.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">
<jdbc-ee:mssql-data-source name="MS_SQL_Data_Source" user="username" password="passcode" url="jdbc:sqlserver://DOMAIN\SQLEXPRESS:65183;databaseName=MULETEST" transactionIsolation="UNSPECIFIED" doc:name="MS SQL Data Source"/>
<jdbc-ee:connector name="Database" dataSource-ref="MS_SQL_Data_Source" validateConnections="true" queryTimeout="-1" pollingFrequency="0" doc:name="Database">
<jdbc-ee:query key="InsertRecord" value="INSERT INTO databaseupdate(BuyerOrderNumber, OrderIssueDate) VALUES (#[xpath('//BuyerOrderNumber').text], #[xpath('//OrderIssueDate').text])"/>
</jdbc-ee:connector>
<flow name="Write_xml_file_to_databaseFlow1" doc:name="Write_xml_file_to_databaseFlow1">
<file:inbound-endpoint path="C:\mule" responseTimeout="10000" doc:name="File"/>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
<splitter evaluator="xpath" expression="/Order/OrderHeader/OrderNumber|/Order/OrderHeader" doc:name="Splitter"/>
<jdbc-ee:outbound-endpoint exchange-pattern="one-way" queryKey="InsertRecord" queryTimeout="-1" connector-ref="Database" doc:name="Destination"/>
</flow>
</mule>
I get a NULLPointerException. My confusion lies in xpath queries, how do I hardcode multiple expression paths, and associate that with the xpath query using the insert?
Thanks.

Resources