Wednesday, March 28, 2012
Web Service
I need to create a webservice for weather report
so how can i create the WSDl file to consume the weather
please help me out
Thanks and Regards
Sathish ReddyWhere is the weather report web service?
Monday, March 26, 2012
Web service client side proxy class problem
I have found examples and solutions to this, but all that I have found need to modify the proxy class generated in VS.NET. The problem I have is I can't find the proxy class to modify it. I am using VS.NET 2005 August CTP.
Thanks
Hello.
I must warn you that I haven't played much with web services.
is the consumer an asp.net app? if it is, then if i'm not mistaken, when you add a reference to the web service, you'll get the wsdl file inside the app_webreferences folder which will be compiled into a dll. so, if you need to have the classe so that you can change (by using inheritance, for instance), you can allways use the wsdl tool to generate the cs file (command prompt). then just add the cs file to the app_code folder to use it from the pages.
Web Service exits on file close
StreamWriter, TextWrtier or FileStream. This is inefficient because the Web Service has to be reloaded on every function call. Also Static or Public Shared variables become useless.
Sample code below.
Dim Success As StreamWriter = File.AppendText(CurDir + User + "_Success.Log")
Success.AutoFlush = True
Success.WriteLine(Record + ", " + DateTime.Now())
Success.Flush()
Success.Close()The file your writing to needs to be located in the App_Data folder.
The file your writing to needs to be located in the App_Data folder.
The file your writing to needs to be located in the App_Data folder.
The file your writing to needs to be located in the App_Data folder.
The file your writing to needs to be located in the App_Data folder.
The file your writing to needs to be located in the App_Data folder.
The file your writing to needs to be located in the App_Data folder.
The file your writing to needs to be located in the App_Data folder.
The file your writing to needs to be located in the App_Data folder.
The file you write to has to be located in the App_Data folder.
The file you write to has to be located in the App_Data folder.
The file you write to has to be located in the App_Data folder.
The file you write to has to be located in the App_Data folder.
The file you write to has to be located in the App_Data folder.
The file you write to has to be located in the App_Data folder.
Saturday, March 24, 2012
Web service Impersonatation?
password I get strange results. This line of code will get me the user
account I set to impersonate:
System.Security.Principal.WindowsIdentity.GetCurrent().Name
This line of code will get me my user account ever time:
System.Threading.Thread.CurrentPrincipal.Identity.Name
What's the difference? shouldn't they both be the user I am trying to
impersonate?
Thanks
Frank Wisniewski MCSE 4.0, MCP+I, A+
f p w 2 3 @dotnet.itags.org. h o t m a i l . c o mFrank,
No, they should not. When you impersonate through the WindowsIdentity
object, it does not change the current principal on the thread. The reason
for this is that you can have different implementations of IPrincipal which
don't necessarily map to windows users and groups. To that end, having
WindowsIdentity change the current thread's principal would be wrong.
Hope this helps.
- Nicholas Paldino [.NET/C# MVP]
- mvp@.spam.guard.caspershouse.com
"Frank Wisniewski" <fpw23@.hotmail.com> wrote in message
news:41b5cf8c$1_2@.mcse.ms...
> When I set up impersonation in the web.config file and specify a user and
> password I get strange results. This line of code will get me the user
> account I set to impersonate:
> System.Security.Principal.WindowsIdentity.GetCurrent().Name
> This line of code will get me my user account ever time:
> System.Threading.Thread.CurrentPrincipal.Identity.Name
> What's the difference? shouldn't they both be the user I am trying to
> impersonate?
> Thanks
>
> Frank Wisniewski MCSE 4.0, MCP+I, A+
> f p w 2 3 @. h o t m a i l . c o m
>
Thanks Nicholas,
But how do you know which Principal is being used by your code. Lets say I
have a routine that writes a file to the local directory, how do I ensure
that code is using my impersonated users rights?
Frank Wisniewski MCSE 4.0, MCP+I, A+
f p w 2 3 @. h o t m a i l . c o m
"Nicholas Paldino [.NET/C# MVP]" <mvp@.spam.guard.caspershouse.com> wrote in
message news:%23GhWBSH3EHA.2676@.TK2MSFTNGP12.phx.gbl...
> Frank,
> No, they should not. When you impersonate through the WindowsIdentity
> object, it does not change the current principal on the thread. The
reason
> for this is that you can have different implementations of IPrincipal
which
> don't necessarily map to windows users and groups. To that end, having
> WindowsIdentity change the current thread's principal would be wrong.
> Hope this helps.
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mvp@.spam.guard.caspershouse.com
> "Frank Wisniewski" <fpw23@.hotmail.com> wrote in message
> news:41b5cf8c$1_2@.mcse.ms...
and
>
is your server trusted for delegation?
"Frank Wisniewski" <fpw23@.hotmail.com> wrote in message
news:41b5cf8c$1_2@.mcse.ms...
> When I set up impersonation in the web.config file and specify a user and
> password I get strange results. This line of code will get me the user
> account I set to impersonate:
> System.Security.Principal.WindowsIdentity.GetCurrent().Name
> This line of code will get me my user account ever time:
> System.Threading.Thread.CurrentPrincipal.Identity.Name
> What's the difference? shouldn't they both be the user I am trying to
> impersonate?
> Thanks
>
> Frank Wisniewski MCSE 4.0, MCP+I, A+
> f p w 2 3 @. h o t m a i l . c o m
>
Frank,
The code will use the rights of whomever the thread is currently running
under. If you always want to base this on the Windows identity, you can
call the static GetCurrent method on the WindowsIdentity type, passing true
for the ifImpersonating parameter.
- Nicholas Paldino [.NET/C# MVP]
- mvp@.spam.guard.caspershouse.com
"Frank Wisniewski" <fpw23@.hotmail.com> wrote in message
news:41b5d307$1_1@.mcse.ms...
> Thanks Nicholas,
> But how do you know which Principal is being used by your code. Lets say
> I
> have a routine that writes a file to the local directory, how do I ensure
> that code is using my impersonated users rights?
> --
> Frank Wisniewski MCSE 4.0, MCP+I, A+
> f p w 2 3 @. h o t m a i l . c o m
> "Nicholas Paldino [.NET/C# MVP]" <mvp@.spam.guard.caspershouse.com> wrote
> in
> message news:%23GhWBSH3EHA.2676@.TK2MSFTNGP12.phx.gbl...
> reason
> which
> and
>
asp.net seperates the thread identity from the authenicated user identity.
when the user is authenicated (not anonymous), your have three options:
1) the thread runs as the asp.net account (default)
2) the thread impersonates the authenication account (must use windows
authenication). set impersonate=true in web config
3) the thread impersonates the account specified in the web config.
you picked the third option, so the CurrentPrincipal is the authenicated
account and WindowsIdentity is the thread identity.
note: CurrentPrincipal is a WindowsIdentity only if windows authenication is
used.
-- bruce (sqlwork.com)
"Frank Wisniewski" <fpw23@.hotmail.com> wrote in message
news:41b5cf8c$1_2@.mcse.ms...
| When I set up impersonation in the web.config file and specify a user and
| password I get strange results. This line of code will get me the user
| account I set to impersonate:
| System.Security.Principal.WindowsIdentity.GetCurrent().Name
|
| This line of code will get me my user account ever time:
|
| System.Threading.Thread.CurrentPrincipal.Identity.Name
|
| What's the difference? shouldn't they both be the user I am trying to
| impersonate?
|
| Thanks
|
|
| Frank Wisniewski MCSE 4.0, MCP+I, A+
| f p w 2 3 @. h o t m a i l . c o m
|
|
I am running it from my local machine which is part of the domain, is that
what you are asking?
Frank Wisniewski MCSE 4.0, MCP+I, A+
f p w 2 3 @. h o t m a i l . c o m
"Consultant" <consultant_mcngp@.yahoodotcom> wrote in message
news:%23KRylVH3EHA.1152@.TK2MSFTNGP14.phx.gbl...
> is your server trusted for delegation?
> "Frank Wisniewski" <fpw23@.hotmail.com> wrote in message
> news:41b5cf8c$1_2@.mcse.ms...
and
>
no, in order for impersonation to work, the server must be trusted for
delegation within active directory
"Frank Wisniewski" <fpw23@.hotmail.com> wrote in message
news:41b5f9bd_1@.mcse.ms...
>I am running it from my local machine which is part of the domain, is that
> what you are asking?
> --
> Frank Wisniewski MCSE 4.0, MCP+I, A+
> f p w 2 3 @. h o t m a i l . c o m
> "Consultant" <consultant_mcngp@.yahoodotcom> wrote in message
> news:%23KRylVH3EHA.1152@.TK2MSFTNGP14.phx.gbl...
> and
>
Web Service Issue
I have a web service in .asmx file and same thing is compiled in .dlls.
If I use .dlls functions in the code, the website works fine at the server.
If I use http://www.mysite.com/service.asmx reference, it works very slow
and loose the connection with the web-service.
So can someone guide me how to make a web-service work faster at remote
end!!
Thanks,
ChotiXD,
Your post is unclear. To set a webreference, you would use Add WebReference
and fill in
http://www.mysite.com/service.asmx?WSDL
the Reference dialog will download the WSDL contract and compile a proxy
class for you, which you can then code against.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"XD" wrote:
Quote:
Originally Posted by
Hello Professionals,
>
I have a web service in .asmx file and same thing is compiled in .dlls.
If I use .dlls functions in the code, the website works fine at the server.
>
If I use http://www.mysite.com/service.asmx reference, it works very slow
and loose the connection with the web-service.
>
So can someone guide me how to make a web-service work faster at remote
end!!
>
Thanks,
Choti
>
>
>
Web Service not working
This file is in wwwroot and gets called fine.
****************************************
******************************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script Language="Javascript">
var iCallID;
function InitializeService()
{
alert("Before useServer");
service.useService("http://localhost/Hello/Service1.asmx?wsdl","HelloService
");
service.HelloService.callService("HelloWorld");
alert("After callService");
}
function ShowResult()
{
alert(event.result.value);
}
</script>
</head>
<body onload="InitializeService()" id="service"
style="behavior:url(webservice.htc)"
onresult="ShowResult">
</body>
</html>
****************************************
********************************
The webservice.htc file is also in wwwroot.
I get the alert statements in InitializeService. But the ShowResult never
gets Called.
I can call this http://localhost/Hello/Service1.asmx?wsdl fine from IE and
it comes up correctly and runs fine.
I have another service with the same problem, what am I missing?
Thanks,
TomCheck the security in your IE. I am not sure which option it is. I have
noticed that sometimes Javascript do not show error message when there is a
security restriction.
--
Vijayakrishna
Software Architect
"tshad" wrote:
> I have a simple Webservice (the infamous Hello program).
> This file is in wwwroot and gets called fine.
> ****************************************
******************************
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> <title>Untitled Document</title>
> <script Language="Javascript">
> var iCallID;
> function InitializeService()
> {
> alert("Before useServer");
> service.useService("http://localhost/Hello/Service1.asmx?wsdl","HelloServi
ce
> ");
> service.HelloService.callService("HelloWorld");
> alert("After callService");
> }
> function ShowResult()
> {
> alert(event.result.value);
> }
> </script>
> </head>
> <body onload="InitializeService()" id="service"
> style="behavior:url(webservice.htc)"
> onresult="ShowResult">
> </body>
> </html>
> ****************************************
********************************
> The webservice.htc file is also in wwwroot.
> I get the alert statements in InitializeService. But the ShowResult never
> gets Called.
> I can call this http://localhost/Hello/Service1.asmx?wsdl fine from IE and
> it comes up correctly and runs fine.
> I have another service with the same problem, what am I missing?
> Thanks,
> Tom
>
>
Web Service not working
This file is in wwwroot and gets called fine.
************************************************** ********************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script Language="Javascript">
var iCallID;
function InitializeService()
{
alert("Before useServer");
service.useService("http://localhost/Hello/Service1.asmx?wsdl","HelloService
");
service.HelloService.callService("HelloWorld");
alert("After callService");
}
function ShowResult()
{
alert(event.result.value);
}
</script>
</head
<body onload="InitializeService()" id="service"
style="behavior:url(webservice.htc)"
onresult="ShowResult"
</body>
</html>
************************************************** **********************
The webservice.htc file is also in wwwroot.
I get the alert statements in InitializeService. But the ShowResult never
gets Called.
I can call this http://localhost/Hello/Service1.asmx?wsdl fine from IE and
it comes up correctly and runs fine.
I have another service with the same problem, what am I missing?
Thanks,
TomCheck the security in your IE. I am not sure which option it is. I have
noticed that sometimes Javascript do not show error message when there is a
security restriction.
--
Vijayakrishna
Software Architect
"tshad" wrote:
> I have a simple Webservice (the infamous Hello program).
> This file is in wwwroot and gets called fine.
> ************************************************** ********************
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> <title>Untitled Document</title>
> <script Language="Javascript">
> var iCallID;
> function InitializeService()
> {
> alert("Before useServer");
> service.useService("http://localhost/Hello/Service1.asmx?wsdl","HelloService
> ");
> service.HelloService.callService("HelloWorld");
> alert("After callService");
> }
> function ShowResult()
> {
> alert(event.result.value);
> }
> </script>
> </head>
> <body onload="InitializeService()" id="service"
> style="behavior:url(webservice.htc)"
> onresult="ShowResult">
> </body>
> </html>
> ************************************************** **********************
> The webservice.htc file is also in wwwroot.
> I get the alert statements in InitializeService. But the ShowResult never
> gets Called.
> I can call this http://localhost/Hello/Service1.asmx?wsdl fine from IE and
> it comes up correctly and runs fine.
> I have another service with the same problem, what am I missing?
> Thanks,
> Tom
>
Web Service Problem
I have written a Web Service which is called from ASPX file(Web Form). It
works fine on the local machine. On the local machine I am using the
following command
wsdl.exe /l:cs http://localhost/ReturnEvents/Service1.asmx?wsdl
Now I want to use the same service on the Remote Server. What I think is
that the
above path should be changed as it is localhost. So I try to do something
like this
wsdl.exe /l:cs http://www.hop.man.ac.uk/ReturnEven...vice1.asmx?wsdl
where www.hop.man.ac.uk is the server where I am trying to host my web service
But it does not compile and throws the following error:
There was an error downloading:
http://www.hop.man.ac.uk/ReturnEven...vice1.asmx?wsdl
The request failed with HTTP status 404: Not Found
I dont know whether I going in a right direction. It works fine on the
client machine
But on the server when I change the path to my server name it throws this
error.I mean we cant use localhost in the wsdl when using Web service on the
REMOTE server. Dont know what to do. Any help would be greatly appreciated.
Cheers,
Sunil SabirCheck your spelling. The 404 error indicates that the requested resource
(URL) was not found.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
"Sunil Sabir" <SunilSabir@.discussions.microsoft.com> wrote in message
news:AC4B5CFD-DFFB-4990-A131-B71795B5ABB5@.microsoft.com...
> Dear All,
> I have written a Web Service which is called from ASPX file(Web Form). It
> works fine on the local machine. On the local machine I am using the
> following command
> wsdl.exe /l:cs http://localhost/ReturnEvents/Service1.asmx?wsdl
> Now I want to use the same service on the Remote Server. What I think is
> that the
> above path should be changed as it is localhost. So I try to do something
> like this
> wsdl.exe /l:cs http://www.hop.man.ac.uk/ReturnEven...vice1.asmx?wsdl
> where www.hop.man.ac.uk is the server where I am trying to host my web
service
> But it does not compile and throws the following error:
> There was an error downloading:
> http://www.hop.man.ac.uk/ReturnEven...vice1.asmx?wsdl
> The request failed with HTTP status 404: Not Found
> I dont know whether I going in a right direction. It works fine on the
> client machine
> But on the server when I change the path to my server name it throws
this
> error.I mean we cant use localhost in the wsdl when using Web service on
the
> REMOTE server. Dont know what to do. Any help would be greatly
appreciated.
> Cheers,
> Sunil Sabir
>
>
web service problem
i create a web service. The File's name is "warning.ascx"
and my part of the codes of webform1.aspx:
in HTML:
<%@dotnet.itags.org. Control ClassName="warning"%
in aspx.cs
private void Button1_Click(object sender, System.EventArgs e)
{
warning warn=(warning)LoadControl("warning.ascx");
warn.WM="hi";
}
when i write warn, after dot(warn.) i can see the WM(attribute)
and i can write whatever i want
But when i start program an error occured:
Parser Error Message:The directive'Control' is unknown
ascx file is ="warning.ascx"
class in this ascx file is=public class warning : System.Web.UI.UserControl
anybody help me?
Thanks1. You're confusing web service and user control. An ascx file defines a user control.
2. In an aspx page, you should have a Page directive, not a Control directive (these are for ascx files)
Web Service Problem
I have written a Web Service which is called from ASPX file(Web Form). It
works fine on the local machine. On the local machine I am using the
following command
wsdl.exe /l:cs http://localhost/ReturnEvents/Service1.asmx?wsdl
Now I want to use the same service on the Remote Server. What I think is
that the
above path should be changed as it is localhost. So I try to do something
like this
wsdl.exe /l:cs http://www.hop.man.ac.uk/ReturnEven...vice1.asmx?wsdl
where www.hop.man.ac.uk is the server where I am trying to host my web servi
ce
But it does not compile and throws the following error:
There was an error downloading:
http://www.hop.man.ac.uk/ReturnEven...vice1.asmx?wsdl
The request failed with HTTP status 404: Not Found
I dont know whether I going in a right direction. It works fine on the
client machine
But on the server when I change the path to my server name it throws this
error.I mean we cant use localhost in the wsdl when using Web service on the
REMOTE server. Dont know what to do. Any help would be greatly appreciated.
Cheers,
Sunil SabirCheck your spelling. The 404 error indicates that the requested resource
(URL) was not found.
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
"Sunil Sabir" <SunilSabir@.discussions.microsoft.com> wrote in message
news:AC4B5CFD-DFFB-4990-A131-B71795B5ABB5@.microsoft.com...
> Dear All,
> I have written a Web Service which is called from ASPX file(Web Form). It
> works fine on the local machine. On the local machine I am using the
> following command
> wsdl.exe /l:cs http://localhost/ReturnEvents/Service1.asmx?wsdl
> Now I want to use the same service on the Remote Server. What I think is
> that the
> above path should be changed as it is localhost. So I try to do something
> like this
> wsdl.exe /l:cs http://www.hop.man.ac.uk/ReturnEven...vice1.asmx?wsdl
> where www.hop.man.ac.uk is the server where I am trying to host my web
service
> But it does not compile and throws the following error:
> There was an error downloading:
> http://www.hop.man.ac.uk/ReturnEven...vice1.asmx?wsdl
> The request failed with HTTP status 404: Not Found
> I dont know whether I going in a right direction. It works fine on the
> client machine
> But on the server when I change the path to my server name it throws
this
> error.I mean we cant use localhost in the wsdl when using Web service on
the
> REMOTE server. Dont know what to do. Any help would be greatly
appreciated.
> Cheers,
> Sunil Sabir
>
>
>
>
Web Service Question
I'm new to web services. I'm writing a basic file maintenance
application in asp.net. For example I'll fill a grid with all the records
from a table, then allow the user to select a record (row) and I'll show the
individual fields of the row in the form. The user can update the fields and
then I'd like to send the fields back through a web service for updating.
I've tried to specify a custom class as the parameter. See the example
below. My problem is that when I specify the class as a paramenterin the
client application I get a compile time error "Value of type
"IdealClass.atyMaint' cannot be converted to
'Ideal.updAccountType.atymaint." Atymaint is the name of my class. I have
this class defined in a project that is separate from my web service project
and my client project. I then reference this class from both the web service
and client projects. See the excerpts below.
From IdealClass project in atyMaint.vb
Public Class atyMaint
Public AMTYP as string
Public AMDESC as string
Public AMPRICE as string
End Class
From client project
dim atymaint as new idealclass.atymaint
atymaint.amtyp = me.txttype.text
atymaint.amdesc = me.txtdesc.text
atymaint.amprice = me.txtprice.text
dimWebservice as new updAccountType.updAccountType
errMsgString = Webservice.updAccountType(atymaint)
From web service project
<WebMethod () > _
Pubic Function updAccountType(ByVal atymaint as IdealClass.atyMaint) as
string
... stuff
End FunctionHiya! :)
I hope I can provide some help for you, but I'm not quite sure of all the
details as I have forgotten all about VB since C# arrived. ;) Anyway, here's
some hints that might get it working..
When using a web reference you have to use the generated proxy class
'Ideal.updAccountType.atymaint' instead of 'IdealClass.atyMaint'. If you
want to do some plumbing, (and repetitive work :P) you can fix this by
clicking "Show all files" in the Solution Explorer, navigate to your web
reference, expand it and it's Reference.map document. Inside you should find
Reference.vb. Comment out the proxy class, and replace all references to
atyMaint with IdealClass.atyMaint. You have to redo this every time you
update the web reference. In addition, you have to specify how
IdealClass.atyMaint should serialize as XML. Add
<System.Xml.Serialization.XmlRoot("atyMaint")> above Public Class atyMaint,
and <System.Xml.Serialization.XmlElement("AMTYP")> above Public AMTYP as
string etc.
There's a nice tool for generating web service proxy classes called wsdl.exe
included in the .net framework you can use to get rid of the update web
reference problem though. You can read more about it here:
http://msdn.microsoft.com/library/d...erviceProxy.asp
There's also a lot more info on web services in the same folder as that
article. ;)
HTH,
Lars-Erik
"benthanger@.online.nospam"
<benthangeronlinenospam@.discussions.microsoft.com> wrote in message
news:8DEFC42E-21E7-4057-B20B-381B319CB478@.microsoft.com...
> Hi there,
> I'm new to web services. I'm writing a basic file maintenance
> application in asp.net. For example I'll fill a grid with all the records
> from a table, then allow the user to select a record (row) and I'll show
> the
> individual fields of the row in the form. The user can update the fields
> and
> then I'd like to send the fields back through a web service for updating.
> I've tried to specify a custom class as the parameter. See the example
> below. My problem is that when I specify the class as a paramenterin the
> client application I get a compile time error "Value of type
> "IdealClass.atyMaint' cannot be converted to
> 'Ideal.updAccountType.atymaint." Atymaint is the name of my class. I
> have
> this class defined in a project that is separate from my web service
> project
> and my client project. I then reference this class from both the web
> service
> and client projects. See the excerpts below.
> From IdealClass project in atyMaint.vb
> Public Class atyMaint
> Public AMTYP as string
> Public AMDESC as string
> Public AMPRICE as string
> End Class
> From client project
> dim atymaint as new idealclass.atymaint
> atymaint.amtyp = me.txttype.text
> atymaint.amdesc = me.txtdesc.text
> atymaint.amprice = me.txtprice.text
> dimWebservice as new updAccountType.updAccountType
> errMsgString = Webservice.updAccountType(atymaint)
> From web service project
> <WebMethod () > _
> Pubic Function updAccountType(ByVal atymaint as IdealClass.atyMaint) as
> string
> ... stuff
> End Function
Thursday, March 22, 2012
Web services
Do I have to configure anything in the IIS or run any other service.
I have also tried adding a web reference to another applcation but when I put address
http://Mathservice/Mathservice.asmx
I get a message "no web services available"What happens if, in VS.Net, you hit F5? That should launch your web browser & list all of the methods of your web service
I get the message
"Unable to start debugging on the server. The server does not supprot debugging etc.
You have IIS installed?
I do have IIS installed and running
Well, you've reached the limit of my experience with web services I'm afraid. You searched MSDN?
Web Service?
Is there a way to Write a file to a stream using a web service? If so How?
Any Help or Suggestions will be greatly appreciated.
Thanks,
ChuckThis is a webmethod that takes a file and convert it back out to a Binary Stream
<WebMethod()> _
Public Function ReadFileToStream() As Byte()
Dim fs As FileStream
Try
' Read file and return contents
Dim serverPath As String = "C:\Inetpub\wwwroot\postinfo.html"
fs = File.Open(serverPath, FileMode.Open, FileAccess.Read)
Dim lngLen As Long = fs.Length
Dim abytBuffer(CInt(lngLen - 1)) As Byte
fs.Read(abytBuffer, 0, CInt(lngLen))
Return abytBuffer
Finally
' Make sure that file stream is
' closed even if an error occurs.
fs.Close()
End Try
End Function
Hope this helps
"Charles A. Lackman" wrote:
> Hello,
> Is there a way to Write a file to a stream using a web service? If so How?
> Any Help or Suggestions will be greatly appreciated.
> Thanks,
> Chuck
>
Hello and Thank you for your response,
I have noticed that when this code is implemented it does not cause the
client computer to open a download dialogbox. I am assuming that I have to
implement code to receive the file then write it to the clients computer.
Is this correct. The Web Service is being called from a Desktop
Application. I am having a struggle trying to implement this.
Client Computer (Desktop Computer)
fs = New IO.FileStream("C:\Me.wma", IO.FileMode.Create, IO.FileAccess.Write)
Dim BW As New IO.BinaryWriter(fs)
Dim leng As Integer = fs.Length
Dim abytBuffer(CInt(leng - 1)) As Byte
fs.Write(abytBuffer, 0, CInt(leng))
' This causes the file to be 0 in length
Dim serverPath As String = "C:\Test1.WMA"
fs = New IO.FileStream(TheService.StartDownload, IO.FileMode.OpenOrCreate)
Dim BW As New IO.BinaryWriter(fs)
Dim AByte() As Byte = TheService.StartDownload() 'Your Code implemented on
the service
Dim AByte1 As Byte
For Each AByte1 In AByte
bw.write(Abyte1)
next
'This Causes the File to write Gigs and Gigs of data to the file Test1.WMA
Thanks again for your assistance,
Chuck
Web Service?
Is there a way to Write a file to a stream using a web service? If so How?
Any Help or Suggestions will be greatly appreciated.
Thanks,
ChuckThis is a webmethod that takes a file and convert it back out to a Binary St
ream
<WebMethod()> _
Public Function ReadFileToStream() As Byte()
Dim fs As FileStream
Try
' Read file and return contents
Dim serverPath As String = "C:\Inetpub\wwwroot\postinfo.html"
fs = File.Open(serverPath, FileMode.Open, FileAccess.Read)
Dim lngLen As Long = fs.Length
Dim abytBuffer(CInt(lngLen - 1)) As Byte
fs.Read(abytBuffer, 0, CInt(lngLen))
Return abytBuffer
Finally
' Make sure that file stream is
' closed even if an error occurs.
fs.Close()
End Try
End Function
Hope this helps
"Charles A. Lackman" wrote:
> Hello,
> Is there a way to Write a file to a stream using a web service? If so How
?
> Any Help or Suggestions will be greatly appreciated.
> Thanks,
> Chuck
>
>
Hello and Thank you for your response,
I have noticed that when this code is implemented it does not cause the
client computer to open a download dialogbox. I am assuming that I have to
implement code to receive the file then write it to the clients computer.
Is this correct. The Web Service is being called from a Desktop
Application. I am having a struggle trying to implement this.
Client Computer (Desktop Computer)
fs = New IO.FileStream("C:\Me.wma", IO.FileMode.Create, IO.FileAccess.Write)
Dim BW As New IO.BinaryWriter(fs)
Dim leng As Integer = fs.Length
Dim abytBuffer(CInt(leng - 1)) As Byte
fs.Write(abytBuffer, 0, CInt(leng))
' This causes the file to be 0 in length
Dim serverPath As String = "C:\Test1.WMA"
fs = New IO.FileStream(TheService.StartDownload, IO.FileMode.OpenOrCreate)
Dim BW As New IO.BinaryWriter(fs)
Dim AByte() As Byte = TheService.StartDownload() 'Your Code implemented on
the service
Dim AByte1 As Byte
For Each AByte1 In AByte
bw.write(Abyte1)
next
'This Causes the File to write Gigs and Gigs of data to the file Test1.WMA
Thanks again for your assistance,
Chuck
Monday, March 12, 2012
Web Services From Other Langs
I've created a webservice using ASP.Net and .Net framework,
I built the web service code, and then a proxy class to produce a .dll file , then I copied this file to the /bin directory...and it should be available to ASP.Net pages..
But my question is, How could I use this DLL in other languages, like php or perl...how could I call a web service method through
the dll proxy class from Non-.Net languages? ??
thanks.:) :confused:you dont.
so, Should I just expose my WSDL file to others, and they should take care of how to call my webservice ?? as they know the actual webservice url and methods from the wsdl ?
Sorry ..misread your post a bit. If the other language supports SOAP then you can reference and use the web service...but you cant use the same wrapper dll that is created when you ref a web service in .NET. Im sure other SOAP implementation have there way of creating 'wrappers' or whatever. You need to refer to whomever makes a SOAP implementatino for other platforms for any more help.
thanks Cander for help,
I installed the SOAP SDK , and I will play with it...
Web Services project
file (e.g. csproj), instead of having it be file based where whatever
happens to be in the directory magically becomes part of the project?
ThanksFrank,
Any project should have a csproj file...
It's usually created in My Documents\Visual Studio 2005\Projects by default.
But if you want more control here's what I do:
I first create a new visual studio project of the type blank solution. To do
this I go to New - Project and then in the New Project window expand the
"Other Projects" node and select Visual Studio Solutions. Then select "Blank
Solution" in the Templates pane name the blank solution whatever you'd like,
set it's location if you don't want to use the default, and click "OK".
Now in the solution explorer you will have a blank solution (with the name
you gave it) with nothing in it. Right click on the Blank Solution and click
"Add - New Website". Select "ASP.NET Web Service" and set the location to
File or HTTP (I prefer HTTP and I use virtual directories so that I can
place the files right into the solution folder.)
The following instructions are for creating a HTTP website using a virtual
directory:
Select "HTTP" in the location drop down.
Select the language for the site.
Click the "Browse" button.
In the window that opens the second icon of a folder in the top right is for
creating a new virtual directory. Click that folder icon.
In the New Virtual Directory window that opens give the directory an
appropriate alias such as: MyWebService and then click the "Browse" button.
Browse to the location you put your blank solution folder in. Enter the
solution folder itself and then click the "Create New Folder" icon. Create a
folder with the same name you gave for the "Alias Name" select that folder
and click "Open".
Now click the "OK" button.
You will now have a new IIS website who's files are all stored inside the
virtual directory folder inside your solution folder.
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Frank Rizzo" <nospam@.nospam.com> wrote in message
news:Oh$qKYQOGHA.1028@.TK2MSFTNGP11.phx.gbl...
> Is there a way to create a web service project that has a proper project
> file (e.g. csproj), instead of having it be file based where whatever
> happens to be in the directory magically becomes part of the project?
> Thanks
Web Services project
file (e.g. csproj), instead of having it be file based where whatever
happens to be in the directory magically becomes part of the project?
ThanksFrank,
Any project should have a csproj file...
It's usually created in My Documents\Visual Studio 2005\Projects by default.
But if you want more control here's what I do:
I first create a new visual studio project of the type blank solution. To do
this I go to New - Project and then in the New Project window expand the
"Other Projects" node and select Visual Studio Solutions. Then select "Blank
Solution" in the Templates pane name the blank solution whatever you'd like,
set it's location if you don't want to use the default, and click "OK".
Now in the solution explorer you will have a blank solution (with the name
you gave it) with nothing in it. Right click on the Blank Solution and click
"Add - New Website". Select "ASP.NET Web Service" and set the location to
File or HTTP (I prefer HTTP and I use virtual directories so that I can
place the files right into the solution folder.)
The following instructions are for creating a HTTP website using a virtual
directory:
Select "HTTP" in the location drop down.
Select the language for the site.
Click the "Browse" button.
In the window that opens the second icon of a folder in the top right is for
creating a new virtual directory. Click that folder icon.
In the New Virtual Directory window that opens give the directory an
appropriate alias such as: MyWebService and then click the "Browse" button.
Browse to the location you put your blank solution folder in. Enter the
solution folder itself and then click the "Create New Folder" icon. Create a
folder with the same name you gave for the "Alias Name" select that folder
and click "Open".
Now click the "OK" button.
You will now have a new IIS website who's files are all stored inside the
virtual directory folder inside your solution folder.
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"Frank Rizzo" <nospam@.nospam.com> wrote in message
news:Oh$qKYQOGHA.1028@.TK2MSFTNGP11.phx.gbl...
> Is there a way to create a web service project that has a proper project
> file (e.g. csproj), instead of having it be file based where whatever
> happens to be in the directory magically becomes part of the project?
> Thanks
Web Services security
2000 Server IIS 5
I have a web service using anonymous access, however I need to be able to
output to a log file.
I've got a log.txt file in the same directory but I keep getting errors when
trying to write to the file, I've tried adjusting the permissions
accordingly but they don't seem to make any difference.
Any suggestions?
Thanks
KevIt's ok I've sorted this now.
Kev
"Mantorok" <mantorok@.mantorok.com> wrote in message
news:e5hnvn$hh4$1@.newsfeed.th.ifl.net...
> Hi
> 2000 Server IIS 5
> I have a web service using anonymous access, however I need to be able to
> output to a log file.
> I've got a log.txt file in the same directory but I keep getting errors
> when trying to write to the file, I've tried adjusting the permissions
> accordingly but they don't seem to make any difference.
> Any suggestions?
> Thanks
> Kev
Web Services security
2000 Server IIS 5
I have a web service using anonymous access, however I need to be able to
output to a log file.
I've got a log.txt file in the same directory but I keep getting errors when
trying to write to the file, I've tried adjusting the permissions
accordingly but they don't seem to make any difference.
Any suggestions?
Thanks
KevIt's ok I've sorted this now.
Kev
"Mantorok" <mantorok@.mantorok.com> wrote in message
news:e5hnvn$hh4$1@.newsfeed.th.ifl.net...
> Hi
> 2000 Server IIS 5
> I have a web service using anonymous access, however I need to be able to
> output to a log file.
> I've got a log.txt file in the same directory but I keep getting errors
> when trying to write to the file, I've tried adjusting the permissions
> accordingly but they don't seem to make any difference.
> Any suggestions?
> Thanks
> Kev
>