How to link a soap request and response in mule 3 - file

I need to send a file to a external web service. When the response is 1, the file should be deleted, else the file should be kept.
I use the file connector to send the file, and insert a record into Oracle. When the file is sent out, the key is the message id of the file connect. I want to keep the message id so that I can update the record using this id when the response is back.
I tried to use MessagePropertiesTransformer to add a custom property, but the response doesn't preserve it. Is there any way to keep the message id?
My config:
<?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:file="http://www.mulesoft.org/schema/mule/file"
xmlns:stdio="http://www.mulesoft.org/schema/mule/stdio"
xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.mulesoft.org/schema/mule/jdbc"
xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/3.1/mule-file.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd
http://www.mulesoft.org/schema/mule/stdio http://www.mulesoft.org/schema/mule/stdio/3.1/mule-stdio.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/3.1/mule-cxf.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.mulesoft.org/schema/mule/jdbc http://www.mulesoft.org/schema/mule/jdbc/3.1/mule-jdbc.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/3.1/mule-xml.xsd
">
<spring:bean id="jdbcDataSource" class="org.enhydra.jdbc.standard.StandardDataSource" destroy-method="shutdown">
<spring:property name="driverName" value="oracle.jdbc.driver.OracleDriver"/>
<spring:property name="url" value="jdbc:oracle:thin:user/pass#ip:1521:orcl"/>
</spring:bean>
<file:connector name="output" outputAppend="true" outputPattern="#[function:datestamp]-#[header:originalFilename]" />
<file:connector name="input" streaming="false" recursive="true" autoDelete="false">
<service-overrides messageFactory="org.mule.transport.file.FileMuleMessageFactory" />
</file:connector>
<jdbc:connector name="jdbcConnector" pollingFrequency="10000" dataSource-ref="jdbcDataSource">
<jdbc:query key="outboundInsertStatement"
value="INSERT INTO TEST_MESSAGE (message_id, filename, done) VALUES (#[message:id],
#[header:originalFilename], #[string:0])"/>
</jdbc:connector>
<mulexml:namespace-manager includeConfigNamespaces="true">
<mulexml:namespace prefix="ns1" uri="http://www.iec.ch/TC57/2008/schema/message"/>
<mulexml:namespace prefix="soapenv" uri="http://schemas.xmlsoap.org/soap/envelope/"/>
<mulexml:namespace prefix="ns1" uri="http://www.iec.ch/TC57/2008/schema/message"/>
<mulexml:namespace prefix="fullmodel" uri="iesb.dongfang.com"/>
</mulexml:namespace-manager>
<flow name="fileTestFlow1">
<file:inbound-endpoint path="D:/data/in" moveToDirectory="D:/data/out" moveToPattern="#[message:id]-#[header:originalFilename]" connector-ref="input"/>
<component class="com.component.FileNameExtract"/>
<message-properties-transformer scope="outbound">
<add-message-property key="test" value="#[message:id]"/>
</message-properties-transformer>
<jdbc:outbound-endpoint queryKey="outboundInsertStatement"/>
<cxf:jaxws-client
clientClass="com.ws.IESBService"
port="IESBServiceEndpoint"
wsdlLocation="classpath:IESBService.wsdl"
operation="requestInfo"/>
<outbound-endpoint address="http://ip:8888/axis2/services/iESBService/" exchange-pattern="request-response">
</outbound-endpoint>
<xml-entity-decoder-transformer/>
<logger message=" #[header:test] !" level="INFO"></logger>
</flow>
</mule>
UPDATE:
I tried "session" scope and I think it works. New config:
<?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:file="http://www.mulesoft.org/schema/mule/file"
xmlns:stdio="http://www.mulesoft.org/schema/mule/stdio"
xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.mulesoft.org/schema/mule/jdbc"
xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/3.1/mule-file.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd
http://www.mulesoft.org/schema/mule/stdio http://www.mulesoft.org/schema/mule/stdio/3.1/mule-stdio.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/3.1/mule-cxf.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.mulesoft.org/schema/mule/jdbc http://www.mulesoft.org/schema/mule/jdbc/3.1/mule-jdbc.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/3.1/mule-xml.xsd
">
<spring:bean id="jdbcDataSource" class="org.enhydra.jdbc.standard.StandardDataSource" destroy-method="shutdown">
<spring:property name="driverName" value="oracle.jdbc.driver.OracleDriver"/>
<spring:property name="url" value="jdbc:oracle:thin:user/pass#ip:1521:orcl"/>
</spring:bean>
<file:connector name="output" outputAppend="true" outputPattern="#[function:datestamp]-#[header:originalFilename]" />
<file:connector name="input" streaming="false" recursive="true" autoDelete="false">
<service-overrides messageFactory="org.mule.transport.file.FileMuleMessageFactory" />
</file:connector>
<jdbc:connector name="jdbcConnector" pollingFrequency="10000" dataSource-ref="jdbcDataSource">
<jdbc:query key="outboundInsertStatement"
value="INSERT INTO TEST_MESSAGE (message_id, filename, done) VALUES (#[message:id],
#[header:originalFilename], #[string:0])"/>
<jdbc:query key="outboundUpdateStatement"
value="update TEST_MESSAGE set done='1' where message_id=#[header:SESSION:test] "/>
</jdbc:connector>
<mulexml:namespace-manager includeConfigNamespaces="true">
<mulexml:namespace prefix="ns1" uri="http://www.iec.ch/TC57/2008/schema/message"/>
<mulexml:namespace prefix="soapenv" uri="http://schemas.xmlsoap.org/soap/envelope/"/>
<mulexml:namespace prefix="ns1" uri="http://www.iec.ch/TC57/2008/schema/message"/>
<mulexml:namespace prefix="fullmodel" uri="iesb.dongfang.com"/>
</mulexml:namespace-manager>
<flow name="fileTestFlow1">
<file:inbound-endpoint path="D:/data/in" moveToDirectory="D:/data/out" moveToPattern="#[message:id]-#[header:originalFilename]" connector-ref="input"/>
<component class="com.component.FileNameExtract"/>
<message-properties-transformer scope="outbound">
<add-message-property key="test" value="#[message:id]"/>
</message-properties-transformer>
<logger message="first #[message:id] " level="INFO"></logger>
<jdbc:outbound-endpoint queryKey="outboundInsertStatement"/>
<cxf:jaxws-client
clientClass="com.ws.IESBService"
port="IESBServiceEndpoint"
wsdlLocation="classpath:IESBService.wsdl"
operation="requestInfo"/>
<outbound-endpoint address="http://ip:8888/axis2/services/iESBService/" exchange-pattern="request-response">
</outbound-endpoint>
<xml-entity-decoder-transformer/>
<jdbc:outbound-endpoint queryKey="outboundUpdateStatement"/>
<logger message="second #[header:SESSION:test] " level="INFO"></logger>
</flow>
</mule>
When I copy the file one by one, it's ok, but when I copy more than five files to the directory, some records can't be updated.
Executing SQL statement: 0 row(s) updated

