Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WS Parameter, Return Value type mismatch in client?
Message
From
23/10/2006 16:21:47
Keith Payne
Technical Marketing Solutions
Florida, United States
 
General information
Forum:
ASP.NET
Category:
Web Services
Miscellaneous
Thread ID:
01163929
Message ID:
01163990
Views:
9
>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,

Maybe the soapEnvelope type is not serializable? Try serializing and deserializing a soapEnvelope object separate from this application.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform