Hi all I'm new in Mule so please go easy on me. First of all I will show you example on SOAP UI:
Here is WSDL FILE: wsdl file
Its pretty easy. I want to make exacly the same mule flow (no input data etc - payload set in code). The problem is that I simple even can't start. I read tutorial:
http://www.mulesoft.org/documentation/display/current/XML-only+SOAP+Web+Service+Example
But still I can't do dataMappings like here. Any idea what I'm doing wrong my whole flow isn't big ... now its look like this:
<flow doc:name="PostRequest" name="PostRequest">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="getPostRequest" doc:name="HTTP" />
<cxf:jaxws-client operation="PostRequest" doc:name="SOAP"
enableMuleSoapHeaders="true" clientClass="pl.execon.integration.axpppk.ws.client.XISGateway"
port="XISGatewaySoap" />
<http:outbound-endpoint address="http://localhost:8889/Service/XISGateway.asmx" />
<object-to-string-transformer doc:name="Object to String" />
</flow>
I want to use PostRequest ... Any advices ? Tutorials that can help ? Problem is that I need to make this envelope modification:
<soap:Body>
<m:PostRequest>
<m:_requestCode>Test</m:_requestCode>
<m:GetGasCustTable>
<m:XMLDocumentTime>2014-07-21T12:24:50</m:XMLDocumentTime>
<m:CustAccount>00043280</m:CustAccount>
</m:GetGasCustTable>
</m:PostRequest>
</soap:Body>
And I Simply don't know how
If want to use post and map a webservice just use pattern this is a working code for post method:
<pattern:web-service-proxy name="webserviseName">
<inbound-endpoint address="http://localhost:8081/localUWant" exchange-pattern="request-response"/>
<outbound-endpoint address="http://localhost:8889/Service/XISGateway.asmx" exchange-pattern="request-response"/>
</pattern:web-service-proxy>
As simple as that.
this is the documentation: http://www.mulesoft.org/documentation/display/current/Using+Mule+Configuration+Patterns
Related
I've got a problem with using method with parameters in Camel XML DSL.
What I've done is something like this:
I've created below bean before my camelContext
<bean id="properties" class="java.util.Properties"/>
The thing I would like to do is using method 'put' from HashTable, which extends Properties.
When I call a method without parameter it's working perfectly fine.
<method ref="properties" method="NAME OF METHOD THAT HAS NO PARAMETERS">
or
<bean ref="properties" method="SAME AS ABOVE"/>
Method that I'm trying to use:
public synchronized V put(K key, V value)
But when I'm trying to use something like the code below I would like to assign some parameters
I've tried a lot of possibilities, maybe it's impossible or my knowledge of syntax is poor:
<method ref="properties" method="put" argument="key_el" arugment="val_el"/>
<method ref="properties" method="put" value="key_el" value="val_el"/>
<method ref="properties" method="put?keyEl&valEl"/>
<method ref="properties" method="put">
<argument id="key" value="someKey" type="java.lang.String"/>
<argument id="value" value="someValue" type="java.lang.String"/>
</method>
There's plenty more that I've tired, some of them are just not worth of showing. I read from people apache and camel documentation, that there's possibility to make it somehow but there was no example of doing that in XML DSL.
Thanks in advance for any hints and help.
You can call beans method with arguments using method="put('key', 'value')". You can also use simple syntax there if you need values from the Exchange like body, headers or exchange properties `method="put('bodyValue', ${body})"``
This approach also works with simple language. Say if you have object stored in to message header you can call it's methods using ${headers.helloBean.hello('Tim')}
<bean id="ExampleProperties" class="java.util.Properties" />
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route id="testRoute">
<from uri="direct:testRoute" />
<bean ref="ExampleProperties" method="put('bodyValue', ${body})" />
<setBody>
<simple>${bean:ExampleProperties?method=get('bodyValue')}</simple>
</setBody>
<log message="Body value: ${body}" />
</route>
</camelContext>
Be careful when storing values to beans instead of using body, headers or exchange properties as beans persist between exchanges.
My xml has to be like this:
<d4p1:Criteria>
<d4p1:DestinationTelcoCenter i:nil="true" />
</d4p1:Criteria>
<d4p1:MyAccountName>m_sobati</d4p1:MyAccountName>
<d4p1:PagingInfo>
<d4p1:PageNo>1</d4p1:PageNo>
<d4p1:PageSize>10</d4p1:PageSize>
</d4p1:PagingInfo>
<d4p1:SortingInfo>
<d4p1:Direction>ASC</d4p1:Direction>
<d4p1:FieldName i:nil="true" />
</d4p1:SortingInfo>
I have to create this XML. I try do it with Ksoap2. But it doesn't work. How can I handle this?
I have downloaded the Ms Dynamics integration packages for Java (not the SDK). I am able to create, update and delete all entities. But now, I am trying to merge two contacts in Ms Dynamics Crm using Java. Research has led me nowhere. Classes like MergeRequest are there for JavaScript, but I am not sure how to go about with Java. I have created the two contacts, and have retrieved them.
I believe you use SOAP for CRUD operations. Here is Soap for Merging of records:
POST https://pactest.api.crm.dynamics.com/XRMServices/2011/Organization.svc/web
Content-Type: text/xml; charset=utf-8
SOAPAction: http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<Execute xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<request i:type="b:MergeRequest" xmlns:a="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:b="http://schemas.microsoft.com/crm/2011/Contracts">
<a:Parameters xmlns:c="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<a:KeyValuePairOfstringanyType>
<c:key>Target</c:key>
<c:value i:type="a:EntityReference">
<a:Id>00000000-0000-0000-0000-000000000000</a:Id>
<a:LogicalName>account</a:LogicalName>
<a:Name i:nil="true" />
</c:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<c:key>SubordinateId</c:key>
<c:value i:type="d:guid" xmlns:d="http://schemas.microsoft.com/2003/10/Serialization/">00000000-0000-0000-0000-000000000000</c:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<c:key>UpdateContent</c:key>
<c:value i:type="a:Entity">
<a:Attributes />
<a:EntityState i:nil="true" />
<a:FormattedValues />
<a:Id>00000000-0000-0000-0000-000000000000</a:Id>
<a:LogicalName>account</a:LogicalName>
<a:RelatedEntities />
</c:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<c:key>PerformParentingChecks</c:key>
<c:value i:type="d:boolean" xmlns:d="http://www.w3.org/2001/XMLSchema">true</c:value>
</a:KeyValuePairOfstringanyType>
</a:Parameters>
<a:RequestId i:nil="true" />
<a:RequestName>Merge</a:RequestName>
</request>
</Execute>
</s:Body>
</s:Envelope>
Of course you should replace Guid.Empty with correct ids of records you want to merge.
I need a basic Mule flow in order to select rows from one database, transform the payload and call a procedure in another database. I don't want to use DataMapper component, I would like to use Java Transformer instead.
My XML flow:
<set-variable variableName="currentOrder" value="#[payload.increment_id]" doc:name="Variable"/>
<db:select config-ref="MySQL_Configuration" doc:name="GET ORDER">
<db:parameterized-query><![CDATA[select id from sales where id=#[currentOrder]]]></db:parameterized-query>
</db:select>
<custom-transformer class="com.mycompany.transformers.TargerProc" doc:name="Java"/>
<db:stored-procedure config-ref="Oracle_Configuration" doc:name="PROC1">
<db:parameterized-query><![CDATA[call proc1(:P1,:P2)]]></db:parameterized-query>
<db:in-param name="P1" type="NUMERIC" value="#[payload.id]"/>
<db:out-param name="P2" type="NUMERIC" value=""/>
</db:stored-procedure>
First problem:
Message payload is of type: CaseInsensitiveHashMap
Could someone shed some light on this? I think it is really simple to achieve this.
Thanks in advance!
Try this <db:parameterized-query>{ call proc1(:P1,:P2) }</db:parameterized-query> :-
<set-variable variableName="currentOrder" value="#[payload.increment_id]" doc:name="Variable"/>
<db:select config-ref="MySQL_Configuration" doc:name="GET ORDER">
<db:parameterized-query><![CDATA[select id from sales where id=#[currentOrder]]]></db:parameterized-query>
</db:select>
<custom-transformer class="com.mycompany.transformers.TargerProc" doc:name="Java"/>
<db:stored-procedure config-ref="Oracle_Configuration" doc:name="PROC1">
<db:parameterized-query>{ call proc1(:P1,:P2) }</db:parameterized-query>
<db:in-param name="P1" type="NUMERIC" value="#[payload.id]"/>
<db:out-param name="P2" type="NUMERIC" value=""/>
</db:stored-procedure>
I have a problem where one mule component transform the payload object into some other value. Ex: Suppose my payload contain student object.
Initial value of Student name=a;
My first mule component change student name to x;
Student s=new Student();
s.setName("x");
My second mule component receive name as X from payload. But I want original value as 'a'.
I tried checking original payload of mule but that value is also changed..
<flow .....
<component> </component> // 1st component
<component></component> //2nd component
</flow>
I want same payload(original) (Student object with name a) in both the component..how can I do that?
I have checked original payload and that has been transformed..
Thanks
You can use <all> to send same payload to different components like
<flow .....
<all>
<component> </component> // 1st component
<component></component> //2nd component
</all>
</flow>
or, a different way to approach same thing is to store the original payload in a variable and then replace the payload with the previous one like:
<set-variable variableName="originalPayload" value="#[message.payload]" />
and then,
<set-payload value="#[flowVars.originalPayload]"/>
Mule also use scatter gather component, which sends the payload to multiple endpoints in parallel. This component has been introduced from Mule 3.5.0 ..
example :
<scatter-gather doc:name="Scatter-Gather" timeout="6000">
<flow-ref name="flightBroker1" />
<flow-ref name="flightBroker2" />
<flow-ref name="flightBroker3" />
</scatter-gather>
Here is the reference :- https://developer.mulesoft.com/docs/display/current/Scatter-Gather