Re: [Dev] [DEV][ESB][Connector] Issue with empty response

2015-10-08 Thread Jay
Hi,

I have attached both axis configuration and wire log here with.

axis2.xml
  
log.txt   

Thanks,
Janaka



--
View this message in context: 
http://wso2-oxygen-tank.10903.n7.nabble.com/DEV-ESB-Connector-Issue-with-empty-response-tp126711p126724.html
Sent from the WSO2 Development mailing list archive at Nabble.com.
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [DEV][ESB][Connector] Issue with empty response

2015-10-08 Thread Jay
Hi All,

When i developing ESB connector for Microsoft PowerBI there is a  method
which returning empty response with the Content-Type:
application/octet-stream. And it is throwing following exception. I have
tried with following message formatters/builders and none of them are
working properly and giving the same exception.






--- Synapse configuration -

http://ws.apache.org/ns/synapse";>
   
   
   
   
  
  
  
  
 
{
"rows":$1
}
 
 

 
  
  
 

 
  
  
  
  
  
  
  
  
  
   


 Wire log 

[2015-10-08 13:29:41,525] DEBUG - headers http-outgoing-4 << HTTP/1.1 200 OK
[2015-10-08 13:29:41,525] DEBUG - headers http-outgoing-4 << Cache-Control:
no-store, must-revalidate, no-cache
[2015-10-08 13:29:41,526] DEBUG - headers http-outgoing-4 << Content-Length:
0
[2015-10-08 13:29:41,526] DEBUG - headers http-outgoing-4 << Content-Type:
application/octet-stream
[2015-10-08 13:29:41,526] DEBUG - headers http-outgoing-4 <<
Content-Encoding: gzip
[2015-10-08 13:29:41,527] DEBUG - headers http-outgoing-4 << Server:
Microsoft-HTTPAPI/2.0 Microsoft-HTTPAPI/2.0
[2015-10-08 13:29:41,527] DEBUG - headers http-outgoing-4 <<
Strict-Transport-Security: max-age=31536000; includeSubDoma
ins
[2015-10-08 13:29:41,527] DEBUG - headers http-outgoing-4 <<
X-Frame-Options: deny
[2015-10-08 13:29:41,528] DEBUG - headers http-outgoing-4 <<
X-Content-Type-Options: nosniff
[2015-10-08 13:29:41,528] DEBUG - headers http-outgoing-4 << RequestId:
bdd8f6ca-fc26-43d3-8943-2e3a08b276e1
[2015-10-08 13:29:41,528] DEBUG - headers http-outgoing-4 << Date: Thu, 08
Oct 2015 07:59:40 GMT
[2015-10-08 13:29:41,532] ERROR - RelayUtils Error while building
Passthrough stream
java.io.EOFException
at java.util.zip.GZIPInputStream.readUByte(GZIPInputStream.java:264)
at
java.util.zip.GZIPInputStream.readUShort(GZIPInputStream.java:254)
at
java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:163)
at java.util.zip.GZIPInputStream.(GZIPInputStream.java:78)
at java.util.zip.GZIPInputStream.(GZIPInputStream.java:90)
at
org.apache.axis2.transport.http.HTTPTransportUtils.handleGZip(HTTPTransportUtils.java:257)
at
org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:95)

at
org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:133)
at
org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:98)
at
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72)
at
org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:154)
at
org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:252)
at
org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironme
nt.java:655)
at
org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:242)
at
org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:500)
at
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:243)
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:744)
[2015-10-08 13:29:41,536] ERROR - TemplateMediator Error while building
message
org.apache.axis2.AxisFault: Error while building Passthrough stream
at
org.apache.synapse.transport.passthru.util.RelayUtils.handleException(RelayUtils.java:283)
at
org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:142)
at
org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:98)
at
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72)
at
org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:154)
at
org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:252)
at
org.apache.synapse.core.axis2.Axis2SynapseEnvironment.mediateFromContinuationStateStack(Axis2SynapseEnvironme
nt.java:655)
at
org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:242)
at
org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.j

Re: [Dev] ESB Connector - SSLHandshakeException

2014-09-03 Thread Jay
Hi Naasheer,

Import particular certificate in to
\repository\resources\security\client-truststore.jks keystore.

Regards,
Janaka



--
View this message in context: 
http://wso2-oxygen-tank.10903.n7.nabble.com/ESB-Connector-SSLHandshakeException-tp102207p102211.html
Sent from the WSO2 Development mailing list archive at Nabble.com.
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Mutual SSL work with java 7 and open jdk 6 but not with sun java 6

2014-08-31 Thread Jay
Hi Varuna,

I tired with your solution but problem still remain as same. Using SSLv3
instead of TLS is working fine with direct call but not for connector.  And
also above mentioned code is a part of BrainTree SDK, not a  connector code. 

Thnaks.



--
View this message in context: 
http://wso2-oxygen-tank.10903.n7.nabble.com/Mutual-SSL-work-with-java-7-and-open-jdk-6-but-not-with-sun-java-6-tp102060p102075.html
Sent from the WSO2 Development mailing list archive at Nabble.com.
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Mutual SSL work with java 7 and open jdk 6 but not with sun java 6

2014-08-31 Thread Jay
Dear All,

When Braintree connector was tested on ESB with Java SDK 1.6.0_22 all the
methods threw the following exception trace and failed.

[2014-08-29 16:42:09,415] ERROR - CreateTransaction java.io.IOException:
subject key, java.lang.NullPointerException
com.braintreegateway.exceptions.UnexpectedException: java.io.IOException:
subject key, java.lang.NullPointerException
at com.braintreegateway.util.Http.getSSLSocketFactory(Http.java:156)
at com.braintreegateway.util.Http.httpRequest(Http.java:80)
at com.braintreegateway.util.Http.post(Http.java:60)
at com.braintreegateway.TransactionGateway.sale(TransactionGateway.java:105)
at
org.wso2.carbon.connector.braintree.CreateTransaction.createTransaction(CreateTransaction.java:401)
at
org.wso2.carbon.connector.braintree.CreateTransaction.connect(CreateTransaction.java:75)
at
org.wso2.carbon.connector.core.AbstractConnector.mediate(AbstractConnector.java:32)
at
org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:78)
at
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at
org.apache.synapse.mediators.template.TemplateMediator.mediate(TemplateMediator.java:77)
at
org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:129)
at
org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:78)
at
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at
org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
at
org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:166)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at
org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:344
)
at
org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:385)
at
org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:183)
at
org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.security.cert.CertificateParsingException:
java.io.IOException: subject key, java.lang.NullPointerException

However the methods work perfectly fine when using Java SDK 1.7 and Open JDK
1.6 (on Linux machines).

It was also observed that the Braintree SDK works fine with direct calls
when using all Java 6 and 7 even 5.

The following method in the Braintree SDK is where the exception is being
thrown from.

Class com.braintreegateway.util.Http - 

private SSLSocketFactory getSSLSocketFactory() {
try {
KeyStore keyStore =
KeyStore.getInstance(KeyStore.getDefaultType());
keyStore.load(null);

for (String certificateFilename : certificateFilenames) {
CertificateFactory cf =
CertificateFactory.getInstance("X.509");
InputStream certStream =
Http.class.getClassLoader().getResourceAsStream(certificateFilename);

Collection coll =
cf.generateCertificates(certStream); // This is the line which throws the
Exception
for (Certificate cert : coll) {
if (cert instanceof X509Certificate) {
  X509Certificate x509cert = (X509Certificate) cert;
  Principal principal = x509cert.getSubjectDN();
  String subject = principal.getName();
  keyStore.setCertificateEntry(subject, cert);
}
}
}

KeyManagerFactory kmf =
KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
kmf.init(keyStore, null);
TrustManagerFactory tmf =
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(keyStore);

SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init((KeyManager[]) kmf.getKeyManagers(),
tmf.getTrustManagers(), SecureRandom.getInstance("SHA1PRNG"));

return sslContext.getSocketFactory();
} catch (Exception e) {
throw new UnexpectedException(e.getMessage(), e);
}
}

The following approaches were tried to resolve the issue which apparently
proved useless.
1.  Imported the Braintree API X509 certificate into wso2carbon.jks and to
client-truststore.jks.
2.  Imported the same into cacerts (jre\lib\security\cacerts)file when using
Java SDK 1.6.
3.  Tried installing OpenJDK 1.6 and ran the ESB using it. The connector
worked fine.
4.  Tried extracting the 

[Dev] BrainTree Connector Issue with JDK 1.6

2014-08-31 Thread Jay
Hi,

When Braintree connector was tested on ESB with Java SDK 1.6.0_22 all the
methods threw the following exception trace and failed.

[2014-08-29 16:42:09,415] ERROR - CreateTransaction java.io.IOException:
subject key, java.lang.NullPointerException
com.braintreegateway.exceptions.UnexpectedException: java.io.IOException:
subject key, java.lang.NullPointerException
at com.braintreegateway.util.Http.getSSLSocketFactory(Http.java:156)
at com.braintreegateway.util.Http.httpRequest(Http.java:80)
at com.braintreegateway.util.Http.post(Http.java:60)
at com.braintreegateway.TransactionGateway.sale(TransactionGateway.java:105)
at
org.wso2.carbon.connector.braintree.CreateTransaction.createTransaction(CreateTransaction.java:401)
at
org.wso2.carbon.connector.braintree.CreateTransaction.connect(CreateTransaction.java:75)
at
org.wso2.carbon.connector.core.AbstractConnector.mediate(AbstractConnector.java:32)
at
org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:78)
at
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at
org.apache.synapse.mediators.template.TemplateMediator.mediate(TemplateMediator.java:77)
at
org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:129)
at
org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:78)
at
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)
at
org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)
at
org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)
at
org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:166)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at
org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:344
)
at
org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:385)
at
org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:183)
at
org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.security.cert.CertificateParsingException:
java.io.IOException: subject key, java.lang.NullPointerException

However the methods work perfectly fine when using Java SDK 1.7 and Open JDK
1.6 (on Linux machines).

It was also observed that the Braintree SDK works fine with direct calls
when using all Java 6 and 7.

The following method in the Braintree SDK is where the exception is being
thrown from.

Class com.braintreegateway.util.Http - 

private SSLSocketFactory getSSLSocketFactory() {
try {
KeyStore keyStore =
KeyStore.getInstance(KeyStore.getDefaultType());
keyStore.load(null);

for (String certificateFilename : certificateFilenames) {
CertificateFactory cf =
CertificateFactory.getInstance("X.509");
InputStream certStream =
Http.class.getClassLoader().getResourceAsStream(certificateFilename);

Collection coll =
cf.generateCertificates(certStream); // This is the line which throws the
Exception
for (Certificate cert : coll) {
if (cert instanceof X509Certificate) {
  X509Certificate x509cert = (X509Certificate) cert;
  Principal principal = x509cert.getSubjectDN();
  String subject = principal.getName();
  keyStore.setCertificateEntry(subject, cert);
}
}
}

KeyManagerFactory kmf =
KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
kmf.init(keyStore, null);
TrustManagerFactory tmf =
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(keyStore);

SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init((KeyManager[]) kmf.getKeyManagers(),
tmf.getTrustManagers(), SecureRandom.getInstance("SHA1PRNG"));

return sslContext.getSocketFactory();
} catch (Exception e) {
throw new UnexpectedException(e.getMessage(), e);
}
}

