Convert MultiPart Message into XML/HL7 using Custom Send Pipeline inside Orchestartion - biztalk

In my Project, I am using custom a send pipeline inside orchestration to convert MultiPart message into HL7 message, so that I can log Raw HL7 message into DB , by the next step in orchestration.
In Custom Pipeline, I used BTAHL7 2.x Assembler, which assembles the Multipart message and converts into XML messgae.
Using the below code in Message Assignment: called the custom pipeline to covert Multipart nessage into XML.
XMLResponse = new System.Xml.XmlDocument();
Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteSendPipeline(
typeof(BTAHL7Schemas.SendPipeline1),MultiPartMsg,XMLResponse);
But the above code throws
error: "Body Schema Missing"
If am successful in the above step, I can easily convert XML into HL7 string.
How can I do this?

Related

Getting junk character while sending encrypted json request to webservice via resttemplate

Requirement : Need to send the encrypted json request to the webservice and service will send the decrypted result back to the client.
Issue : We are using Spring RestTemplate. While sending the encrypted data we are sending junk character to webservice so in webservice we are getting below error.
Servlet.service() for servlet [dispatcherServlet] in context with path [/SpringBootRestApi] threw exception [Request processing failed; nested exception is com.sun.org.apache.xml.internal.security.exceptions.Base64DecodingException: You must initialize the xml-security library correctly before you use it. Call the static method "com.sun.org.apache.xml.internal.security.Init.init();" to do that before you use any functionality from that library.] with root cause

Corda receive attachments from RESTful api

I am building a project using Corda.
I use RESTful api to invoke flows to create and update a state. But how can I upload a pdf file to node using attachment function in Corda?
Any help is appreiciated
If you are using spring servers then use below logic :
create an api that uses the multipart request and include the below
code in it.
msg = proxy.uploadAttachment(new ByteArrayInputStream(getZippedBytes(file))).toString();//msg returns the unique hashid for this attachment.
//getZippedBytes(file)) returns the byte[]
If you're using the built-in webserver, you need to encode the attachment as multipart/form-data and post it to NODE_WEBSERVER_ADDRESS/upload/attachment.
See an example here: https://github.com/corda/samples/blob/release-V3/blacklist/src/main/resources/blacklistWeb/index.html.

spring integration handle exception after splitter

I am new to Spring integration.
If I have a request coming in with batch payload(json array)
and I use splitter to split it into jsonobject,
and then I do validation.
If some of the validation failed and throw exception into error channel.
How can I make a response to client indicating some of the jsObject failed
and some works?
not sure handler at errorChannel gonna help since the validation result comes async into errorChannel.
And if I call the gateway like this, how can I construct a validation Result for the whole payload with validation status for each jsObject inside?
Future<validationResult> r = gateway.send(...)
(gateway just forward the request to following endpoint right away)
You have to take a look into Aggregator EIP: http://www.enterpriseintegrationpatterns.com/patterns/messaging/Aggregator.html, http://docs.spring.io/spring-integration/reference/html/messaging-routing-chapter.html#aggregator.
So, all your objects are send for the validation and their results (good or bad) send to the <aggregator> to build a single validationResult for the reply to that gateway.

ASP.NET Web Service validating incoming XML

I have ASP.NET 4 Web Service (asmx). I use IXmlSerializable interface for manually serialization/deserialization. In the function ReadXml (part of IXmlSerializable) I use functin XmlReader.ReadString and if client send me invalidate XML this function throw exception. How I validate incoming XMl before deserialization? Because exception is very hard operation for perfomance.
put the deserializatin in a try catch block and handle exception in catch. there is no point in validating xml upfront as it might through an exception when you attempt to validate as well.

Access wrapped request web method from web service in asp.net

I have a web service method taking multiple parameters.
Therefor the BodyStyle = WebMessageBodyStyle.Wrapped is set.
I want to access this method from a web service client therefor I did add the url of the service method to Reference->Add Services and I get the following error.
"There was an error downloading 'http://localhost:8080/Api/StoreI'.
The request failed with HTTP status 405: Method Not Allowed.
Metadata contains a reference that cannot be resolved: 'http://localhost:8080/Api/StoreI'.
The content type application/json of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8).
If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly.
The first 323 bytes of the response were: '{"ErrorCode":110,"ErrorDetails":null,"Message":"The incoming message has an unexpected message format 'Raw'. The expected message formats for the operation are 'Xml', 'Json'.
This can be because a WebContentTypeMapper has not been configured on the binding. See the documentation of WebContentTypeMapper for more details."}'.
The remote server returned an error: (500) Internal Server Error.
If the service is defined in the current solution, try building the solution and adding the service reference again."
What should I do in order to resolve this error?
What are the steps to access a secure web service from a client?
I an new to web services.
A reply would be highly appreciated.
Thanks.
I am not expert but change
BodyStyle = WebMessageBodyStyle.Wrapped
to
BodyStyle = WebMessageBodyStyle.Bare
The usage of the wrapped on the operation description does not add a layer of security on the message body. It simply wraps the request (or the response) in an XML element

Resources