how to set response code 500 in azure api policy in definition.
I want to handle soap error in outbound policy of API management.
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>5</faultcode>
<faultstring>Session expired. Try to relogin.</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
You can do it like this to set response code with 500:
Related
Is there a way to make a presigned aws upload URL return a json response if there is a error rather then a xml response.
Currently it returns something like the following if the url is expired.
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>AccessDenied</Code>
<Message>Request has expired</Message>
<X-Amz-Expires>900</X-Amz-Expires>
<Expires>2020-02-06T20:13:39Z</Expires>
<ServerTime>2020-02-06T20:26:33Z</ServerTime>
<RequestId>2A23445454569</RequestId>
<HostId>oi3j4o5ij346?3464556756567/5675685745yfghr5y4/456345345=</HostId>
</Error>
Would be nice if this was a json response instead.
No, there is no way. It is not specific to pre-signed-url endpoints but S3 doesn't return json but xml.
According to Error Responses documentation of s3;
REST Error Responses
When an error occurs, the header information contains the following:
Content-Type: application/xml
An appropriate 3xx, 4xx, or 5xx HTTP status code
Also you may check list of available methods from here, as it can be seen they are all XML.
I am a new with twilio.
I am trying to make a call using CallResource.Create(to, from, url: _url);
regarding the URL : I have the Azure account. I have uploaded custom xml.
Below you can find my xml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="alice">Thanks for trying our documentation.Enjoy!</Say>
<Play>http://demo.twilio.com/docs/classic.mp3</Play>
</Response>
For testing i am using test message.
http://demo.twilio.com/docs/classic.mp3 , in the future i am planning to upload custom mp3 file also to azure file storage.
The end URL is
https://xxxx.file.core.windows.net/xxxxx/20180719112627.xml?sv=2017-11-09&ss=bfqt&srt=sco&sp=rwdlacup&se=2018-07-31T18:27:28Z&st=2018-07-01T10:27:28Z&spr=https,http&sig=gNqLuAofhePeOzuyVFWHSb0TCydgIW3ShOrRRfFEZ7o%3D
Unfortunately, i have got the exception:
"An attempt to retrieve content from https://xxxxxxx.file.core.windows.net/xxxxxxx/20180719112627.xml?sv=2016-05-31&sig=Pa4ery3QIruwYbNSJ1Nu7Y3EpKLjbd5mJXi46vnpoyU%3D&spr=https%2Chttp&se=2019-07-19T09%3A26%3A53Z&srt=sco&ss=bfqt&sp=raupwl returned the HTTP status code 405"
<?xml version="1.0" encoding="utf-8"?>
<Error>
<Code>UnsupportedHttpVerb</Code>
<Message>The resource doesn't support specified Http Verb.
RequestId:907409a8-d01a-0051-1c43-1f4bf1000000
Time:2018-07-19T09:30:41.8204847Z</Message>
</Error>
Rerarding CORS for FILE SERVICE :
it is
Is there a document/guide describing the requirements how to configure the azure environment for integration with twilio?
Many thanks for help.
Have you tried using the SAS url by generating one using Storage Explorer or Azure Portal?
How can I customize a SOAP error message in ColdFusion? Most languages like PHP, Java, .NET etc. have this capability. While I've seen this question asked on other sites, none of the threads contained an answer. If this isn't possible, I think Adobe should add a patch to support this feature.
Here is an example of the SOAP error in ColdFusion:
SOAP Request:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
</soapenv:Body>
</soapenv:Envelope>
SOAP Response:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server.userException</faultcode>
<faultstring>java.lang.Exception: Body not found.</faultstring>
<detail>
<ns1:stackTrace xmlns:ns1="http://xml.apache.org/axis/">java.lang.Exception: Body not found.
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:121)
...</ns1:stackTrace>
<ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">Coldfusion Error</ns2:hostname>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
In other languages you can customize the error message like so:
SOAP Response:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<soapenv:Fault>
<faultcode>BODY_NOT_FOUND</faultcode>
<faultstring>Body is missing in your request</faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
But I haven't found a way to achieve this in ColdFusion. We are planning to upgrade to ColdFusion 11. Does ColdFusion 11 (or below) have a way to do this?
I would need to know how the application is generating and receiving requests to begin with. With ColdFusion, to create a request, you would start by creating the SOAP Packet you want to send:
<cfsavecontent variable = "variable name">
<XML></XML>
</cfsavecontent>
Next, use CFHTTP to send your SOAP request out:
https://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7ffc.html
When your response comes back and you have assigned it to a variable (set up in your CFHTTP request) you can use this response variable to determine how to parse the response. So for example, you might use XMLParse or XMLSearch to find the elements and process them.
See:
https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-by-category/xml-functions.html
Note that special configuration might be required if network protocols are to be observed - for instance, SSLv3/TLS. Consult your network administrator to determine if any configuration of ColdFusion needs to be done to support network architecture. Also validate that your endpoints can see each other through any firewalls. For more connection information consult either the ColdFusion documentation or threads relevant to your situation such as:
Does cfhttp for coldfusion 10 only supports up to TLS 1.0?
I have a http service exposed in WSO2. The service address is "http://172.30.60.73:8888/XMPPService/recieveMsg?param=yes", and the response is "notifyresult=000000".But
in WSO2, The log output is : <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><axis2ns7:binary xmlns:axis2ns7="http://ws.apache.org/commons/ns/payload">bm90aWZ5cmVzdWx0PTAwMDAwMDENCg==</axis2ns7:binary></soapenv:Body></soapenv:Envelope>
I use script mediator:
var symbol=mc.getPayloadXML().toString();
var response=symbol.substring(13,symbol.length)
mc.setPayloadXML(<p:createGroupResponse xmlns:p="http://iag.sdp.coship.com/xmpp/"><notifyresult>{ response }</notifyresult></p:createGroupResponse>);
And the client side is:
<p:createGroupResponse xmlns:p="http://iag.sdp.coship.com/xmpp/">
<notifyresult>Wx0PTAwMDAwMDENCg==</notifyresult>
</p:createGroupResponse>
Seems the response is binary. How to convert this response to "notifyresult=000000". Anyone can help me? Thank you very much.
By default ESB uses the passthrough transport in version 4.6.0.In passthrough we dont build the message..Can you switch to NIO transport and check? Edit the axis2.xml , transport listener, sender fro NIO transport
I'm transforming XML request to SOAP via XSLT in WSO2ESB, just wondering is it possible to make request parameter available to be used in response?
E.g.
<request>
<test>123</test>
<param1>testing</param1>
</request>
-> converted to SOAP
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">#S:Body><ns2:testrequest xmlns:ns2="http://xml.testing.com/test"><teststring>testing</teststring></ns2:testrequest></S:Body></S:Envelope></soapenv:Body></soapenv:Envelope>
In the response
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:testresponse xmlns:ns2="http://xml.testing.com/test"><responsestring>success</responsestring></ns2:testresponse></S:Body></S:Envelope></soapenv:Body></soapenv:Envelope>
I want to return in XML
<responsestring>
<test>123</test>
<return1>success</return1>
</responsestring>
As you see, 123 isn't send to the server and has not received from the server. However, client is sending this parameter and i would like to just use this parameter in request and send back in response, is this possible? By how? I'm very new to synapse and very new to WSO2ESB, could anyone please enlighten me?
Thanks.
Yes it is possible. You can use property mediator in the Insequence to set the required value as a property and then add it in the outsequence to response using enrich mediator.
Got it working now.
Simply by adding the property mediator in both insequence and outsequence together with the XSLT, where the xslt is trying to get the value from test property. That's it!
Insequence
<property xmlns:ns="http://org.apache.synapse/xsd" name="TEST" expression="//request/*[local-name()=test]" scope="default"/>
outsequence
<xslt key="xxxx.xslt">
<property name="test" expression="get-property('TEST')"/>
</xslt>