The following approaches were tried to resolve the issue which apparently
proved useless.
1.  Imported the Braintree API X509 certificate into wso2carbon.jks and to
client-truststore.jks.
2.  Imported the same into cacerts (jre\lib\security\cacerts)file when using
Java SDK 1.6.
3.  Tried installing OpenJDK 1.6 and ran the ESB using it. The connector
worked fine.
4.  Tried extracting the downloaded JC

Re: [Dev] [ESB] Problems sending numeric keys in JSON Payloads

2014-08-13 Thread Jay
Hi Malaka,

My initial payload is as follows:




Janaka
Desc
open
A
LKR
114520







In script I'm adding some additional parameters (value and tags.tags should
be send as array even if there are only one) to above payload as:

**

This will work properly if user send tags in request. But my problem is if
user doesn't send tags parameter "tags" element will remove from payload and
 is applying to value element and it will send as array
which back end will not accept. I have two options,
[1]. Remove  from payload if user doesn't send any tags
[2]. Add PIs in Script mediator  other than in payloadFactory.

What is your idea to solve this problem?

Regards,
Janaka 



--
View this message in context: 
http://wso2-oxygen-tank.10903.n7.nabble.com/ESB-Problems-sending-numeric-keys-in-JSON-Payloads-tp99789p101325.html
Sent from the WSO2 Development mailing list archive at Nabble.com.
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [ESB] Problems sending numeric keys in JSON Payloads

2014-08-12 Thread Jay
Hi Malaka,

Following is my configuration with inline script mediator: 


http://ws.apache.org/ns/synapse";>





TestTag

Janaka






**
 





















--
View this message in context: 
http://wso2-oxygen-tank.10903.n7.nabble.com/ESB-Problems-sending-numeric-keys-in-JSON-Payloads-tp99789p101262.html
Sent from the WSO2 Development mailing list archive at Nabble.com.
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [ESB] Problems sending numeric keys in JSON Payloads

2014-08-11 Thread Jay
Hi Malaka, 

I have already tried this solution and this will work only if we declared
 in payloadFactory mediator. But if i set 
in script mediator it will ignore. Following is my complete config:






TestTag

Janaka







 







And the output:

[2014-08-12 12:17:41,485]  INFO - LogMediator To:
/services/ClevertimCRM_createOpportunity, MessageID: urn:uuid:73a98f19
-1a7e-4fbe-ba68-2ef530419845, Direction: request, Envelope: http://schemas.xmlsoap.org/soap/envelope/";>Tes
tTagJanakaTestTag

[2014-08-12 12:17:41,486]  INFO - LogMediator To:
/services/ClevertimCRM_createOpportunity, MessageID: urn:uuid:73a98f19
-1a7e-4fbe-ba68-2ef530419845, Direction: request, Janaka =
{"tags":["TestTag"],"name":"Janaka","scriptArray":"TestTag"}

I need to send "scriptArray" also as an array.

Regards,
Janaka



--
View this message in context: 
http://wso2-oxygen-tank.10903.n7.nabble.com/ESB-Problems-sending-numeric-keys-in-JSON-Payloads-tp99789p101240.html
Sent from the WSO2 Development mailing list archive at Nabble.com.
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [ESB] Problems sending numeric keys in JSON Payloads

2014-07-24 Thread Jay
Hi Malaka,

I tried with this and still having a problem.

var
a=TestTag;

Output:

"jsonObject":{"tags":"TestTag"}

Regards,
Janaka


On Thu, Jul 24, 2014 at 5:50 PM, Malaka Silva [via WSO2 Oxygen Tank] <
ml-node+s10903n100231...@n7.nabble.com> wrote:

> Hi,
>
> Try following
>
> var tagElement=
> TestTag;
>
>
>
> On Wed, Jul 23, 2014 at 1:52 PM, Jay <[hidden email]
> <http://user/SendEmail.jtp?type=node&node=100231&i=0>> wrote:
>
>> Hi Malaka,
>>
>> I have tried with your solution but it didn't work.
>>
>> following is my javascript code:
>>
>> var
>>
>> tagElement=TestTag;
>>
>> payloadXML.tags=tagElement;
>>
>> This will create JSON payload as :
>>
>> {"tags":"TestTag"}
>>
>> But the requirement is:
>>  {"tags":["TestTag"]}
>>
>> I have enabled following message builder/formatter as well,
>>
>> >
>> class="org.apache.synapse.commons.json.JsonFormatter"/>
>> >
>> class="org.apache.synapse.commons.json.JsonBuilder"/>
>>
>> Regards,
>> Janaka
>>
>>
>>
>> --
>> View this message in context:
>> http://wso2-oxygen-tank.10903.n7.nabble.com/ESB-Problems-sending-numeric-keys-in-JSON-Payloads-tp99789p11.html
>> Sent from the WSO2 Development mailing list archive at Nabble.com.
>> ___
>> Dev mailing list
>> [hidden email] <http://user/SendEmail.jtp?type=node&node=100231&i=1>
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>
>
>
> --
>
> Best Regards,
>
> Malaka Silva
> Senior Tech Lead
> M: +94 777 219 791
> Tel : 94 11 214 5345
> Fax :94 11 2145300
> Skype : malaka.sampath.silva
> LinkedIn : http://www.linkedin.com/pub/malaka-silva/6/33/77
> Blog : http://mrmalakasilva.blogspot.com/
>
> WSO2, Inc.
> lean . enterprise . middleware
> http://www.wso2.com/
> http://www.wso2.com/about/team/malaka-silva/
> <http://wso2.com/about/team/malaka-silva/>
>
> Save a tree -Conserve nature & Save the world for your future. Print this
> email only if it is absolutely necessary.
>
> ___
> Dev mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=100231&i=2>
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
> --
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://wso2-oxygen-tank.10903.n7.nabble.com/ESB-Problems-sending-numeric-keys-in-JSON-Payloads-tp99789p100231.html
>  To unsubscribe from [ESB] Problems sending numeric keys in JSON Payloads, 
> click
> here
> <http://wso2-oxygen-tank.10903.n7.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=99789&code=amFuYWthLm4ucmFuYXRodW5nYUBnbWFpbC5jb218OTk3ODl8MTg3OTc3NTUwOA==>
> .
> NAML
> <http://wso2-oxygen-tank.10903.n7.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>



-- 
 *Janaka Ranathunga* * Senior Software Engineer*
  Tel: +94 11 256 9150  | Mobile: +94 71 168 3232
 janaka.n.ranathu...@gmail.com
<https://www.facebook.com/janaka.n.ranathunga>
<http://lk.linkedin.com/in/janakaranathunga>
<https://plus.google.com/+janakaranathunga>




--
View this message in context: 
http://wso2-oxygen-tank.10903.n7.nabble.com/ESB-Problems-sending-numeric-keys-in-JSON-Payloads-tp99789p100277.html
Sent from the WSO2 Development mailing list archive at Nabble.com.___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [ESB] Problems sending numeric keys in JSON Payloads

2014-07-23 Thread Jay
Hi Malaka,

I have tried with your solution but it didn't work. 

following is my javascript code:

var
tagElement=TestTag;

payloadXML.tags=tagElement;

This will create JSON payload as : 

{"tags":"TestTag"}

But the requirement is:
 {"tags":["TestTag"]}

I have enabled following message builder/formatter as well,




Regards,
Janaka



--
View this message in context: 
http://wso2-oxygen-tank.10903.n7.nabble.com/ESB-Problems-sending-numeric-keys-in-JSON-Payloads-tp99789p11.html
Sent from the WSO2 Development mailing list archive at Nabble.com.
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [ESB] Problems sending numeric keys in JSON Payloads

2014-07-21 Thread Jay
Hi,

I am calling an endpoint which requires sending numeric keys in objects in
the following format:
{"1" : "some value"}

