Problem:
Method to eliminate 'This web service is using http://tempuri.org/ as its default namespace' message.
Resolution:
In .Net use a Class Attribute to specify the Namespace that the WebService is in.
Example code (changes are highlighted with MFTECH in cols 1-6) to set this is:-
$set sourceformat"variable"
class-id. Service1 as "Service1"
inherits CLASS-WEBSERVICE.
environment division.
configuration section.
repository.
interface INTERFACE-ICONTAINER as "System.ComponentModel.IContainer"
class CLASS-STRING as "System.String"
class CLASS-WEBMETHODATTRIBUTE as "System.Web.Services.WebMethodAttribute"
class CLASS-WEBSERVICE as "System.Web.Services.WebService"
mftech class attr-WebService as "System.Web.Services.WebServiceAttribute"
.
mftech class-attributes.
mftech*> Define custom attributes on the class...
mftech*> The webservice attribute has a named parameter to supply
mftech*> the description and Namespace.
mftech custom-attribute is attr-webservice("Namespace"="http://microfocus.com/webservices"
mftech ,"Description"="Micro Focus Example Web Service")
mftech .
static.
end static.
object.
working-storage section.
01 components object reference INTERFACE-ICONTAINER.
method-id. NEW.
procedure division.
invoke self "InitializeComponent".
end method NEW.
* Required method for Designer support - do not modify
* the contents of this method with the code editor.
method-id. "InitializeComponent" is private.
local-storage section.
procedure division.
end method "InitializeComponent".
* Clean up any resources being used.
method-id. "Dispose" override is protected.
local-storage section.
linkage section.
01 disposing usage condition-value.
procedure division using by value disposing.
if disposing then
if components not = null then
invoke components "Dispose"
end-if
end-if.
invoke super "Dispose" using by value disposing.
end method "Dispose".
* WEB SERVICE EXAMPLE
* The "HelloWorld" example service returns the string Hello World
* To build, uncomment the following lines then save and build the project
* To test this web service, press F5
method-id. "HelloWorld" custom-attribute is CLASS-WEBMETHODATTRIBUTE.
linkage section.
01 lnkReturnString object reference CLASS-STRING.
procedure division returning lnkReturnString.
set lnkReturnString to "Hello World".
end method "HelloWorld".
end object.
end class Service1.