web| Dynamic///<summary>
Invokes the remote WebService method based on the specified information
</summary>
<param name= "url" >webservice http form of address </param>
<param name= "namespace" > the namespace of the WebService to invoke </param>
<param name= "ClassName" > The class name of the WebService to invoke (excluding the namespace prefix) </param>
<param name= "methodname" > The WebService method name to invoke </param>
<param name= "args" > Parameter list </param>
Execution results of <returns>webservice </returns>
<remarks>
If the call fails, the exception is thrown. Please call, properly intercept the exception.
Exception information can occur in two places:
1, the dynamic construction of WebService time, compileassembly failure.
2, webservice itself failed to execute.
</remarks>
<example>
<code>
Object obj = Invokewebservice ("Http://localhost/GSP_WorkflowWebservice/common.asmx", " Genersoft.Platform.Service.Workflow "," Common "," Gettooltype ", New object[]{" 1 "});
</code>
</example>
Private object Invokewebservice (string URL, string @namespace, String classname, String methodname, object[] args)
{
Try
{
System.Net.WebClient WC = new System.Net.WebClient ();
System.IO.Stream Stream = WC. OpenRead (url+ "?) WSDL ");
System.Web.Services.Description.ServiceDescription SD = System.Web.Services.Description.ServiceDescription.Read ( Stream);
System.Web.Services.Description.ServiceDescriptionImporter SDI = new System.Web.Services.Description.ServiceDescriptionImporter ();
Sdi. Addservicedescription (SD, "", "");
System.CodeDom.CodeNamespace cn = new System.CodeDom.CodeNamespace (@namespace);
System.CodeDom.CodeCompileUnit CCU = new System.CodeDom.CodeCompileUnit ();
Ccu. Namespaces.add (CN);
Sdi. Import (CN,CCU);
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.