However, when processing this using a script mediator, the numeric key is
converted in to a primitive number as follows:
{1 : "some value"}

which is not accepted by the script mediator when setting the payload using
setPayloadJSON. 

This problem can also be seen when sending numeric values (not keys).
Although the values are numeric, the backend does not accept these values if
they are not sent as strings. e.g. {"key":"123"} is converted to {"key":123}
which is not accepted.


I managed to circumvent this problem by processing the payload via XML:

payloadXML = mc.getPayloadXML();
var customFields = 
mc.getProperty("uri.var.customFields");

var jsonObj = 
eval("("+customFields+")");
var customFieldsTag = ;
for(var key in  jsonObj){
var val = jsonObj[key];
customFieldsTag.cf +=
<_JsonReader_PD_{key}>{val};
}

payloadXML.cf = customFieldsTag;

mc.setPayloadXML(payloadXML);

However, when processing the payload via XML, when there is only one element
within a JSON array, e.g. {"jsonaray" : ["some value"]}

this is processed as a single value (not within an array) and sent by the
XML processor as {"jsonarray" : "some value"}

Furthermore, when sending an empty value within a JSON array (which is
required by the backend) and processing using XML, e.g. {"jsonarray" :
["some value", ""]}, the empty value is converted to *null*, which is not
accepted by the backend. 


I would appreciate if someone could give me a solution to either;
* Send numeric keys and values as strings within a JSON payload without them
being processed in to numeric primitives.
* Send a single value within a JSON array without it being reprocessed as a
single key value pair by the XML-to-JSON processor. 


Thanks,




--
View this message in context: 
http://wso2-oxygen-tank.10903.n7.nabble.com/ESB-Problems-sending-numeric-keys-in-JSON-Payloads-tp99789.html
Sent from the WSO2 Development mailing list archive at Nabble.com.
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Newbie

2014-03-11 Thread Jay Parikh
Hello Everyone,

My name is Jay Parikh and i am doing MS-IT at DA-IICT India. From the last
couple of months i was wondering about the buzz words like RESTFULL API,
WEB-SERVICES, SOA, Platform independent services.

So, i was looking for gsoc project and here i landed on WSO2 by reading
initial WSO2 Enterprise service bus documentation
*https://docs.wso2.org/display/ESB481/WSO2+Enterprise+Service+Bus+Documentation
<https://docs.wso2.org/display/ESB481/WSO2+Enterprise+Service+Bus+Documentation>*
which arose my curiosity to know more about Middle-ware.

By the way i have sound experience in developing application using java and
python.

Coming back to the point i would like to contribute in this project so
could anyone help to mark a demarcation as how could i start to contribute
in this project?

Any kind of help would extremely appreciated.

Thanks,
Jay
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Handling Optional Parameter Issue in LinkedIn Connector

2014-02-18 Thread Jay
Hi,

We are currently developing an ESB connector for Linkedin API, and having an
issue in handling optional parameters for one of the API calls.  I have
mentioned the reference for the API call below.

http://developer.linkedin.com/documents/company-search#

This method is having seven optional parameters and four of them which are
mentioned below, do not have default values.

•   facet
•   start
•   count
•   sort

The problem we are facing is that, if those parameters with no default
values are appended to the url, but values are not sent, then the API gives
a validation error. Therefore we need to check whether the user has passed a
value to a particular parameter (Which do not have a default value) and then
form the endpoint accordingly. 

   
  
 
   
  
   
 
  
   

If we follow the aforementioned methodology, we will have to use sixteen
filters to filter out the optional parameters with no default values and
form the endpoint accordingly. With sixteen filters, the synapse file will
become bulky. Is there an alternative way to handle this issue?

Thank you.  




--
View this message in context: 
http://wso2-oxygen-tank.10903.n7.nabble.com/Handling-Optional-Parameter-Issue-in-LinkedIn-Connector-tp92339.html
Sent from the WSO2 Development mailing list archive at Nabble.com.
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Encode Url in ESB

