I have a wcf restful service that accepts http posts.
I am trying to send this to an orchestration with a rcv message set as XmlDocument. (Since no subscribers where found when set to system.string)
The message is received in the orchestration but the xmldocument is invalid so its not possible to do anything with the data(Im sending a string in the http post). (When I attempt it I get an error that the data at the root level is invalid).
How can I get the http post string into my orchestration? Do I need to add a custom pipelinecomponent that adds xml tags to the string to make it a valid XmlDocument?
My solution:
Created a flat file schema where the string in the http post is added to one line. Added a pipeline with a flat file dissasembler with the schema. Use xpath in orchestration to retrieve the string.
Related
I am using webclient to call 3 different external APIs in parallel using Mono zip. Now, if any error occurs in any of the API call, I have handled it through a common exception handler using ExchangeFilterFunction. Now, I want to know which particular request fails(out of 3 external API calls) ? Is there any way I can identify that? I also want to append the 'input request body' with the exception response I got from the API call. Can I fetch the request body for which the API Fails (in filter itself)?
In the ExchangeFilterFunction you have access to the request. You could "decorate" your request with some identifier and then use it to resolve the client.
You could add some request header to identify the client.
To keep it internal, you could use request attributes of the WebClient and then read it from the request object
webClient.get()
.uri("...")
.attributes((attributes) -> attributes.put("internal_client_id", clientId))
The object required contains a string. When I pass in the string I receive an error. Is there a way to build up an object using XML in a SOAP request. According to my knowledge, SOAP requests have to be in XML format.
I have created an API in WSO2 EI.
API is expecting the requests to be send as JSON.
If it is a malformed JSON which is sent, then I should be able to receive it and make appropriate changes to make it a proper JSON.
Any help is much appreciated.
As we are using json-eval($.) to get the message to property, it is not working for me. What else i could try instead of json-eval to get the message as string.
WSO2 EI has the property force.json.message.validation, which can be used to validate incoming JSON payload. Please refer doc to configure this property in 'passthru-http.properties' file.
Once the property is configured, if there is a malformed JSON payload in the request, the mediation flow will be directed to the fault/error sequence. So, you can define the mediation logic to make appropriate changes to the malformed content within the fault sequence of your API.
I am using Mule Cache scope to save JSON data (converted to string) retrieved from a REST call. All works fine locally but when deployed to the server which is clustered I get this error.
com.hazelcast.nio.serialization.HazelcastSerializationException: java.io.NotSerializableException: com.rabbitmq.client.impl.ChannelN
Not sure why it is trying to serialize rabbitmq channelN.
When cache scope includes any Rest calls (i.e HTTP Request configurations) , make sure you have Dataweave or Byte array to String or Object to String to make it as consumable payload. Because HTTP request configuration output will be "grizzly Bufferinputstream" which is not consumable payload and its not serializable
I'm creating a silverlight-based email system, I use WCF to read emails, then I pass my data to SL app, I've used following codes in another test web project to save a byte array into a file on client system (email attachments), it works fine, but when I want to use them in my WCF (myservice.svc.cs), I get this error: "The name 'Response' does not exist in the current context", what is going wrong here? is it possible to use Response object in a service?
Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}", messages[i].Attachments[j].FileName));
Response.BinaryWrite(messages[i].Attachments[j].FileData);
how can I save my attachments?
No, you typically would not use an HttpResponse object in WCF (though I am not 100% sure if you could use it in REST services or not). If you want to send a file to the client, you'll need to implement a service operation that returns a byte array or a file stream. This post might help you with that.