web service & soap

oscarina

New Member
I have a simple web service with one function that calculates a value between two numbers (a+b). When i load the .asmx file some code of how to use soap for my service is generated.<BR>Can someone please tell me how to use this soap. If i just paste the soap request in a xml a error is generated already in the first line of the generated code:<BR><BR>POST /testiranje1/hello2.asmx HTTP/1.1<BR>Host: martin<BR>Content-Type: text/xml; charset=utf-8<BR>Content-Length: length<BR>SOAPAction: "http://tempuri.org/krneki2"<BR><BR><?xml version="1.0" encoding="utf-8"?><BR><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/"><BR> <soap:Body><BR> <krneki2 xmlns="http://tempuri.org/"><BR> <a>int</a><BR> <b>int</b><BR> </krneki2><BR> </soap:Body><BR></soap:Envelope><BR><BR>what do i have to do exactly with this code.<BR><BR>Are you wanting to use dhtml remoting, or at runtime?remotehttp://msdn.microsoft.com/library/default.asp?url=/workshop/author/webservice/using.asp<BR><BR>If your users are using IE 5+ then Microsoft WebService Behavior is nice.<BR><BR>Here's my example of passing data from the page to a web method and returning in integer on a timer:<BR><BR><script language="jscript"><BR> //setTimeout('myRefresh()',30000)<BR> function myRefresh(){<BR> init();<BR> setTimeout('myRefresh()',30000)<BR> }<BR> </script><BR> <script language="javascript"><BR> var iCallID;<BR> function init(){<BR> Service.useService("myservice.asmx?WSDL","myserv");<BR> iCallID = Service.myserv.callService(checksrc, "mymethod", window.Form1.one.value, window.Form1.two.value,window.Form1.three.value,wi ndow.Form1.four.value);<BR> }<BR> function checksrc(result){<BR> if(result.error)<BR> {<BR> var xfaultcode = result.errorDetail.code;<BR> var xfaultstring = result.errorDetail.string;<BR> var xfaultsoap = result.errorDetail.raw;<BR> alert("Code: " + xfaultcode);<BR> alert("String: " + xfaultstring);<BR> alert("Soap: " + xfaultsoap);<BR> // Add code to handle specific error codes here<BR> }<BR> // if there was no error<BR> else<BR> {<BR> <BR> // Check to see if it needs refreshing<BR> if(result.value =http://aspmessageboard.com/archive/index.php/= 1){<BR> window.Form1.submit();<BR> }<BR> if(result.value == 2){<BR> goframe('/directory/dirc/file.aspx?id=<%=request("id")%>','header');<BR> window.Form1.submit();<BR> }<BR> if(result.value == 3){<BR> goframe('/dir/otherdir/newfile.aspx?id=<%=request("id")%>','other');<BR> window.Form1.submit();<BR> }<BR> if(result.value == 0){<BR> }<BR> }<BR>}<BR> </script><BR> </HEAD><BR> <body MS_POSITIONING="GridLayout" style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 1px; PADDING-TOP: 0px"><BR> <form id="Form1" method="post" runat="server"><BR> <div id="Service" style="BEHAVIOR: url(../scripts/WebService.htc)"></div>
 
Back
Top