Sending message on wso2 socket, getting exception - java

I am trying to send a message over TCP in wso2 framework. I am getting this exception in log:
[2015-08-20 12:21:50,098] ERROR - TCPWorker Error while processing TCP request through the Axis2 engine
java.lang.NullPointerException
at org.wso2.carbon.tenant.dispatcher.MultitenantDispatcher.findService(MultitenantDispatcher.java:47)
at org.apache.axis2.engine.AbstractDispatcher.invoke(AbstractDispatcher.java:94)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167)
at org.apache.axis2.transport.tcp.TCPWorker.run(TCPWorker.java:68)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Following is the axis2 conf to start TCP:
<transportReceiver name="local" class="org.wso2.carbon.core.transports.local.CarbonLocalTransportReceiver"/>
<transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportListener">
<parameter name="transport.tcp.port">6060</parameter>
</transportReceiver>
And wso2.xml:
<definitions xmlns="http://ws.apache.org/ns/synapse">
<sequence name="fault">
<makefault>
<code xmlns:tns="http://www.w3.org/2003/05/soap-envelope" value="tns:Receiver"/>
<reason value="Mediation failed."/>
</makefault>
<send/>
</sequence>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="TCPProxy"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<parameter name="transport.tcp.port">6060</parameter>
<parameter name="transport.tcp.contentType">application/xml</parameter>
<description/>
</proxy>
</definitions>

It sounds like no proxy service can be found in the ESB when a message is received on tcp port 6060.
I'm not used to tcp transport in WSO2 but I wonder if the "transports" attribute in you proxy definition should contain "tcp" instead of "https,http" :
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="TCPProxy"
transports="tcp"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
<parameter name="transport.tcp.port">6060</parameter>
<parameter name="transport.tcp.contentType">application/xml</parameter>
<description/>
</proxy>

Related

WSO2 EI - RelayUtils Error while building Passthrough stream