2014-02-17 Thread Jay
Hi Dushan,

My Endpoint is REST. If we define EP in header it will send as a SOAP
request and LinkedIn didn't accept the request.

I tried with following code also,



  



   

In above case "jsonObject" is appending to endpoint. Then API is reject the
request.

[2014-02-17 12:37:59,094] DEBUG - wire << "GET
/v1/people/jsonObject?accessToken=AQW_v8EhR0VLEkXeIgHYtK2t6bPevlIZJUwli7v
L8tz1SVerzEH5l2i3eXHPPXkPv9ebr5cb_rQvxp36t7xaPQKunY7kwA_NOXRW0z1OXqz63apjElBe3w45XKBsvkzZLnUbQ0M4NZY2gNxuguPhx7Pe7bWz3xY
SssVEm7EfKpg8b6ilmL4&apiUrl=https://api.linkedin.com&publicUrl=http://www.linkedin.com/pub/-XXX/87/998/9


My endpoint URL should be as follows;

/v1/people/url=http%3a%2f%2fwww.linkedin.com%2fpub%2f
X-XXX%2f87%2f998%2f935?oauth2_access_token=AQVEsZcqb4H57C2qOxErr6YiAnHBLXCtsmgszGpW8_hqMNcnuBYjbitzQEP41r
Mc60hPu4ESjbmmd4KacrDzZOMUPEx90_9lkHwXZysUL2jkNqkVkekDgwby9KIXNx8EACwYzj7dzjjLQ-sZxe8sp_0t0n7ZAe2vw2HxuO43QpGhCAaSawA&fo
rmat=json

Thanks,
Janaka
 



--
View this message in context: 
http://wso2-oxygen-tank.10903.n7.nabble.com/Encode-Url-in-ESB-tp92179p92270.html
Sent from the WSO2 Development mailing list archive at Nabble.com.
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Encode Url in ESB

2014-02-16 Thread Jay
Hi Dushan,

LinkedIn API required URL encoded value, such as;

http://www.linkedin.com/pub/X-/87/998/935 should to be encoded in to 

http%3A%2F%2Fwww.linkedin.com%2Fpub%2FX-%2F87%2F998%2F935.

But if we use fn:base64Encode(), value is encoded in to 

"aHR0cDovL3d3dy5saW5rZWRpbi5jb20vcHViL3dzbzJjb25uZWN0b3ItYW
JkZXJhLzg3Lzk5OC85MzU%3D". 

this value is not accept by LinkedIn api.

Thanks,






--
View this message in context: 
http://wso2-oxygen-tank.10903.n7.nabble.com/Encode-Url-in-ESB-tp92179p92255.html
Sent from the WSO2 Development mailing list archive at Nabble.com.
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Encode Url in ESB

2014-02-13 Thread Jay
Hi,

I need to pass an Url encoded value
(Ex:http://www.linkedin.com/pub/-/87/998/935) to an endpoint as a
part of the Url.

I am using following synapse template;

http://ws.apache.org/ns/synapse";>
 
  

   

   


   


   

   


   




encoded url should be assigned to "uri.var.publicUrl".

My problem is after encoding Url using script mediator, in call mediator Url
is encoding again.

Following is my script mediator;


This is the result after calling script mediator:
"http%3a%2f%2fwww.linkedin.com%2fpub%2f-%2f87%2f998%2f935"
When calling End point "%" characters in above url is encode again and
result is
"http%253a%252f%252fwww.linkedin.com%252fpub%252f-%252f87%252f998%252f935%253"


Is there any way to prevent encode url in end point? Or any way to encode
url in call mediator itself?


Thanks. 



--
View this message in context: 
http://wso2-oxygen-tank.10903.n7.nabble.com/Encode-Url-in-ESB-tp92179.html
Sent from the WSO2 Development mailing list archive at Nabble.com.
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev