0
비동기 메소드로 웹 서비스를 사용하려고합니다.비동기 결과가 비어 있지만 응답에 데이터가 있습니다.
이 피들러에서public static GetStockResponse GetResult()
{
var client = new ServiceSoapClient();
var inItems = new ArrayOfItemNo();
inItems.Add(new ItemNoRow { ItemNo = "0000001350" });
Task<GetStockResponse> task = client.GetStockAsync(inItems, "034");
task.Wait();
return task.Result;
}
나는 상태 (200)
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body>
<GetStockRequest xmlns="http://www.unikum.se/pws"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<ItemNo>
<ItemNoRow>
<ItemNo>0000001350</ItemNo>
</ItemNoRow>
</ItemNo>
<StoreID>034</StoreID>
</GetStockRequest>
그리고 응답과 함께 전화를 볼 수 있습니다 : 나는 그것이 클라이언트를 생성하는 WSDL이 같은 metod 전화의 사용했다
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body>
<GetStockResponse xmlns="http://www.unikum.se/pws">
<Items>
<Item>
<ItemNo>0000001350</ItemNo>
<DeliveryTimeText>4-6 veckor</DeliveryTimeText>
<DeliveryDays>42</DeliveryDays>
<Stores>
<Store>
<StoreID>034</StoreID>
<NotInERP>N</NotInERP>
<InStockQty>2</InStockQty>
<InShowRoom>N</InShowRoom>
</Store>
</Stores>
</Item>
</Items>
</GetStockResponse>
하지만 작업 결과 (task.Result)가 비어 있습니다. GetStockResponse이지만 모든 값은 null입니다.
왜? 모든 것이 정확하거나 그렇지 않습니까?
동등한 동기 코드가 작동합니까? 'Wait() '호출을 받으면 어쨌든 비동기를 사용하지 않는다는 것에주의하십시오 ... –
아니요. 정규 코드는 다음과 같습니다. var result = client.GetStock (inItems, "034", outItems, out stores, outStores); 그러나 모든 out 매개 변수는 비어 있습니다. 서비스의 응답은 여전히 좋으며 위의 결과와 동일합니다. 필자는 WSDL 정보가 실제로 반환되는 서비스보다 다른 구조를 제공한다는 오류가 발생할 수 있다고 생각합니다. 그것은 내 서비스가 아니지만 가능합니까? 실제 결과에서 WSDL 정보가 존중되지 않게하려면? – Hyzac
아마도 - 확실하지 않습니다. 하지만 동기식 양식이 먼저 작동하게 될 것입니다 ... 아마도 서비스 소유자와 연락을 취할 수 있습니다. –