Search code examples
.netweb-servicesnamespaceswsdlasmx

WSDL for namespace still using "tempuri.org"


We are in the middle of migrating our site from SP2007 to SP2010. Contained in our solution is a Web Service that is contained in an .ASMX file. I understand we should be using WCF, but we do not have the time to convert this web service to use that and this project was inherited from a former developer at the company so we are still trying to understand the architecture of this code.

The issue we have come across is that we are getting a warning when we invoke the service stating "This web service is using http://tempuri.org/ as its default namespace."

Screenshot showing error when invoking web service

We have already changed the namespace property in our definition of the web service as shown below:

[WebService(Namespace = "http://localhost")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class searchService : WebService
{
    [WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public resultWrapper search(string query)
    {
        ....
    }
}

However, when we view the WSDL for our web service we get the following:

<wsdl:definitions targetNamespace="http://tempuri.org"><wsdl:types/><wsdl:service 
name="search"/></wsdl:definitions>

We have already retracted the original solution, performed a 'clean solution' operation and redeployed the solution, but nothing has worked so far. We don't know what we need to do in order to force the WSDL to update itself based on the namespace we provided in the Web Service Definition, or if there is another place we need to modify a setting for the WSDL information to update.


Solution

  • So another developer on our team has resolved the issue.

    Turns out the codeBehind and the class attribute in our .asmx page needed to be updated in addition to updating the namespace in the .asmx.cs file.

    Basically the codeBehind attributes needed to be pointed to our .asmx.cs file and the Class attribute needed to properly match the namespace and class we were using. It was throwing an error because it was pointed to a SharePoint default namespace and class.