I'm using WSO2 EI 6.3.0 and i want to get data from specific webservice and push this data to an other webservice.
In the first time, i have to get the JWT Token from a first webservice to put it in the second call to get data.
So, i created several sequence to have reusable sequences.
I have the error when i want to inject bearer token header into my endpoint to get data.
STEP OF IN SEQUENCE
During the LogincheckSeq, i call the login_check api to get the JWT Token.
Then during the createBearerTokenSeq, i only create a property with the token recovered from LoginCheckSeq
Then we pass in the CreateBearerTokenSeq, to create a property with the token recovered before from the json response of the LoginCheckEP
Finally, we pass in the last sequence GetCustomerSeq to get customers informations from the webservice in json thanks to the jwt token given in the header (Authorization: Bearer token)
This is my CustomerAPI.xml :
<?xml version="1.0" encoding="UTF-8"?>
<api context="/customers" name="CustomersAPI"
xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST GET" uri-template="/">
<inSequence>
<log level="custom" separator="
">
<property name="API CUSTOMER" value="START"/>
</log>
<sequence key="LoginCheckSeq"/>
<sequence key="CreateBearerTokenSeq"/>
<sequence key="GetCustomersSeq"/>
</inSequence>
<outSequence>
<log>
<property expression="$axis2:HTTP_SC" name="Status Code" xmlns:ns="http://org.apache.synapse/xsd"/>
</log>
</outSequence>
<faultSequence>
<log level="full"/>
</faultSequence>
</resource>
</api>
LoginCheckSeq.xml
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="LoginCheckSeq" trace="disable"
xmlns="http://ws.apache.org/ns/synapse">
<log level="custom" separator="
">
<property name="Login SEQUENCE" value="START"/>
</log>
<property expression="json-eval($.username)" name="uri.var.username" scope="default" type="STRING"/>
<property expression="json-eval($.password)" name="uri.var.password" scope="default" type="STRING"/>
<log level="custom" separator=",">
<property expression="fn:concat('Username : ', get-property('uri.var.username'), ' / Password : ',get-property('uri.var.password')) " name="PARAMS"/>
</log>
<call>
<endpoint key="LoginCheckEP"/>
</call>
</sequence>
CreateBearerToken.xml
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="CreateBearerTokenSeq" trace="disable"
xmlns="http://ws.apache.org/ns/synapse">
<log level="custom" separator="
">
<property name="Create Bearer Token SEQUENCE" value="START"/>
</log>
<payloadFactory media-type="json">
<format>{"token":"$1"}</format>
<args>
<arg evaluator="json" expression="$.token"/>
</args>
</payloadFactory>
<property name="messageType" value="application/json" scope="axis2"/>
<property expression="json-eval($.token)" name="uri.var.jwt.token" scope="default" type="STRING"/>
</sequence>
GetCustomerSeq.xml
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="GetCustomersSeq" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<log description="" level="custom" separator="
">
<property name="Get Customer SEQUENCE" value="START"/>
</log>
<log description="" level="custom" separator="##">
<property expression="fn:concat('Bearer ', get-property('uri.var.jwt.token'))" name="JWT Token Created"/>
</log>
<header name="Authorization" expression="fn:concat('Bearer ', get-property('uri.var.jwt.token'))" scope="transport"/>
<send>
<endpoint key="GetCustomersEP"/>
</send>
</sequence>
I get well the JWT Token from LoginCechkSeq but i have an error in the getCustomerSeq.
This is the error :
[2018-08-14 15:14:07,510] [EI-Core] INFO - LogMediator API CUSTOMER = START
[2018-08-14 15:14:07,511] [EI-Core] INFO - LogMediator Login SEQUENCE = START
[2018-08-14 15:14:07,511] [EI-Core] INFO - LogMediator PARAMS = Username : test#test.fr / Password : Azerty123
[2018-08-14 15:14:08,586] [EI-Core] INFO - LogMediator Create Bearer Token SEQUENCE = START
[2018-08-14 15:14:08,591] [EI-Core] INFO - LogMediator Get Customer SEQUENCE = START
[2018-08-14 15:14:08,591] [EI-Core] INFO - LogMediator JWT Token Created = Bearer eyJhbGciOiJSUzI1NiJ9.eyJyb2xlcyI6WyJST0xFX1VTRVJfTUFUT09NQSIsIlJPTEVfVVNFUiJdLCJ1c2VybmFtZSI6InRlc3RAdGVzdC5mciIsImZpcnN0TmFtZSI6I kxvXHUwMGVmYyIsImxhc3ROYW1lIjoiQ2FyaW91IiwiaWQiOjIwLCJpYXQiOjE1MzQyNTI0NDgsImV4cCI6MTUzNDI2Njg0OH0.Gx_cSwXE0rm1EZSPeI64cbOdysjXcLwj2NYjtNE4eh_gtUSwbCE2EUPL6sB-Rt_ayQOeOEx-w07Bkbh-Rr6rUd-mqnKXHuUCe76pOXWWW5ejV7k8n_ Tf3gk4upbzn77VMsyNALWJYNBSO4S8dDCyp413SRvnRaKuhkF1GgvkbZx7aJNUwkDA_ZuxG3IfOKQdao7GgDhWH9pltH9zIjXtjagbjRPgBaekcZiB2bxglQLF7RUMky2MVG_WEbcLFms14LiIEooG3lXao73Z2foYXSMxReHHAmhGPfSipw_wA9ohMolB_X5Ck13O0tSDUvsqvqdZHPZ w8ITmn_4pKnJhTiCK6U58Ub_Nr6Royeiwf3_WN7ooqOczF0hbJr7ZFONo3BwKEhCj6gPv9gknK0ahSotnsRvQS56VsquWJm9ZwtXAI2D0J8tNjSmxMP9FWbmFMWap2wOayUEGpauYD3WA5W-CZexqulJTbLSPcMF92QWaKMoVtL5blgGt9vTb1YIVnQi4KALK9psJETgcvHCIbfsN E_IcYMlotIHRuO4RR-j0I7WAxQVko9YNkIRpuDUftpUq95TbIxn5NeTFhWL_NoC2F3jO4khGYR-Hk2P2ZudygrrdmDMfezn7d5yArV7mlukSB6chwq38T261ktzqx_G_rHt1pjt0jXVhz1DPsY4
[2018-08-14 15:14:10,087] [EI-Core] ERROR - RelayUtils Error while building Passthrough stream
org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1]
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:109)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:570)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:566)
at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:165)
at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:163)
at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:116)
at org.apache.synapse.mediators.AbstractListMediator.buildMessage(AbstractListMediator.java:145)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:94)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:70)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.rest.Resource.process(Resource.java:351)
at org.apache.synapse.rest.API.process(API.java:338)
at org.apache.synapse.rest.RESTRequestHandler.apiProcess(RESTRequestHandler.java:123)
at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:101)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:56)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:303)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:570)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:193)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:263)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '{' (code 123) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:639)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2052)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1134)
at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
at org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:34)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
... 24 more
I tried several thing like add this line :
<messageBuilder contentType="application/json" class="org.wso2.carbon.integrator.core.json.JsonStreamBuilder"/>
Or add property with name "messageType" with value "application/json"
But nothing resolve my problem...
If someone has already encountered this problem, I'm taking the solution =)
I found the response.
The Content-Type of the server response is : application/ld+json.
So WSO2 didn't recognize the encoding.
I just added this line into the axis2.xml :
<messageFormatter contentType="application/ld+json" class="org.wso2.carbon.integrator.core.json.JsonStreamFormatter"/>
....
<messageBuilder contentType="application/ld+json"
class="org.wso2.carbon.integrator.core.json.JsonStreamBuilder"/>
And it's work fine ! =)

How can I implements Message Inspectors?

I want to build a soap Client .NET to contact Java web service. The problem is in the response because there is no compatibility from Java and .NET for the signature.
So I want to disable the validation response from .NET, for this, I have find this articles on MSDN
https://msdn.microsoft.com/en-us/library/aa717047.aspx
I can read that it possibile to insert a method that intercept the response and I can bypass the check. But I'm not able to do this.
I have write import in my project these class:
SchemaValidationBehavior
SchemaValidationBehaviorExtensionElement
SchemaValidationMessageInspector
This is my app.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="MyNewService">
<security defaultAlgorithmSuite="Basic128" authenticationMode="MutualCertificate" requireDerivedKeys="false" securityHeaderLayout="Lax" includeTimestamp="true" messageProtectionOrder="SignBeforeEncrypt" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" requireSignatureConfirmation="false">
<localClientSettings detectReplays="true"/>
<localServiceSettings detectReplays="true"/>
</security>
<textMessageEncoding messageVersion="Soap11WSAddressing10"/>
<httpsTransport/>
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="https://edottotest.sanita.regione.rsr.rupar.puglia.it/nsisr/PianoAssistenzialeResidenzialeService" binding="customBinding" bindingConfiguration="MyNewService" contract="PianoAssistenzialeResidenzialeService.PianoAssistenzialeResidenziale" name="PianoAssistenzialeResidenzialePort" >
<identity>
<dns value="HEALTHNETBR"/>
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
I think the problem is on this file.

Issue with XSLT Transformation using WSO2 ESB