Set your JDBC outbound endpoint to request-response in order to ensure the flow will execute in a single thread. With your current configuration, the 2 in-only JDBC requests are "detached" from the flow and executed in parallel from it.

Related

Camel JMS Artemis client with two standalone broker configuration url is consuming message from only one host

I have started two standalone Artemis broker in my localhost with 61616 and 61617 port for checking.
Ideally I want to connect to two standalone Artemis broker running in different host within same network. The broker is not configured in Cluster.
Below is the Camel configuration i am trying to use.
With the Artemis 2.14.0 client jar I noticed that consumer is connected to only to one host (61616) and started consuming message. I don't see any consumer to localhost:61617.
Is anything incorrect with the below configuration.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="jmsConnectionFactory" class="org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory">
<constructor-arg index="0" value="(tcp://localhost:61616,tcp://localhost:61617)?useTopologyLoadBalancing=false;wireFormat.maxInactivityDuration=500000"/>
</bean>
<bean id="jmsPooledConnectionFactory" class="org.messaginghub.pooled.jms.JmsPoolConnectionFactory" init-method="start" destroy-method="stop">
<property name="maxConnections" value="10" />
<property name="connectionFactory" ref="jmsConnectionFactory" />
</bean>
<bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="jmsPooledConnectionFactory" />
<property name="concurrentConsumers" value="10" />
</bean>
<bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
<property name="configuration" ref="jmsConfig" />
<property name="streamMessageTypeEnabled" value="true"/>
</bean>
<bean id="SimplePrintBean" class="com.test.SimplePrint" scope="prototype" />
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<endpoint id="sampleQueue" uri="jms:queue:${queueName}" />
<route>
<from uri="ref:sampleQueue" />
<convertBodyTo type="java.lang.String" />
<transform>
<simple>MSG TO QUEUE : ${bodyAs(String)}</simple>
</transform>
<bean ref="SimplePrintBean" method="print"/>
</route>
</camelContext>
</beans>
I eventually tried below which also didn't work
(tcp://localhost:61616?useTopologyLoadBalancing=false,tcp://localhost:61617?useTopologyLoadBalancing=false;)?wireFormat.maxInactivityDuration=500000
without useTopologyLoadBalancing=false, the same behavior too.
Broker.xml - same configuration only the <acceptor> url was updated with 61617 on the other broker.
<?xml version='1.0'?>
<configuration xmlns="urn:activemq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
<core xmlns="urn:activemq:core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:activemq:core ">
<name>0.0.0.0</name>
<persistence-enabled>true</persistence-enabled>
<journal-type>ASYNCIO</journal-type>
<paging-directory>data/paging</paging-directory>
<bindings-directory>data/bindings</bindings-directory>
<journal-directory>data/journal</journal-directory>
<large-messages-directory>data/large-messages</large-messages-directory>
<journal-datasync>true</journal-datasync>
<journal-min-files>2</journal-min-files>
<journal-pool-files>10</journal-pool-files>
<journal-device-block-size>4096</journal-device-block-size>
<journal-file-size>10M</journal-file-size>
<journal-buffer-timeout>2220000</journal-buffer-timeout>
<journal-max-io>4096</journal-max-io>
<disk-scan-period>5000</disk-scan-period>
<max-disk-usage>90</max-disk-usage>
<critical-analyzer>true</critical-analyzer>
<critical-analyzer-timeout>120000</critical-analyzer-timeout>
<critical-analyzer-check-period>60000</critical-analyzer-check-period>
<critical-analyzer-policy>HALT</critical-analyzer-policy>
<page-sync-timeout>20620000</page-sync-timeout>
<acceptors>
<acceptor name="artemis">tcp://0.0.0.0:61616?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;amqpMinLargeMessageSize=102400;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;amqpCredits=1000;amqpLowCredits=300;amqpDuplicateDetection=true;amqpDuplicateDetection=true;supportAdvisory=false</acceptor>
<acceptor name="amqp">tcp://0.0.0.0:5672?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=AMQP;useEpoll=true;amqpCredits=1000;amqpLowCredits=300;amqpMinLargeMessageSize=102400;amqpDuplicateDetection=true</acceptor>
</acceptors>
<security-settings>
<security-setting match="#">
<permission type="createNonDurableQueue" roles="amq"/>
<permission type="deleteNonDurableQueue" roles="amq"/>
<permission type="createDurableQueue" roles="amq"/>
<permission type="deleteDurableQueue" roles="amq"/>
<permission type="createAddress" roles="amq"/>
<permission type="deleteAddress" roles="amq"/>
<permission type="consume" roles="amq"/>
<permission type="browse" roles="amq"/>
<permission type="send" roles="amq"/>
<!-- we need this otherwise ./artemis data imp wouldn't work -->
<permission type="manage" roles="amq"/>
</security-setting>
</security-settings>
<address-settings>
<!-- if you define auto-create on certain queues, management has to be auto-create -->
<address-setting match="activemq.management#">
<dead-letter-address>DLQ</dead-letter-address>
<expiry-address>ExpiryQueue</expiry-address>
<redelivery-delay>0</redelivery-delay>
<!-- with -1 only the global-max-size is in use for limiting -->
<max-size-bytes>-1</max-size-bytes>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
<address-full-policy>PAGE</address-full-policy>
<auto-create-queues>true</auto-create-queues>
<auto-create-addresses>true</auto-create-addresses>
<auto-create-jms-queues>true</auto-create-jms-queues>
<auto-create-jms-topics>true</auto-create-jms-topics>
</address-setting>
<!--default for catch all-->
<address-setting match="#">
<dead-letter-address>DLQ</dead-letter-address>
<expiry-address>ExpiryQueue</expiry-address>
<redelivery-delay>0</redelivery-delay>
<!-- with -1 only the global-max-size is in use for limiting -->
<max-size-bytes>-1</max-size-bytes>
<message-counter-history-day-limit>10</message-counter-history-day-limit>
<address-full-policy>PAGE</address-full-policy>
<auto-create-queues>true</auto-create-queues>
<auto-create-addresses>true</auto-create-addresses>
<auto-create-jms-queues>true</auto-create-jms-queues>
<auto-create-jms-topics>true</auto-create-jms-topics>
</address-setting>
</address-settings>
<addresses>
<address name="DLQ">
<anycast>
<queue name="DLQ" />
</anycast>
</address>
<address name="ExpiryQueue">
<anycast>
<queue name="ExpiryQueue" />
</anycast>
</address>
</addresses>
</core>
</configuration>

Error Calling a WSDL service from angularjs using soapclient.js and angular.soap.js

I want to call wsdl service (created by dataflux data management studio )from my angular application.
I had already referred to the post
1) AngularJS - SOAP Service Integration With AngularJS Model
2) Simplest SOAP example
3) How to consume a SOAP WebService with AngularJS?
I am using soapclient.js and angular.soap.js
It is giving this error:
Uncaught TypeError: Cannot read property 'constructor' of null
soapCallback # angular.soap.js:16
SOAPClient._onSendSoapRequest # soapclient.js:214
xmlHttp.onreadystatechange # soapclient.js:187
My code in controller:
$scope.getData = function(){
soapService.DMService().then(function(response){
$scope.response = response;
});
}
In app.js,
app.factory("soapService", ['$soap',function($soap){
var base_url = "http://myserver:9000/WSDL_Web_Service/service__DashBoard.WSDL";
return {
DMService: function(){
return $soap.post(base_url,"procsvc_service__DashBoard.djf");
}
}
}]);
My wsdl service : service__Dashboard.WSDL
`
<?xml version="1.0"?>
<definitions name="DMService"
targetNamespace="http://archserver.wsdl.dataflux.com"
xmlns:tns="http://archserver.wsdl.dataflux.com"
xmlns:archxsd="archserver.xsd.dataflux.com"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:MIME="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:DIME="http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/"
xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<schema
targetNamespace="archserver.xsd.dataflux.com"
xmlns:tns="archserver.xsd.dataflux.com"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="unqualified"
attributeFormDefault="unqualified">
<complexType name="request">
<sequence>
</sequence>
</complexType>
<element name="procsvc_service__DashBoard.djf_in" type="tns:request"/>
<complexType name="response">
<sequence>
<element name="result" type="xsd:string" minOccurs="0" maxOccurs="1"/>
</sequence>
</complexType>
<element name="procsvc_service__DashBoard.djf_out" type="tns:response"/>
</schema>
</types>
<message name="procsvc_service__DashBoard.djf_in">
<part name="body" element="archxsd:procsvc_service__DashBoard.djf_in"/>
</message>
<message name="procsvc_service__DashBoard.djf_out">
<part name="body" element="archxsd:procsvc_service__DashBoard.djf_out"/>
</message>
<portType name="DataManagementServicePortType">
<operation name="procsvc_service__DashBoard.djf_in">
<documentation></documentation>
<input message="tns:procsvc_service__DashBoard.djf_in"/>
<output message="tns:procsvc_service__DashBoard.djf_out"/>
</operation>
</portType>
<binding name="DataManagementService" type="tns:DataManagementServicePortType">
<SOAP:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="procsvc_service__DashBoard.djf_in">
<SOAP:operation soapAction="service__DashBoard.djf*1*57195B25CE0B6D37"/>
<input>
<SOAP:body use="literal"/>
</input>
<output>
<SOAP:body use="literal"/>
</output>
</operation>
</binding>
<service name="DMService">
<documentation>Data Management Server</documentation>
<port name="DMService" binding="tns:DataManagementService">
<SOAP:address location="http://someserver:21000"/>
</port>
</service>
</definitions> `
changes in soapclient.js (in method SOAPClient._onSendSoapRequest on line 201 ):
var nd = SOAPClient._getElementsByTagName(req.responseXML, method + **"_in"**);
if(nd.length == 0)
nd = SOAPClient._getElementsByTagName(req.responseXML, "return");
I feel, I might be calling the wsdl method in wrong way, but not able to figure out how it should be. If anybody can throw more light on how it should be done...it would be great
Thanks...

