简体   繁体   English

具有服务参考的C#SOAP没有显示实际响应

[英]c# SOAP with service reference is not showing real response

I'm creating an UWP app, that needs to connect to asmx service. 我正在创建一个UWP应用,该应用需要连接到asmx服务。 I've done that by using service reference, which works with TempConvert but not with my asmx service 我已经通过使用服务引用来做到这一点,该服务引用可用于TempConvert,但不适用于我的asmx服务

This is how my code looks like 这就是我的代码的样子

HelpdeskSoapClient HPsoapClient = new HelpdeskSoapClient();
getIncInput input = new getIncInput();

input.username = "450";
getIncResponse realresponse;
realresponse= await HPsoapClient.getIncAsync(input);

Debug.Write(realresponse);

but response is not an XML file or something else, but "DTS.helpdesk.getIncResponse" Any clues ? 但是响应不是XML文件或其他文件,而是“ DTS.helpdesk.getIncResponse”任何线索?

getIncResponse is the object that is returned by the service when you make the call. getIncResponse是您在调用时由服务返回的对象。

When you pass realResponse into the Debug.Write , since it's an object, the base functionality of ToString() is called, which unless overridden in the object will return the fully qualified type name - ie, DTS.helpdesk.getIncResponse . 当您将realResponse传递给Debug.Write ,因为它是一个对象,所以会调用ToString()的基本功能,除非该对象中的DTS.helpdesk.getIncResponse被重写,否则它将返回完全限定的类型名称-即DTS.helpdesk.getIncResponse

You should be able to access the properties of the object to get the data, similar to how you set the username on the getIncInput object ( input.username = "450"; ). 您应该能够访问对象的属性以获取数据,类似于在getIncInput对象上设置usernamegetIncInputinput.username = "450"; )。

The temperature conversion service worked because it returns a simple type ( string ), not a complex type ( getIncResponse ). 温度转换服务之所以起作用,是因为它返回的是简单类型( string ),而不是复杂类型( getIncResponse )。 There is no error here. 这里没有错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM