Reputation: 119
Using smooks mediator reading comma separated file. For each row making a call out to another service. This request is monitored (see below). It is not what I expect and it fails.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="agreementsCSVFileProxy"
transports="vfs"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<log level="full"/>
<smooks config-key="smooks">
<input type="text"/>
<output type="xml"/>
</smooks>
<iterate xmlns:ns2="http://org.apache.synapse/xsd"
xmlns:sec="http://secservice.samples.esb.wso2.org"
expression="//csv-set/csv-record">
<target>
<sequence>
<property name="customer_id" expression="//csv-record/customer_id/text()"/>
<property name="date_time" expression="//csv-record/date_time/text()"/>
<property name="agreement_id" expression="//csv-record/agreement_id/text()"/>
<property name="product_id" expression="//csv-record/product_id/text()"/>
<property name="product_name" expression="//csv-record/product_name/text()"/>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sch="http://domain.com/mifid/timeline/schema/">
<soapenv:Header/>
<soapenv:Body>
<sch:productLookupRequest>
<sch:productId>$1</sch:productId>
</sch:productLookupRequest>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg xmlns:ns="http://org.apache.synapse/xsd"
evaluator="xml"
expression="get-property('product_id')"/>
</args>
</payloadFactory>
<property name="Content-Type"
value="application/xml"
scope="axis2"
type="STRING"/>
<callout serviceURL="http://localhost:9088/mockproductLookupSoapBinding"
action="urn:lookupProduct">
<source xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
<target xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
</callout>
<property xmlns:ns="http://org.apache.synapse/xsd"
xmlns:sch="http://domain.com/mifid/timeline/schema/"
name="product_name"
expression="//sch:productName"/>
<payloadFactory media-type="xml">
<format>
<dat:insertAgreement xmlns:dat="http://ws.wso2.org/dataservice">
<dat:p_customer_id>$1</dat:p_customer_id>
<dat:p_record_type_id>1</dat:p_record_type_id>
<dat:p_date_time>$2</dat:p_date_time>
<dat:p_agreement_id>$3</dat:p_agreement_id>
<dat:p_product_id>$4</dat:p_product_id>
<dat:p_product_name>$5</dat:p_product_name>
</dat:insertAgreement>
</format>
<args>
<arg evaluator="xml" expression="get-property('customer_id')"/>
<arg evaluator="xml" expression="get-property('date_time')"/>
<arg evaluator="xml" expression="get-property('agreement_id')"/>
<arg evaluator="xml" expression="get-property('product_id')"/>
<arg evaluator="xml" expression="get-property('product_name')"/>
</args>
</payloadFactory>
<header name="Action"
scope="default"
value="http://ws.wso2.org/dataservice"/>
<send>
<endpoint>
<address uri="http://localhost:9767/services/Timeline/" format="soap11"/>
</endpoint>
</send>
</sequence>
</target>
</iterate>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.PollInterval">15</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file://C:\temp\test\original</parameter>
<parameter name="transport.vfs.FileURI">file://C:\temp\test\in</parameter>
<parameter name="transport.vfs.MoveAfterFailure">file://C:\temp\test\fail</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.txt</parameter>
<parameter name="transport.vfs.ContentType">text/plain</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
</proxy>
Below is the request to the external service monitored by tcpmon. It's like the payloadfactory prior to the callout isn't there.
POST /mockproductLookupSoapBinding HTTP/1.1
Content-Type: text/plain; charset=UTF-8;action="urn:lookupProduct";
FILE_NAME: agreement_small.txt
FILE_PATH: /temp/test/in/agreement_small.txt
FILE_URI: file:///C:/temp/test/in/agreement_small.txt
User-Agent: Axis2
Host: 127.0.0.1:9088
Transfer-Encoding: chunked
0
With an expected result.
HTTP/1.1 500 Internal Server Error
Content-Type: text/html; charset=iso-8859-1
Transfer-Encoding: chunked
Server: Jetty(6.1.26)
151
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>Server</faultcode>
<faultstring>Missing operation for soapAction [] and body element [null] with SOAP Version [SOAP 1.1]</faultstring>
</soapenv:Fault>
</soapenv:Body></soapenv:Envelope>
0
What am I missing?
Upvotes: 0
Views: 356
Reputation: 5946
When the inSequence starts, the content type is text/plain and you don't change it before callout mediator (see tcpmon : Content-Type: text/plain; charset=UTF-8;action="urn:lookupProduct";)
There is no text node insique your soap body so, there is nothing to send
set this property before callout mediator :
<property name="messageType" value="text/xml" scope="axis2"/>
Upvotes: 1