Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WS Parameter, Return Value type mismatch in client?
Message
Information générale
Forum:
ASP.NET
Catégorie:
Web Services
Titre:
WS Parameter, Return Value type mismatch in client?
Divers
Thread ID:
01163929
Message ID:
01163929
Vues:
76
Hi all,

I created a web service and it just has one method:
[WebService(Namespace = "")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class AssignmentService : System.Web.Services.WebService
{
    [WebMethod]
    public SoapEnvelope CreateAssignment(SoapEnvelope soapEnvelopeAssignment)
    {
    }
However, when the web reference is added to a client project, I get the following definition for the method.
        public System.Xml.XmlNode CreateAssignment(System.Xml.XmlNode soapEnvelopeAssignment) {
}
When I call the service using the web service reference, I get a SoapException:

---------------------------

---------------------------
Message: System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in the XML document. ---> System.InvalidCastException: Unable to cast object of type 'System.Xml.XmlElement' to type 'Microsoft.Web.Services3.SoapEnvelope'.
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read1_CreateAssignment()
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer.Deserialize(XmlSerializationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
--- End of inner exception stack trace ---
at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()



Stack: at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)

at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

at AssignmentServiceTester.AssignmentService.AssignmentService.CreateAssignment(XmlNode soapEnvelopeAssignment) in C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\AssignmentService (2)\AssignmentServiceTester\Web References\AssignmentService\Reference.cs:line 176

at AssignmentServiceTester.Form1.toolStripButtonAssignment_Click(Object sender, EventArgs e) in C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\Projects\AssignmentService (2)\AssignmentServiceTester\Form1.cs:line 73



Source: System.Web.Services




---------------------------
OK
---------------------------

What am I doing wrong? How do I make sure that same type of parameters and return value of the web method stay in sync in both the service and the client?
Dawa Tsering


"Do not let any unwholesome talk come out of your mouths,
but only what is helpful for building others up according to their needs,
that it may benefit those who listen."

- Ephesians 4:29-30 NIV

Dare to Question -- Care to Answer

Time is like water in a sponge, as long as you are willing you can always squeeze some.

--Lu Xun, Father of Modern Chinese Literature

Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform