• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 252
  • Last Modified:

How to use display message in a web service

I have a web service that I call to write out a pdf file.  I am trying to check the value of the file name and path I am passing.  I am using response.write, but do not see anything being displayed in the browser.  I know it is hitting it, because the next line of code after this is executed.  See my code snippet below.
HttpContext.Current.Response.Write("File Name:" + " " +psFileName)

Open in new window

0
66chawger
Asked:
66chawger
  • 2
1 Solution
 
ShazbotOKCommented:
WebServices do not use the Response object...
I would either set a return value or have the webservice take a out string parameter that you can set that debug check to...
0
 
66chawgerAuthor Commented:
ok, look at my code below.  How would I code the return of the value in my user control.  

I have examples of the code calling the web service and the code executed in the web service...see below.  I need to see show or pass back what psFileName looks like in the webservice.  Thanks

User Control calls webservice method as follows:
 
SafecoService.CreatePDFApplication(@"D:\inetpub\wwwroot\data\SafecoPersonalAuto\"+psQuoteID+".pdf",bytes);
 
This is what the method looks like in the web service:
public static void CreatePDFFile(string psFileName,byte[] byteData)
{
FileStream Fs=File.Create(psFileName);
BinaryWriter BW=new BinaryWriter(Fs);
BW.Write(byteData);
BW.Close();
Fs.Close();
}

Open in new window

0
 
bmcvicarCommented:
66chawger,

Give this a shot- it will return a string containing the text "File Name:" and the filename you supplied.
public string CreatePDFFile(string psFileName,byte[] byteData)
{
FileStream Fs=File.Create(psFileName);
BinaryWriter BW=new BinaryWriter(Fs);
BW.Write(byteData);
BW.Close();
Fs.Close();
return "File Name:" + " " +psFileName
}

Open in new window

0
 
66chawgerAuthor Commented:
This was probably another item any debugging web services has encountered.  The solution given was so obvious and fits right in with how you call methods in a web service and return values.
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now