conflit dans le type Stream
bonjour, j'ai cree un web service qui contient une methode avec deux parametre un"string" et un "Stream",
et quand je l'appél dans mon application , je donne les deux parametre a la methode et j'ai un message d'erreur comme quoi il y a un conflit entre
"nom_du_webservice.Stream et le System.io.Stream"
je comprend pas prk il considere nom_du_webservice.Stream comme un type !!
voici mon code :
web service :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
public Service () {
//Supprimez les marques de commentaire dans la ligne suivante si vous utilisez des composants conçus
//InitializeComponent();
}
[WebMethod]
public void SavePcmToWav(string name, System.IO.Stream rawData)
{
FileStream output;
output = File.Create(@"d:\nouv\"+name+".wav");
BinaryWriter bwOutput = new BinaryWriter(output);
// Write down the WAV header.
// Refer to http://technology.niagarac.on.ca/courses/ctec1631/WavFileFormat.html
// for details on the format.
// Note that we use ToCharArray() when writing fixed strings
// to force using the char[] overload because
// Write(string) writes the string prefixed by its length.
// -- RIFF chunk
bwOutput.Write("RIFF".ToCharArray());
// Total Length Of Package To Follow
// Computed as data length plus the header length without the data
// we have written so far and this data (44 - 4 ("RIFF") - 4 (this data))
bwOutput.Write((uint)(rawData.Length + 36));
bwOutput.Write("WAVE".ToCharArray());
// -- FORMAT chunk
bwOutput.Write("fmt ".ToCharArray());
// Length Of FORMAT Chunk (Binary, always 0x10)
bwOutput.Write((uint)0x10);
// Always 0x01
bwOutput.Write((ushort)0x01);
// -- DATA chunk
bwOutput.Write("data".ToCharArray());
// Length Of Data To Follow
bwOutput.Write((uint)rawData.Length);
// Raw PCM data follows...
// Reset position in rawData and remember its origin position
// to restore at the end.
long originalRawDataStreamPosition = rawData.Position;
rawData.Seek(0, SeekOrigin.Begin);
// Append all data from rawData stream into output stream.
byte[] buffer = new byte[4096];
int read; // number of bytes read in one iteration
while ((read = rawData.Read(buffer, 0, 4096)) > 0)
{
bwOutput.Write(buffer, 0, read);
}
rawData.Seek(originalRawDataStreamPosition, SeekOrigin.Begin);
}
} |
là ou j'appél le web service :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
.
.
.
.
ServiceSoapClient save_wave = new ServiceSoapClient();
System.IO.Stream my_stream = _sink.BackingStream;
// voila ou il y a l'erreur il souligne en rouge tout ça en bas
save_wave.SavePcmToWavAsync("kkkk", my_stream); |
merci
Cdt