Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




How to handle error coming while using Method Overloading in Webservices

Description and solution of below given error

Service 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
'myWebServSoap' from namespace 'http://tempuri.org/'. To make
service conformant please make sure that all web methods belonging to
the same binding have unique names.

This error will come while you try to overload methods in webservice. Solution of this error is below:

First you have to use the MessageName for using Overloading the Webservice.
Like if you are using the Two add methods the we will have to write MessageName with second method. This is not sufficient to overloading. You need to write

[WebServiceBinding(ConformsTo = WsiProfiles.None)]


After this, service will properly run.

We also can use the Description with Webservice

[WebMethod]
 public int Add(int a, int b)
{
  return a + b; 
} 

[WebMethod(MessageName="abc",Description="Using at adding 4 Parameters")]
 public int Add(int a, int b,int c,int d)
{
  return a + b + c+d;
} 

Share this article   |    Print    |    Article read by 4565 times
Author:
Rohit kakria
I am software developer
Related Articles: No related article
Related Interview Questions: No related interview question