Home > Net >  Xamarin reference Webservice problem, compile ok, run time error
Xamarin reference Webservice problem, compile ok, run time error

Time:10-10

Web Services is to use their own do release to test the content of the

using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. The Web;
Using System. Web. Services;

The namespace WebApplication3
{
///& lt; Summary>
///WebService1 summary description
///& lt;/summary>
[WebService (Namespace="http://tempuri.org/")]
[WebServiceBinding (ConformsTo=WsiProfiles. BasicProfile1_1)]
[System.Com ponentModel ToolboxItem (false)]
//to allow the use of ASP.NET AJAX calls the Web service from the script, please uncomment the following line,
///System. Web. Script. Services. ScriptService]
Public class WebService1: System. Web. Services. WebService
{

[the WebMethod]
Public string HelloWorld ()
{
Return "Hello World".
}
}
}



Cs file will automatically be parse Xamarin Reference Reference.
Invoke the web service code for
WebService1. WebService1SoapClient client=new WebService1. WebService1SoapClient (WebService1SoapClient. EndpointConfiguration. WebService1Soap);
Var x=await client. HelloWorldAsync ();
Each time to var x=await client. HelloWorldAsync (); The
Will jump to the Reference. The cs file this
The public System. The Threading. Tasks. Task HelloWorldAsync ()
{
WebServices1. HelloWorldRequest inValue=https://bbs.csdn.net/topics/new WebServices1. HelloWorldRequest ();
InValue. Body=new WebServices1. HelloWorldRequestBody ();
Return ((WebServices1 WebService1Soap) (this)). HelloWorldAsync (inValue);
}
And then jump to the

[System.Com ponentModel EditorBrowsableAttribute (System.Com ponentModel. EditorBrowsableState. Advanced)]
System. The Threading. Tasks. Task WebServices1. WebService1Soap. HelloWorldAsync (WebServices1 HelloWorldRequest request)
{
Return to base. Channel. HelloWorldAsync (request);/////an error in the
}
Then go to the side is an error, submitted to the System. Xml. XmlException: Element 'HelloWorldAsyncResponse' with the namespace name 'http://tempuri.org/' was not found. The Line 1, position 218. Mistakes, this is automatically generated Reference. The cs file has a problem

CodePudding user response:

Is a day, the bird problem card or no clue, various methods are tried or useless, I look at their online examples have been parsed into asynchronous writing, so I don't know what to do this

CodePudding user response:

Recommend you to do with WebAPI, because asmx may not support,

CodePudding user response:

Because the soap protocol,
  • Related