Hi this is my first time so i need your help here is my Link of xml soap
here is my c# code kindly where i am doing wrong ?
public string SoapPatientMedication() { string resultXml; WebRequest wbrqst = WebRequest.Create("http://preproduction.newcropaccounts.com/v7/WebServices/Patient.asmx"); HttpWebRequest httpreq = (HttpWebRequest)wbrqst; httpreq.Method = "POST"; httpreq.ContentType = "text/xml charset=utf-8"; httpreq.Headers.Add("SOAPAction","https://secure.newcropaccounts.com/V7/webservices/GetPatientFullMedicationHistory"); httpreq.ProtocolVersion = HttpVersion.Version11; httpreq.Credentials = CredentialCache.DefaultCredentials; Stream requestStream = httpreq.GetRequestStream(); StreamWriter streamWriter = new StreamWriter(requestStream, Encoding.ASCII); StringBuilder sb = new StringBuilder(); sb.Append("<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/'>"); sb.Append("<soap:Body>"); sb.Append("<GetPatientFullMedicationHistory xmlns='https://secure.newcropaccounts.com/V7/webservices'>"); sb.Append("<credentials>"); sb.Append("<PartnerName>demo</PartnerName>"); sb.Append("<Name>demo</Name>"); sb.Append("<Password>demo</Password>"); sb.Append("</credentials>"); sb.Append("<accountRequest>"); sb.Append("<AccountId>demo</AccountId>"); sb.Append("<SiteId>demo</SiteId>"); sb.Append("</accountRequest>"); sb.Append("<patientRequest>"); sb.Append("<PatientId>16</PatientId>"); sb.Append("</patientRequest>"); sb.Append("<prescriptionHistoryRequest>"); sb.Append(" <StartHistory>2004-01-01T00:00:00.000</StartHistory>"); sb.Append("<EndHistory>2012-01-01T00:00:00.000</EndHistory>"); sb.Append("<PrescriptionStatus>C</PrescriptionStatus>"); sb.Append("<PrescriptionSubStatus>%</PrescriptionSubStatus>"); sb.Append("<PrescriptionArchiveStatus>N</PrescriptionArchiveStatus>"); sb.Append("</prescriptionHistoryRequest>"); sb.Append("<patientInformationRequester>"); sb.Append("<UserType>demo</UserType>"); sb.Append("<UserId>demo</UserId>"); sb.Append("</patientInformationRequester>"); sb.Append("</GetPatientFullMedicationHistory>"); sb.Append("</soap:Body>"); sb.Append("</soap:Envelope>"); streamWriter.Write(sb.ToString()); streamWriter.Close(); HttpWebResponse wr = (HttpWebResponse)httpreq.GetResponse(); StreamReader srd = new StreamReader(wr.GetResponseStream()); resultXml = srd.ReadToEnd(); return resultXml; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)