WebMethod attribute properties
[WebMethod(EnableSession=true,Description="This is Description of Method",CacheDuration=20)]
cachDuration in Second
overloaded
WebMethods in a web service can also be overloaded. Notice that the Add() functions below are overloaded based on the number of parameters.
When we now try to view the service page we get a different exception - Service 'WebServicesDemo.CalculatorWebService' does not conform to WS-I Basic Profile v1.1. Please examine each of the normative statement violations below. To turn off conformance check set the ConformanceClaims property on corresponding WebServiceBinding attribute to WsiClaims.None.
R2304: Operation name overloading in a wsdl:portType is disallowed by the Profile. A wsdl:portType in a DESCRIPTION MUST have operations with distinct values for their name attributes. Note that this requirement applies only to the wsdl:operations within a given wsdl:portType. A wsdl:portType may have wsdl:operations with names that are the same as those found in other wsdl:portTypes.
- Operation 'Add' on portType 'CalculatorWebServiceSoap' from namespace 'http://pragimtech.com/webservices'.
To make service conformant please make sure that all web methods belonging to the same binding have unique names.
To fix this error, change WebServiceBinding attribute on the web service class
FROM - [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
TO - [WebServiceBinding(ConformsTo = WsiProfiles.None)]
//====================================================
[WebMethod(MessageName="Add2Numbers")]
public int Add(int firstNumber, int secondNumber)
{
return firstNumber + secondNumber;
}
[WebMethod]
public int Add(int Number1, int Number2, int Number3)
{
return firstNumber + secondNumber;
}
When we now try to view the service page we get a different exception - Service 'WebServicesDemo.CalculatorWebService' does not conform to WS-I Basic Profile v1.1. Please examine each of the normative statement violations below. To turn off conformance check set the ConformanceClaims property on corresponding WebServiceBinding attribute to WsiClaims.None.
R2304: Operation name overloading in a wsdl:portType is disallowed by the Profile. A wsdl:portType in a DESCRIPTION MUST have operations with distinct values for their name attributes. Note that this requirement applies only to the wsdl:operations within a given wsdl:portType. A wsdl:portType may have wsdl:operations with names that are the same as those found in other wsdl:portTypes.
- Operation 'Add' on portType 'CalculatorWebServiceSoap' from namespace 'http://pragimtech.com/webservices'.
To make service conformant please make sure that all web methods belonging to the same binding have unique names.
To fix this error, change WebServiceBinding attribute on the web service class
FROM - [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
TO - [WebServiceBinding(ConformsTo = WsiProfiles.None)]
//====================================================
[WebMethod(MessageName="Add2Numbers")]
public int Add(int firstNumber, int secondNumber)
{
return firstNumber + secondNumber;
}
[WebMethod]
public int Add(int Number1, int Number2, int Number3)
{
return firstNumber + secondNumber;
}
No comments:
Post a Comment