I struggling with XSLT transformer mediator using XSLT mediator in wso2 esb 4.8.1.
The xslt is :
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
xmlns:ns="http://ep.service.ims.com"
xmlns:ax21="http://ep.service.ims.com/xsd"
exclude-result-prefixes="ns fn">
<xsl:param name="amount"/>
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="//ns:getResponse" />
</xsl:template>
<xsl:template match="ns:getResponse" xmlns:ns="http://ep.service.ims.com">
<ep:credit xmlns:ep="http://ep.service.ims.com" xmlns:xsd="http://ep.service.ims.com/xsd">
<ep:info>
<xsd:amount>
<xsl:value-of select="$amount"/>
</xsd:amount>
<xsd:personInfo>
<xsd:address>
<xsl:value-of select="ns:return/ax21:address"/>
</xsd:address>
<xsd:id>
<xsl:value-of select="ns:return/ax21:id"/>
</xsd:id>
<xsd:name>
<xsl:value-of select="ns:return/ax21:name"/>
</xsd:name>
</xsd:personInfo>
</ep:info>
</ep:credit>
</xsl:template>
</xsl:stylesheet>
and the request XML is :
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:getResponse xmlns:ns="http://ep.service.ims.com">
<ns:return xsi:type="ax23:PersonInfo" xmlns:ax23="http://ep.service.ims.com/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ax23:address>IMS Heath, Omega C, India, bnag</ax23:address>
<ax23:id>100</ax23:id>
<ax23:name>WSO2</ax23:name>
</ns:return>
</ns:getResponse>
</soapenv:Body>
</soapenv:Envelope>
I tried the XSLT transformation in eclipse and some online tool like (http://xslt.online-toolz.com/tools/xslt-transformation.php ) and it is working fine. However when I am trying the same in WSO2 ESB, I am facing following exception.....
org.apache.synapse.mediators.transform.XSLTMediator} -
Fatal error occurred in stylesheet parsing :
net.sf.saxon.trans.XPathException:
The supplied file does not appear to be a stylesheet Value {name ='null', keyValue ='xslt1'}
{org.apache.synapse.mediators.transform.XSLTMediator}
javax.xml.transform.TransformerConfigurationException: Failed to compile stylesheet. 1 error detected.
at net.sf.saxon.PreparedStylesheet.prepare(PreparedStylesheet.java:220)
org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:225)
TID: [0] [ESB] [2014-10-08 13:53:20,705] ERROR
{org.apache.synapse.mediators.transform.XSLTMediator} -
Unable to perform XSLT transformation using :
Value {name ='null', keyValue ='xslt1'} against source XPath : s11:Body/child::*[position()=1] | s12:Body/child::*[position()=1]
reason : Error creating XSLT transformer using : Value {name ='null', keyValue ='xslt1'}
{org.apache.synapse.mediators.transform.XSLTMediator}
org.apache.synapse.SynapseException: Error creating XSLT transformer using : Value {name ='null', keyValue ='xslt1'} at
org.apache.synapse.mediators.AbstractMediator.handleException(AbstractMediator.java:313)
Caused by: javax.xml.transform.TransformerConfigurationException:
Failed to compile stylesheet. 1 error detected.
The synapse proxy xml is:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="CreditProxy" transports="https http" startOnLoad="true" trace="disable">
<target>
<inSequence>
<log level="full">
<property name="sequence" value="inSequence - request for CreditProxy"/>
</log>
<property xmlns:pep="http://com.ims.proxy" name="ORG_ID" expression="//pep:credit/pep:id"/>
<property xmlns:pep="http://com.ims.proxy" name="ORG_AMOUNT" expression="//pep:credit/pep:amount"/>
<enrich>
<source type="inline" clone="true">
<pep:get xmlns:pep="http://ep.service.ims.com">
<pep:id>?</pep:id>
</pep:get>
</source>
<target type="body"/>
</enrich>
<enrich>
<source type="property" property="ORG_ID"/>
<target xmlns:pep="http://ep.service.ims.com" xpath="//pep:get/pep:id"/>
</enrich>
<log level="full">
<property name="sequence" value="inSequence - request for PersonInfoService"/>
</log>
<property name="STATE" value="PERSON_INFO_REQUEST"/>
<send>
<endpoint key="PersonInfoEpr"/>
</send>
</inSequence>
<outSequence>
<switch source="get-property('STATE')">
<case regex="PERSON_INFO_REQUEST">
<log level="full">
<property name="sequence" value="outSequence - STATE 01 - response from PersonInfoService"/>
</log>
<xslt key="xslt">
<property name="amount" expression="get-property('ORG_AMOUNT')"/>
</xslt>
<log level="full">
<property name="sequence" value="outSequence - STATE 01 - request for CreditService"/>
</log>
<property name="STATE" value="CREDIT_REQUEST"/>
<send>
<endpoint key="CreditEpr"/>
</send>
</case>
<case regex="CREDIT_REQUEST">
<log level="full">
<property name="sequence" value="outSequence - STATE 02 - response from CreditService"/>
</log>
<send/>
</case>
</switch>
</outSequence>
</target>
<publishWSDL uri="file:resources/CreditProxy.wsdl"/>
</proxy>
What may be the cause of the exception if the XSLT transformation is working fine in other tool ?
The key in the proxy is correct. I might have pasted the wrong XML proxy,
Here is the proxy:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="CreditProxy"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<log level="full">
<property name="sequence" value="inSequence - request for CreditProxy"/>
</log>
<property xmlns:pep="http://com.ims.proxy"
name="ORG_ID"
expression="//pep:credit/pep:id"/>
<property xmlns:pep="http://com.ims.proxy"
name="ORG_AMOUNT"
expression="//pep:credit/pep:amount"/>
<enrich>
<source type="inline" clone="true">
<pep:get xmlns:pep="http://ep.service.ims.com">
<pep:id>?</pep:id>
</pep:get>
</source>
<target type="body"/>
</enrich>
<enrich>
<source type="property" clone="true" property="ORG_ID"/>
<target xmlns:pep="http://ep.service.ims.com" xpath="//pep:get/pep:id"/>
</enrich>
<log level="full">
<property name="sequence" value="inSequence - request for PersonInfoService"/>
</log>
<property name="STATE" value="PERSON_INFO_REQUEST"/>
<send>
<endpoint key="PersonInfoEpr"/>
</send>
</inSequence>
<outSequence>
<switch source="get-property('STATE')">
<case regex="PERSON_INFO_REQUEST">
<log level="full">
<property name="sequence"
value="outSequence - STATE 01 - response from PersonInfoService"/>
</log>
<xslt key="xslt1">
<property name="amount" expression="get-property('ORG_AMOUNT')"/>
</xslt>
<log level="full">
<property name="sequence"
value="outSequence - STATE 01 - request for CreditService"/>
</log>
<property name="STATE" value="CREDIT_REQUEST"/>
<send>
<endpoint key="CreditEpr"/>
</send>
</case>
<case regex="CREDIT_REQUEST">
<log level="full">
<property name="sequence"
value="outSequence - STATE 02 - response from CreditService"/>
</log>
<send/>
</case>
</switch>
</outSequence>
</target>
<publishWSDL uri="file:resources/creditproxy/CreditProxy.wsdl"/>
<description/>
</proxy>
Local entry:
<localEntry xmlns="http://ws.apache.org/ns/synapse" key="xslt1" src="file:resources/creditproxy/personToCredit.xslt"></localEntry>
There was a problem with the local entry. Finally, I was able to fix this issue by adding a local entry like this in the synapse config
<localEntry key="xslt99">
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ax21="http://ep.service.ims.com/xsd"
xmlns:ns="http://ep.service.ims.com"
xmlns:fn="http://www.w3.org/2005/02/xpath-functions"
version="1.0"
exclude-result-prefixes="ns fn">
<xsl:param name="amount"/>
<xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates select="//ns:getResponse"/>
</xsl:template>
<xsl:template match="ns:getResponse">
<ep:credit xmlns:ep="http://ep.service.ims.com" xmlns:xsd="http://ep.service.ims.com/xsd">
<ep:info>
<xsd:amount>
<xsl:value-of select="$amount"/>
</xsd:amount>
<xsd:personInfo>
<xsd:address>
<xsl:value-of select="ns:return/ax21:address"/>
</xsd:address>
<xsd:id>
<xsl:value-of select="ns:return/ax21:id"/>
</xsd:id>
<xsd:name>
<xsl:value-of select="ns:return/ax21:name"/>
</xsd:name>
</xsd:personInfo>
</ep:info>
</ep:credit>
</xsl:template>
</xsl:stylesheet>
<description/>
</localEntry>
Initially I was trying to add the local entries like this
<localEntry xmlns="http://ws.apache.org/ns/synapse" key="xslt1" src="file:resources/creditproxy/personToCredit.xslt"></localEntry>
But still I don't know how to specify a xslt file in local entry.?

