web stats
Sending Dot Net Web Service message to Mirth - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

View Poll Results: Do you use .Net to send data to Mirth
Yes - HL7 Data 0 0%
Yes - XML 0 0%
Yes - Other 0 0%
No 2 100.00%
Voters: 2. You may not vote on this poll

Reply
 
Thread Tools Display Modes
  #1  
Old 02-07-2017, 08:46 AM
waldedg waldedg is offline
Mirth Newb
 
Join Date: Feb 2017
Posts: 8
waldedg is on a distinguished road
Default Sending Dot Net Web Service message to Mirth

I am using Mirth 3.4.2.8129 to try and collect data from a .Net application through a web service (really any way that I can...I have tried HTTP as well and all methodes are a big Brick Wall).

Attached are the Web Service Listener and a Sender that I used to test with (btw...it works).

But when I use the .Net app (set up just like this video from 2009) to send to the Listener the Listener fires off, but I see no data in the Message. I have used a sniffer and see that the data is in the message being sent, just as it is when it is sent from within Mirth using the WS Sender.

Any idea what I am doing wrong?

Thanks, Doug
Attached Files
File Type: xml WS Soap Listener.xml (169.4 KB, 17 views)
File Type: xml WS Sender.xml (167.7 KB, 6 views)
Reply With Quote
  #2  
Old 02-07-2017, 09:10 AM
narupley's Avatar
narupley narupley is offline
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,124
narupley is on a distinguished road
Default

Could be differences in the SOAP binding version being used.
__________________
Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

Nicholas Rupley
Work: 949-237-6069
Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


- How do I foo?
- You just bar.
Reply With Quote
  #3  
Old 02-09-2017, 09:47 AM
waldedg waldedg is offline
Mirth Newb
 
Join Date: Feb 2017
Posts: 8
waldedg is on a distinguished road
Default

Found my issue. In the following c# code to send the request the ContentType must be correct:
HttpWebRequest request = HttpWebRequest.Create("http://localhost:8081/services/Mirth") as HttpWebRequest;
request.Method = "POST";
string postData = theXml;
byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(postData);
// \/ \/ This must be correct \/ \/ \/
request.ContentType = "text/xml";
request.ContentLength = byteArray.Length;
Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
WebResponse response = request.GetResponse();
Console.WriteLine(((HttpWebResponse)response).Stat usDescription);
dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();

Then the postData has to be the entire soap message. I wound up sending my data pipe delimited, something like this(where TheReport is the encoded PDF):
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ws="http://ws.connectors.connect.mirth.com/">
<soapenv:Header>
</soapenv:Header>
<soapenv:Body>
<ws:acceptMessage>
<!--Optional:-->
<arg0
xmlns="">
M|654789|Fred Smith|ED|TheReport
</arg0>
</ws:acceptMessage>
</soapenv:Body>
</soapenv:Envelope>
Reply With Quote
Reply

Tags
.net, dot net, mirth, web service, web service listener

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 08:57 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation