I've created a proxy to tweet using WSO2 ESB Twitter connector. My Tweet proxy looks like this.
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="Tweet" startOnLoad="true" trace="disable"
transports="http https" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<property expression="json-eval($.message)" name="Tweet"
scope="default" type="STRING"/>
<twitter.init>
<consumerKey>xxxxxxxxxx</consumerKey>
<consumerSecret>xxxxxxxxxxxx</consumerSecret>
<accessToken>xxxxxxxxxxxxx</accessToken>
<accessTokenSecret>xxxxxxxxxx</accessTokenSecret>
</twitter.init>
<twitter.updateStatus>
<status>{$ctx:Tweet}</status>
</twitter.updateStatus>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
</proxy>
The project was deployed without any errors but when ever i make a POST request to Tweet from Postman im getting an error status of 170 with a message Missing required parameter: status.
The Post request consist of a json like this.
{"Content-Type":"application/json","payload":"{\"message\":\"Hellow WSO2 ESB!!!! #WSO2 #Test\"}"}
In the ESB sever console it gives an error like this
ERROR - SynapseJsonPath #stringValueOf. Error evaluating JSON Path <$.message>. Returning empty result. Error>>> invalid path
Any particular reason why im getting this error?. How to overcome this?.
Change the property expression like this.
expression="json-eval($.payload.message)"
Related
I'm trying to send a SOAP request to the Loqate services following their API documentation found here.
The documentation says the SOAP end point is
https://api.addressy.com/Capture/Interactive/Find/v1.1/wsdlnew.ws
and the sample request is:
<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Find
xmlns="http://api.addressy.com/">
<Key>AA11-AA11-AA11-AA11</Key>
<Text>wr5 3da</Text>
<IsMiddleware>True</IsMiddleware>
<Container>GB|RM|ENG|3DA-WR5</Container>
<Origin>52.182,-2.222</Origin>
<Countries>GB,US,CA</Countries>
<Limit>10</Limit>
<Language />
<Bias />
<Filters />
<GeoFence />
</Find>
</soap:Body>
</soap:Envelope>
So I load up Postman and make these steps, following the Postman guide from their blog.
When I send the request, I just get back this page . I'm not sure why it's not working.
How can I make a SOAP request to this API? What am I missing?
That's not the service endpoint, it's an address where you can get the WSDL. Inside that WSDL you will find the service endpoint:
<soap:address location="http://services.postcodeanywhere.co.uk/Capture/Interactive/Find/v1.10/soapnew.ws"/>
Send your request there. The endpoint is over http, but the https seems to be working on the same address: https://services.postcodeanywhere.co.uk/Capture/Interactive/Find/v1.10/soapnew.ws
One other thing. If you want a more specific client than Postman, you could try SoapUI.
I am calling one mule flow from another using HTTP with basic authentication using the Spring Security Manager. I am using Mule 3.7 and configured everything according to the documentation at:
https://docs.mulesoft.com/mule-user-guide/v/3.7/configuring-the-spring-security-manager
<spring:beans>
<ss:authentication-manager alias="authenticationManager">
<ss:authentication-provider>
<ss:user-service id="userService">
<ss:user name="${security.user.id}" password="${security.user.password}" authorities="ROLE_ADMIN" />
</ss:user-service>
</ss:authentication-provider>
</ss:authentication-manager>
</spring:beans>
<mule-ss:security-manager>
<mule-ss:delegate-security-provider name="memory-dao" delegate-ref="authenticationManager" />
</mule-ss:security-manager>
<http:listener-config name="httpLocalListener" host="${local.host}" port="${local.port}"
basePath="${local.path}" doc:name="HTTP Local Listener" connectionIdleTimeout="${local.timeout}"/>
<http:request-config name="httpLocalRequest" doc:name="HTTP Local Configuration" responseTimeout="${local.timeout}"
basePath="${local.path}" host="${local.host}" port="${local.port}">
<http:basic-authentication username="${security.user.id}" password="${security.user.password}"/>
</http:request-config>
<flow name="ServiceFlow1" processingStrategy="synchronous">
<http:listener config-ref="httpLocalListener" path="/status/*" doc:name="HTTP" allowedMethods="GET"/>
<http:basic-security-filter realm="${security.filter.realm}"/>
<!-- Omitted code -->
<http:request config-ref="httpLocalRequest" path="/ping/txt?siteId=#[sessionVars['siteId']]" method="GET" doc:name="HTTP" parseResponse="false">
<http:success-status-code-validator values="0..599"/>
</http:request>
</flow>
<flow name="ServiceFlow2" processingStrategy="synchronous">
<http:listener config-ref="httpLocalListener" path="/ping/txt" doc:name="HTTP" allowedMethods="GET"/>
<http:basic-security-filter realm="${security.filter.realm}"/>
<!-- Omitted code -->
</flow>
I get the following error (I removed '//' from http links due to stackoverflow requirements):
ERROR 2016-08-19 10:28:09,539 [[Service].httpLocalListener.worker.02]
org.mule.exception.DefaultMessagingExceptionStrategy:
Message : Registered authentication is set to org.mule.transport.http.filters.HttpBasicAuthenticationFilter but there was no security context on the session. Authentication denied on endpoint http:0.0.0.0:8081/services/ping/txt. Message payload is of type: NullPayload
Type : org.mule.api.security.UnauthorisedException
Code : MULE_ERROR--2
JavaDoc : http:www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/security/UnauthorisedException.html
Payload : {NullPayload}
Exception stack is:
1. Registered authentication is set to org.mule.transport.http.filters.HttpBasicAuthenticationFilter but there was no security context on the session. Authentication denied on endpoint http:0.0.0.0:8081/services/ping/txt. Message payload is of type: NullPayload (org.mule.api.security.UnauthorisedException)
org.mule.transport.http.filters.HttpBasicAuthenticationFilter:156 (http:www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/security/UnauthorisedException.html)
Any help would be appreciated!
Thanks,
Dennis
I had the same kind of issue once, but that issue disappeared when I invoked the same URL from Postman where we hit the service along with credentials for basic authentication. The same doesn't work with a normal browser based test because when you invoke the service, it expects the credentials for the basic authentication and then given a pop-up for the same in next instance.
HTTPs basic auth using Postman Client
AM not sure whether this helps or not because my explanation is a bit immature, but might help you get a better idea on the implementation. only thing I can say is, it will throw an error but will work as desired.
In (CEP) WSO2 Adaptor login and password have to be write like this:
<?xml version="1.0" encoding="UTF-8"?>
<outputEventAdaptor name="WSO2_Adaptor" statistics="disable"
trace="disable" type="wso2event" xmlns="http://wso2.org/carbon/eventadaptormanager">
<property name="username">admin</property>
<property name="receiverURL">tcp://localhost:7611</property>
<property name="password">admin</property>
<property name="authenticatorURL">ssl://localhost:7711</property>
</outputEventAdaptor>
Is it possible to encode login and password and instead of admin/admin write encoded params, for example MD5 or something else?
This is not supported out of the box in CEP 3.1.0. But this is available in the upcoming 4.0.0 release (which will be released soon) where all the password fields are encrypted by default [1].
[1] https://wso2.org/jira/browse/CEP-1018
I am trying to create an invoice in QB for windows. Here is the XML:
<?xml version='1.0' encoding='utf-8'?>
<Add xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.intuit.com/sb/cdm/v2" xsi:schemaLocation="http://www.intuit.com/sb/cdm/V2./RestDataFilter.xsd " RequestId="1836474224e142c9ad9b7dd6cb0eaa41" FullResponse="true">
<OfferingId>ipp</OfferingId>
<ExternalRealmId>596059545</ExternalRealmId>
<Invoice>
<Header>
<TxnDate>2013-01-30</TxnDate>
<DiscountAmt>0</DiscountAmt>
<ARAccountName>Sales - Support and Maintenance</ARAccountName>
<DiscountAccountName>Discounts/Refunds</DiscountAccountName>
<DueDate>2013-02-17</DueDate>
<Currency>USD</Currency>
<CustomerId>4</CustomerId>
</Header>
<Line>
<Qty>1</Qty>
<UnitPrice>7.00</UnitPrice>
<Desc>Follow-up Test, Instant for Person138-Org3 Person138-Org3</Desc>
</Line>
</Invoice>
</Add>
Here's the response:
-2001: cvc-complex-type.2.4.a: Invalid content was found starting with element 'ARAccountName'. One of '{"http://www.intuit.com/sb/cdm/v2":DiscountAccountId, "http://www.intuit.com/sb/cdm/v2":DiscountAccountName, "http://www.intuit.com/sb/cdm/v2":DiscountTaxable, "http://www.intuit.com/sb/cdm/v2":TxnId}' is expected.
I don't understand, as I already have DiscountAccountName specified. I also tried to go with something more like the create example (same as above but with ARAccountName and DiscountAccountName removed) and got a similar response. Thanks in advance for your help.
The Intuit XML requests are validated by an XSD, and with XML validated by XSDs the order of the tags you provide matters.
That means that if the documentation (https://ipp.developer.intuit.com/0010_Intuit_Partner_Platform/0050_Data_Services/0500_QuickBooks_Windows/0600_Object_Reference/Invoice) dictates that ARAccountName comes before DiscountAmt, then you must put ARAccountName before DiscountAmt.
Switch the order of your XML tags to match the order shown in the docs, and you'll be all set.
So I'm trying to set up a YQL table using the API at http://www.teamliquid.net/video/streams/?filter=live&xml=1 but having some issues.
Here's my table definition:
<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author>TL.net</author>
<description>TL.net's streams</description>
<documentationURL>none</documentationURL>
<sampleQuery>select * from {table}</sampleQuery>
</meta>
<bindings>
<select itemPath="streamlist" produces="XML">
<urls>
<url>http://www.teamliquid.net/video/streams/?xml=1</url>
</urls>
<inputs>
<key id="filter" type="xs:string" paramType="query" />
</inputs>
</select>
</bindings>
</table>
Running use "store://q5awkFLmEqteFVOTUJbQ6h" as tl; select * from tl where filter="live" yields the following error:
<?xml version="1.0" encoding="UTF-8"?>
<query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng"
yahoo:count="0" yahoo:created="2012-02-13T22:14:48Z" yahoo:lang="en-US">
<diagnostics>
<publiclyCallable>true</publiclyCallable>
<url execution-start-time="1" execution-stop-time="33"
execution-time="32" proxy="DEFAULT"><![CDATA[store://q5awkFLmEqteFVOTUJbQ6h]]></url>
<url execution-start-time="35" execution-stop-time="232"
execution-time="197" http-status-code="406"
http-status-message="Not Acceptable" proxy="DEFAULT"><![CDATA[http://www.teamliquid.net/video/streams/?xml=1&filter=live]]></url>
<user-time>232</user-time>
<service-time>258</service-time>
<build-version>25247</build-version>
</diagnostics>
<results/>
</query>
I really can't figure out why it's not working.
In the debug statements, you can see that YQL is reading from your source URL: http://www.teamliquid.net/video/streams/?xml=1&filter=live, but is receiving back an HTTP 406 Not Acceptable error message.
HTTP 406 is meant to cover cases where the server cannot respond in any of the requested (Accept header) formats. I don't know how that applies in this case, but the teamliquid.net source mentions the following:
gzip encoding is required, please also send a valid User-Agent with the name of your application / site and contact info. This page and the XML are updated every five minutes, please do not poll more frequently than every five minutes or you may risk being IP banned. If you have any questions, please PM R1CH.
I suspect it's one of two things:
The YQL servers are not requesting data in gzip or compressed format
The teamliquid.net servers are blocking YQL