Sending an simple E-mail using WSO2 ESB

I am trying to send an e-mail to a specific address using WSO2 ESB.
I configured my axis2.xml by applying following settings to mailto transport sender.
<transportSender name="mailto" class="org.apache.axis2.transport.mail.MailTransportSender">
<parameter name="mail.smtp.host">smtp.gmail.com</parameter>
<parameter name="mail.smtp.port">587</parameter>
<parameter name="mail.smtp.starttls.enable">true</parameter>
<parameter name="mail.smtp.auth">true</parameter>
<parameter name="mail.smtp.user">myusername#gmail.com</parameter>
<parameter name="mail.smtp.password">mypassword</parameter>
<parameter name="mail.smtp.from">myusername#gmail.com</parameter>
</transportSender>
This is my fragment of the sequence which is responsible for sending mail.
<log level="custom">
<property name="Mail status" value="===============enter the mail============="/>
</log>
<property name="messageType" value="text/html" scope="axis2"/>
<property name="ContentType" value="text/html" scope="axis2"/>
<property name="Subject" value="File Received" scope="transport"/>
<property name="OUT_ONLY" value="true" scope="default" type="STRING"/>
<log level="full"/>
<send>
<endpoint>
<address uri="mailto:myreciveemail#gmail.com"/>
</endpoint>
</send>
<log level="custom">
<property name="flag" value="=====After======="/>
</log>
I am pretty much sure that other parts of my proxy service are working just fine.
But the problem is when I triggered the proxy service, it is going through all parts of the sequence without throwing an error but not sending the mail
This is my console output relevant to the fragment of sequence I stated earlier.
[2013-01-29 17:07:15,552] INFO - LogMediator Mail status = ===============enter
the mail=============
[2013-01-29 17:07:15,552] INFO - LogMediator To: , WSAction: urn:mediate, SOAPA
ction: urn:mediate, MessageID: urn:uuid:a12fd64c-f5c5-4b22-b092-e15af960a3d2, Di
rection: request, Envelope: <?xml version='1.0' encoding='utf-8'?><soapenv:Envel
ope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body>
<geo:getZipCode xmlns:geo="http://geo.wso2">
<geo:longitude>1</geo:longitude>
<geo:latitude>3</geo:latitude>
</geo:getZipCode>
</soapenv:Body></soapenv:Envelope>
[2013-01-29 17:07:15,567] INFO - LogMediator flag = =====After=======
Guys please any one knows what's the issue is????
Try to use
<parameter name="mail.smtp.user">myusername</parameter>
without #gmail.com
For those of you who are trying to send an email using the configuration stated in the question via wso2 esb, apart from all that you will need to include a axis2-transport-mail-1.0.0.jar under wso2esb-5.0.0\repository\axis2\client\lib. This jar contains the classes necessary for axis2 to send out an email. Hope this helps someone.