How To Generate SAML2Response Specified By Destination

I am very new to SAML and am very confused at this point. I am using Kentor to generate a Saml2Response, but it is not looking anything like my relying party is expecting. They are specifically looking for the certificate to be embedded in the response.
I need to generate this.
<?xml version="1.0" encoding="UTF-8"?>
<saml2p:Response xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol" ID="_09f6a725ecf844128a5f7ef8cc1e7620"
IssueInstant="2013-12-11T03:52:21.770Z" Version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" />
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" />
<ds:Reference URI="#_09f6a725ecf844128a5f7ef8cc1e7620" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:Transforms xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:Transform
Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" />
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="xs" />
</ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" />
<ds:DigestValue xmlns:ds="http://www.w3.org/2000/09/xmldsig#">DATA_REMOVED</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue xmlns:ds="http://www.w3.org/2000/09/xmldsig#">DATA_REMOVED</ds:SignatureValue>
<ds:KeyInfo>
<ds:KeyName>[removed]</ds:KeyName>
</ds:KeyInfo>
</ds:Signature>
<saml2p:Status>
<saml2p:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" />
</saml2p:Status>
<saml2:Assertion xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" ID="_cadd3488f62c6d3b9933fdb56d9e8ddc"
IssueInstant="2013-12-11T03:52:21.770Z" Version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<saml2:Issuer xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">[removed]</saml2:Issuer>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" />
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" />
<ds:Reference URI="#_cadd3488f62c6d3b9933fdb56d9e8ddc" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:Transforms xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" />
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="xs" />
</ds:Transform>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" />
<ds:DigestValue xmlns:ds="http://www.w3.org/2000/09/xmldsig#">DATA_REMOVED</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue xmlns:ds="http://www.w3.org/2000/09/xmldsig#">DATA_REMOVED</ds:SignatureValue>
<ds:KeyInfo>
<ds:KeyName>CN=, O=, C=US</ds:KeyName>
</ds:KeyInfo>
</ds:Signature>
<saml2:Subject xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">
<saml2:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified" NameQualifier="com.sms">0500555</saml2:NameID>
<saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
<saml2:SubjectConfirmationData NotBefore="2013-12-11T03:47:21.770Z" NotOnOrAfter="2013-12-11T03:57:21.770Z" />
</saml2:SubjectConfirmation>
</saml2:Subject>
<saml2:Conditions NotBefore="2013-12-11T03:52:21.770Z" NotOnOrAfter="2013-12-11T03:57:21.770Z"
xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" />
<saml2:AuthnStatement AuthnInstant="2013-12-11T03:52:21.770Z" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">
<saml2:AuthnContext>
<saml2:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:Password</saml2:AuthnContextClassRef>
</saml2:AuthnContext>
</saml2:AuthnStatement>
<saml2:AttributeStatement xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">
<saml2:Attribute Name="AppData" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
<saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">A_Party_PI.Person.FirstName =John& A_Party_PI.Person.LastName =Smith</saml2:AttributeValue>
</saml2:Attribute>
</saml2:Attribute>
</saml2:AttributeStatement>
</saml2:Assertion>
</saml2p:Response>
What I am getting from Kentor is this:
<?xml version="1.0"?>
<saml2p:Response
Destination="https://[destinationUrl]"
ID="ide5470d1f5a9a48d1822f71ea5a5363f2"
IssueInstant="2015-05-28T13:35:44Z"
Version="2.0" xmlns:saml2p="urn:oasis:names:tc:SAML:2.0:protocol">
<saml2:Issuer xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">
ritterim.com
</saml2:Issuer>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="#ide5470d1f5a9a48d1822f71ea5a5363f2">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>7YmTpqZR6Ba4/eDrEqQt7BGit0A=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>
</SignatureValue>
</Signature>
<saml2p:Status>
<saml2p:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
</saml2p:Status>
<saml2:Assertion ID="_77b39d8e-bcc4-48c2-b6c7-fe6e87414461"
IssueInstant="2015-05-28T13:35:44Z" Version="2.0"
xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">
<saml2:Issuer>ritterim.com</saml2:Issuer>
<saml2:Subject>
<saml2:NameID>0500555</saml2:NameID>
<saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer"/>
</saml2:Subject>
<saml2:Conditions NotOnOrAfter="2015-05-28T13:37:44Z"/>
<saml2:AttributeStatement>
<saml2:Attribute Name="AppData">
<saml2:AttributeValue>A_Party_PI.Person.FirstName =John& A_Party_PI.Person.LastName =Smith</saml2:AttributeValue>
</saml2:Attribute>
</saml2:AttributeStatement>
</saml2:Assertion>
</saml2p:Response>
Any help would be appreciated, as I'm not even sure I'm in the right arena.
I'll answer by commenting on the differences in the responses.
There's no encoding in the xml declaration. Probably won't matter.
Issuer, which is optional is added.
I assume you've removed the SignatureValue from the AuthServices response.
AuthServices currently does not include the KeyInfo in the signature (it's optional)
AuthServices does not sign the assertion, only the response.
XML namespaces declarations are put in one place by AuthServices and not repeated all over.
There's no Format on the Subject NameId (it's optional)
There's no NameQualifier on the Subject NameId (it's optional)
There's no NameFormat on the Attribute (it's optional)
There's no xml type (xsi:string) on the AttributeValue (it's optional)
Basically Kentor.AuthServices leaves out a bunch of optional stuff, but otherwise the messages are equivalent.
You'll have to provide more details on what things are causing problems to get help on those.

