2011-04-23 8 views

답변

3

음, 웹 서비스가 어떨까요에 대한 더 많은 단서를 제공 할 수 있습니다. asmx, wcf, php, java입니까? wsdl이 있습니까? 아니면 REST를 사용하고 있습니까?

어쨌든 wsdl이 있으면 웹 참조를 추가하고 사용해야하기 때문에 몇 가지 가정을합니다. 자신의 업 로더를 작성해야하는 경우 예를 들어 WebClient 클래스를 사용하여 웹 서비스에 데이터를 푸시 할 수 있습니다.

// I assume you have the image into a stream called imageStream 
// and that you provide your url into the serviceUri variable 

WebClient client = new WebClient(); 

//here you indicate what to do when the stream is opened 
client.OpenWriteCompleted += (sender, e) => 
{ 
    //now write the data 
    //in e.Result you have the destination stream 

    byte[] buffer = new byte[32768]; 
    int readCount; 

    while ((readCount = imageStream.Read(buffer, 0, buffer.Length)) != 0) 
    { 
    e.Result.Write(buffer, 0, readCount); 
    } 
    e.Result.Close(); 
    imageStream.Close(); 
}; 

//and here the call that starts your async operation 
client.OpenWriteAsync(serviceUri); 
+0

죄송합니다. 꽤 많이 나는 텍스트 파일을 업로드하고 다운로드하고있다. 프로세스가 상대적으로 동일합니까? – loyalpenguin

+0

@loyalpenguin 예, 스트림을 작성하고 스트리밍하는 텍스트 파일 인 경우 변경되지 않지만 웹 서비스의 수행 방법에 따라 다릅니다. GET 또는 POST와 함께 작동합니까? – jmservera

+0

나는 그것을 작동시켰다. 또한 제공하는 스크립트는 다른 부분에 유용합니다. 시간 내 줘서 고마워. – loyalpenguin

관련 문제