connect java metro client to wcf service with sessions

I need to connect a java metro client to a wcf service for a project I'm cuurently working on. I used the tutorial at click.
Everything seems to work properly until I want to add sessions to my service. When I add <reliableSession enabled="true" /> to my config file, the client isn't able to reload the wcf service.
config file:
<system.serviceModel>
<diagnostics>
<messageLogging logEntireMessage="false" logMalformedMessages="false"
logMessagesAtServiceLevel="false" logMessagesAtTransportLevel="false" />
</diagnostics>
<services>
<service name="Service" behaviorConfiguration="ServiceBehavior">
<!-- Service Endpoints -->
<endpoint address="" bindingConfiguration="interopBinding" binding="metroBinding" contract="IService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
<!-- To configure the service certificate -->
<serviceCredentials>
<serviceCertificate storeLocation="LocalMachine" storeName="Root" x509FindType="FindBySubjectDistinguishedName" findValue="CN=go2.openscrolling" />
<clientCertificate>
<authentication certificateValidationMode="PeerOrChainTrust" />
</clientCertificate>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<metroBinding>
<binding name="interopBinding" messageEncoding="Text">
<security mode="MutualCertificate" establishSecurityContext="false" algorithmSuite="Basic128"/>
<!--<reliableSession enabled="true" />-->
</binding>
</metroBinding>
</bindings>
<extensions>
<bindingExtensions>
<add name="metroBinding" type="Microsoft.ServiceModel.Interop.Metro.Configuration.MetroBindingCollectionElement, Microsoft.ServiceModel.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=4fc38efee625237e"/>
</bindingExtensions>
</extensions>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>

Categories

Resources