Mulesoft Salesforce to CSV

I am revising the question for more clarity. I am trying to import Salesforce contact data to a CSV File.
my Config XML is as below:
<sfdc:connection-pooling-profile initialisationPolicy="INITIALISE_ONE" exhaustedAction="WHEN_EXHAUSTED_GROW"/>
</sfdc:config>
<file:connector name="File" writeToDirectory="C:\Users\anataraj\Desktop\Mulesoft Fileconversion\Files" autoDelete="true" streaming="true" validateConnections="true" doc:name="File"/>
<file:connector name="File1" writeToDirectory="C:\Users\anataraj\Desktop\Mulesoft Fileconversion\Files" autoDelete="true" streaming="true" validateConnections="true" doc:name="File"/>
<file:connector name="File2" writeToDirectory="C:\Users\anataraj\Desktop\Mulesoft Fileconversion" autoDelete="true" streaming="true" validateConnections="true" doc:name="File"/>
<data-mapper:config name="XML_To_CSV" transformationGraphPath="xml_to_csv.grf" doc:name="XML_To_CSV"/>
<flow name="testapp2Flow1" doc:name="testapp2Flow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
<sfdc:query config-ref="Salesforce1" query="SELECT FirstName,LastName from Contact limit 5" doc:name="Salesforce"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<mulexml:object-to-xml-transformer doc:name="Object to XML"/>
<data-mapper:transform config-ref="XML_To_CSV" doc:name="XML To CSV"/>
<file:outbound-endpoint path="C:\Users\anataraj\Desktop\Mulesoft Fileconversion" connector-ref="File2" responseTimeout="10000" doc:name="File"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
</flow>
The Output get in my file & Logger is of format:
"[FirstName, Kyle]",""
"[Id]",""
"[LastName, Swenson]",""
"[type, Contact]",""
What I need is in the format:
Kyle,Swenson
Antony,Barker
Rich,Gilbertson
AM i doing wrong in the way i am mapping. Please advise. Thanks!
you could have also used Transform message with below config set.
%output application/csv separator=";", header=false

Apex type not found for element : userDetails

I m getting the following response from the webservice
<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><GetUserResponse xmlns="urn:wwservice"><userDetails xmlns="">Successfully write a web service hurray</userDetails></GetUserResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
But I getting Apex type not found for element : userDetails
Here's my wsdl file
<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:wwservice" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:wwservice">
<types>
<xsd:schema elementFormDefault="qualified" targetNamespace="urn:wwservice">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/>
<xsd:complexType name="GetUserRequestType">
<xsd:all>
<xsd:element name="Username" type="xsd:string" form="unqualified"/>
<xsd:element name="Password" type="xsd:string" form="unqualified"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="GetUserResponseType">
<xsd:all>
<xsd:element name="userDetails" type="xsd:string" form="unqualified"/>
</xsd:all>
</xsd:complexType>
<xsd:element name="GetUser" type="tns:GetUserRequestType"/>
<xsd:element name="GetUserResponse" type="tns:GetUserResponseType"/>
</xsd:schema>
</types>
<message name="GetUserRequest">
<part name="parameters" element="tns:GetUser"/></message>
<message name="GetUserResponse">
<part name="parameters" element="tns:GetUserResponse"/></message>
<portType name="PsocialPortType">
<operation name="GetUser">
<input message="tns:GetUserRequest"/>
<output message="tns:GetUserResponse"/>
</operation>
</portType>
<binding name="PsocialBinding" type="tns:PsocialPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="GetUser">
<soap:operation soapAction="urn:wwservice#GetUser" style="document"/>
<input><soap:body use="literal" namespace="urn:wwservice"/></input>
<output><soap:body use="literal" namespace="urn:wwservice"/></output>
</operation>
</binding>
<service name="Psocial">
<port name="PsocialPort" binding="tns:PsocialBinding">
<soap:address location="http://example.com/webservice/wwservice.php"/>
</port>
</service>
</definitions>
Please let me know where i getting wrong
I m using this to create WSDL
$server = new soap_server();
// Changed for coupons data start
$server->soap_defencoding = 'UTF-8';
$server->decode_utf8 = false;
// Changed for coupons data end
//$server->configureWSDL('m-way', 'urn:wwservice');
$server->configureWSDL('Psocial', 'urn:wwservice',false,'document');
// New function for spiff
$server->register("GetUser",
array('Username'=>'xsd:string','Password'=>'xsd:string'),
array('userDetails'=>'xsd:string'),
'urn:wwservice',
'urn:wwservice#GetUser', 'document', 'literal'
);
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA)? $HTTP_RAW_POST_DATA : file_get_contents('php://input');
$server->service($HTTP_RAW_POST_DATA);
The problem is that the SOAP response you get doesn't match the description of it in the WSDL, the WSDL has elementFormDefault="qualified" for the schema, which says that child element would be in the namespace, e.g. its saying the response should be
<GetUserResponse xmlns="urn:wwservice">
<userDetails>Hello</userDetails>
</GetUserResponse>
but the actual response you get has
<GetUserResponse xmlns="urn:wwservice">
<userDetails xmlns="">Successfully write a web service hurray</userDetails>
</GetUserResponse>
Note how the namespace for the userDetails element is different. You should either update the WSDL to say elementForDefault="unqualified" or update the web service to return the correct namespace on the userDetails element.

Resources