For Programmers: Free Programming Magazines  


Home > Archive > Microsoft Webservices > April 2006 > Web Service method name is not valid









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Web Service method name is not valid
John Smith

2006-04-12, 9:11 am


I'm expiriencing the same proble as it was already described here:

http://weblogs.asp.net/cazzu/archiv...9/22/28616.aspx

and here:

http://www.egilh.com/blog/archive/2006/03/21/2528.aspx

is there some known solution? :(

This is my (ws client) class:

[System.Web.Services.WebServiceBindingAttribute(Name = "MyFuncSoapBinding",
Namespace = http://example.org/)]
public class MyWebService : SoapHttpClientProtocol
{
public XmlDocument validate(string url, XmlDocument xmlDocument)
{
this.Url = url;
object[] results = null;
try
{
results = this.Invoke("validate", new object[] { xmlDocument });
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
return null;
}
return ((XmlDocument)(results[0]));
}

and this is how I use it:

// Load XML
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.PreserveWhitespace = true;
xmlDocument.Load("C:\\request.xml");

// Call ws
MyWebService ccWeb = new MyWebService();
xmlDocument = ccWeb.validate(http://example.org/WS, xmlDocument);
if (xmlDocument != null)
xmlDocument.Save("C:\\response.xml");

This is the error message:

System.ArgumentException: validate Web Service method name is not valid.
at
System.Web.Services.Protocols.SoapHttpClientProtocol.BeforeSerialize(WebRequest
request, String methodName, Object[] parameters)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at MyApp.MyWebService.validate(String url, XmlDocument xmlDocument) in
C:\Documents and Settings\I\My Documents\Visual Studio
2005\Projects\MyApp\MyApp\Form1.cs:line 149


John Smith

2006-04-13, 4:12 am


I've found it. I had to add this line:

[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", Use =
System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle =
System.Web.Services.Protocols.SoapParameterStyle.Bare)]

above this line:

public XmlDocument validate(string url, XmlDocument xmlDocument)

I hope someone will find this useful in the future.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com