Click here to Skip to main content
15,891,316 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: different ValueField and TextField for a dropdownlist Pin
haleemasher10-Aug-09 19:19
haleemasher10-Aug-09 19:19 
GeneralRe: different ValueField and TextField for a dropdownlist Pin
Viral Upadhyay10-Aug-09 19:25
Viral Upadhyay10-Aug-09 19:25 
QuestionConfermation Message in asp.net Pin
Dushan12310-Aug-09 17:58
Dushan12310-Aug-09 17:58 
AnswerRe: Confermation Message in asp.net Pin
Suresh Suthar10-Aug-09 18:10
professionalSuresh Suthar10-Aug-09 18:10 
AnswerRe: Confermation Message in asp.net Pin
Parwej Ahamad10-Aug-09 18:10
professionalParwej Ahamad10-Aug-09 18:10 
AnswerRe: Confermation Message in asp.net Pin
Dushan12310-Aug-09 18:38
Dushan12310-Aug-09 18:38 
GeneralRe: Confermation Message in asp.net Pin
Abhijit Jana10-Aug-09 18:52
professionalAbhijit Jana10-Aug-09 18:52 
QuestionSoapException was unhandled by user code Pin
NewToAspDotNet10-Aug-09 7:41
NewToAspDotNet10-Aug-09 7:41 
Dear friends,

i wrote a asp.net webservice using vs 2008 .net framework 3.5. this service runs over https.

it gets the parameters from the client and sends this to another application and then the answer from that application back to the client.

It works sometimes fine, bud sometimes im getting this exception:

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Net.WebException: The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF
at System.Net.HttpWebRequest.GetResponse()
at WebService2.Service1.HttpSOAPRequest(String xmlfile, String proxy) in C:\Documents and Settings\BB\My Documents\Visual Studio 2008\Projects\WebService2\WebService2\Service1.asmx.cs:line 44
at WebService2.Service1.CardWithPerson(String persId, String projectId, String username, String pw) in C:\Documents and Settings\BB\My Documents\Visual Studio 2008\Projects\WebService2\WebService2\Service1.asmx.cs:line 82
--- End of inner exception stack trace ---

Here is some code of the webservice:
[WebMethod]   
        public String CardWithPerson(string persId, string projectId, string username, string pw)   
        {   
            xmlfile = "<?xml version=\"1.0\" encoding=\"utf-8\" ?> "  
            + "<soap:Envelope xmlns:soap=\"http://www.w3.org/2001/12/soap-envelope\">"  
            +"<soap:Body>"  
            +"<PS_CardsWithPersonReq xmlns=\"http://tempuri.org\">"  
           +"<WebAuthenticate>"  
            +" <WebUser>"+username+"</WebUser>"  
            +" <WebPass>"+pw+"</WebPass>"  
            +" <WebIp>"+Context.Request.UserHostAddress+"</WebIp>"  
            +" <WebMd>0123456789ABCDEF0123</WebMd>"  
            +" </WebAuthenticate>"  
            +"<PersNr>"+persId+"</PersNr>"  
            +"<Lang>E</Lang>"  
            +"<ProjCode>"+projectId+"</ProjCode>"  
            +"</PS_CardsWithPersonReq>"  
            +"</soap:Body>"  
            +"</soap:Envelope>";   
            r = HttpSOAPRequest(xmlfile, null);   
            result = r.ReadToEnd();   
            return result;   
        }   
  
StreamReader HttpSOAPRequest(String xmlfile, string proxy)   
        {   
            XmlDocument doc = new XmlDocument();   
            doc.LoadXml(xmlfile);   
               
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://211.144.244.244:7871");   
            if (proxy != null) req.Proxy = new WebProxy(proxy, true);   
            req.Headers.Add("SOAPAction", "\"\"");   
            req.ContentType = "text/xml;charset=\"utf-8\"";   
            req.Accept = "text/xml";   
            req.Method = "POST";   
            Stream stm = req.GetRequestStream();   
            doc.Save(stm);   
            stm.Close();   
            WebResponse resp = req.GetResponse();   
            stm = resp.GetResponseStream();   
            StreamReader strmReader = new StreamReader(stm);   
            return strmReader;   
        }  


Here the code of the client side:

protected void Button1_Click(object sender, EventArgs e)   
        {   
            nl.test.testsoap.Service1 serv = new WebApplication1.nl.test.testsoap.Service1();   
  
            Response.Write(serv.CardWithPerson(textPersId.Text, txtProCode.Text, username, pw));   
            Response.End();   
        }  


Can anyone help me with this issue?



Thanks
AnswerRe: SoapException was unhandled by user code Pin
Leonardo Muzzi10-Aug-09 8:46
Leonardo Muzzi10-Aug-09 8:46 
AnswerRe: SoapException was unhandled by user code Pin
Gayani Devapriya10-Aug-09 16:50
Gayani Devapriya10-Aug-09 16:50 
GeneralRe: SoapException was unhandled by user code Pin
NewToAspDotNet10-Aug-09 21:38
NewToAspDotNet10-Aug-09 21:38 
AnswerRe: SoapException was unhandled by user code Pin
NewToAspDotNet10-Aug-09 22:21
NewToAspDotNet10-Aug-09 22:21 
Questionplease reply me Pin
amarnath n.n10-Aug-09 6:36
amarnath n.n10-Aug-09 6:36 
AnswerRe: please reply me Pin
Blikkies10-Aug-09 6:50
professionalBlikkies10-Aug-09 6:50 
AnswerRe: please reply me Pin
Abhijit Jana10-Aug-09 6:51
professionalAbhijit Jana10-Aug-09 6:51 
AnswerRe: please reply me Pin
Not Active10-Aug-09 8:41
mentorNot Active10-Aug-09 8:41 
QuestionWindows Media Player Control!! Pin
Sr...Frank10-Aug-09 5:06
Sr...Frank10-Aug-09 5:06 
AnswerRe: Windows Media Player Control!! Pin
Manas Bhardwaj10-Aug-09 5:21
professionalManas Bhardwaj10-Aug-09 5:21 
Questionproblem insertin into an access database using vb2005 Pin
busteronline10-Aug-09 5:01
busteronline10-Aug-09 5:01 
QuestionCatch page reload caused by extensions Pin
AHeavey10-Aug-09 4:40
AHeavey10-Aug-09 4:40 
QuestionSearch array with pattern in Javascript Pin
anish27patel10-Aug-09 3:57
anish27patel10-Aug-09 3:57 
AnswerRe: Search array with pattern in Javascript Pin
Manas Bhardwaj10-Aug-09 5:36
professionalManas Bhardwaj10-Aug-09 5:36 
GeneralRe: Search array with pattern in Javascript Pin
anish27patel10-Aug-09 22:18
anish27patel10-Aug-09 22:18 
Questionpageindex change capture the dataitems display Pin
Member 387988110-Aug-09 2:45
Member 387988110-Aug-09 2:45 
QuestionUrgent ! Asp.net routing is not working on remote server Pin
visukk10-Aug-09 2:14
visukk10-Aug-09 2:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.