.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

incorrect deserialization of webservice response

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :.NET Framework
Hi,   I am trying to consume an axis2 webservice from a .NET CF platform. The development platform is Visual Studio 2008 . I have pasted the wsdl , sample response from webservice , for the getEpcByAttribute method.  On execution I initially got a Invalid Cast exception (details below):  System.InvalidCastException was unhandled   Message="InvalidCastException"   StackTrace:        at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length) On further investigation it seemed like the generated file (Reference.cs) had a two dimensional array, which the xmlserializer was trying to put the response into, and was failing. I tried to modify the generated file by converting the 2 dimensional array to a 1 dimensional array . The SOAP call was going through now, but the de-serialization was incorrect. Only the first row of the response was getting de-serialized. I have pasted relevant section from the Reference.cs below. Is there any workaround/fix for this problem (apart from modifying the webservice). Thanks.   WSDL: ---------- <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="urn:JDVisiblEdgeService" xmlns:axis2="urn:JDVisiblEdgeService" xmlns:ns1="http://vo.proj

View Complete Post

More Related Resource Links

Webservice returns xml.xmlnode - Need help getting response into dataset

Forgive me I am new to webservices so there may be something obvious that I am overlooking but any help would be appreciated.  Below is my code.  The reportrequest is perfectly formatted, i've already tested that with SoupUI.  The problem is the line I highlighted.  I am getting an error saying outerXml is not a member of System.Array.  Please provide any insight on how to go about this. Dim o As New sushi.SushiService Dim xn As XmlNode() = o.Getreport(reportrequest) Dim dsXML As DataSet = New DataSet() Dim reader As XmlTextReader = New XmlTextReader(xn.outerXml, XmlNodeType.Element, Nothing) dsXML.ReadXml(reader) gvresults.DataSource = dsXML gvresults.DataBind()Thank You!!!

incorrect response using AccountManagement


I have an application that runs against AD using System.DirectoryServices.AccountManagement. It is working but as there is a delay due to replication at remote sites I was asked to update it to make the changes on the remote DCs. This is working but the query .GetGroups against the same PrincipalContext object is returning data from the Central DCs not the specified DC. Code follows for the context but to summarize, I specified the server and the changes are occuring on the specified server but when I specify the server and query the results are not coming from the specified server.

We are running Server 2008. I have included and not included domain credentials. I tried specifying ContextOptions.ServerBind but it errors telling me that I must specify negotiate or simplebind and that the two cannot be combined.

I am confused despite teh helpful articles at http://www.codeproject.com/KB/system/usingAccountManagement.aspx and http://msdn.microsoft.com/en-us/library/bb384384(v=VS.90).aspx and a number of other sites.

PrincipalContext insPrincipalContext = new PrincipalContext(ContextType.Domain, serverName,

Can't read ping response from webservice

I am trying to ping a webservice but the response is coming back= nothing
I contacted a person there and he said they were receiving the ping and sending back a
success response as shown after my code.
I am unable to read the rsponse. Any help is appreciated 
Protected Sub btnPing_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPing.Click
        Dim ES As New EchoSignDocumentService()
        Dim serviceurl As String = "https://www.echosign.com/services/EchoSignDocumentService9"
        ES.Url = serviceurl
        Dim s As String
        Dim apikey As String = "XDYYBE6Y336S3F"
        s = ES.testPing(apikey).message
    End Sub

Also tried

  Protected Sub btnPing_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPing.Click
        Dim ES As New EchoSignDocumentService()
        Dim serviceurl As String = "https://www.echosign.com/services/EchoSignDocumentService9"
        ES.Url = serviceurl
        Dim pong As Pong
        Dim apikey As String = "XDYYBE6Y336S3F"
        pong = ES.testPin

Response.BinaryWrite help needed


Hi all

Im new to .NET and stuck now, so i hope anyone can help my with my problem.

I have a MS SQL database where i have stored some documents as Binary data. I cant figure out how to retrieve them and show/download them in my browser.

I found some guides online and have try to put something together.


private void Write()
 int id = 0;
 string strID = Request.QueryString["id"];
 int.TryParse(strID, out id);

 var db = new ModelDataContext();
 var doc = db.DocumentDatas.Where(x => x.ID == id).FirstOrDefault();

 byte[] byteArray = File.ReadAllBytes(doc);


How do i fill the byteArray with the data?

Thanks in advance :)


Response.Redirect slow


I'm in the middle of migrating servers and on the new server Response.Redirect is extremely slow. It takes around 20 seconds for the browser to get the redirect. This is something that was quick on the existing server. It's an ASP.NET 2.0 application, both servers are running IIS6.

Additionally, if I "manually" do the redirect, it's fast. For example:

Existing way:


takes around 20 seconds on the new server

New way:

Response.Status = "302 Moved Temporarily";
Response.AddHeader("Location", url);

is fast on the new server.

Any ideas why Response.Redirect would be so slow on the new server?

saving XML output from webservice


 I created a webservice that takes casenum as input and gives results as a dataset in an XML.

I could make a web client to display the resulting dataset in a grid view. Pls see my code copied below.

Now I want to create a console client that takes the casenum as input, to call the webservice and saves the resulting xml for further processing, but can't figure out how to just capture the xml to save. Here's the code for my web client. I would appreciate if you could help modify this tocapture the resulting xml to save file locally.

Thank You.

namespace ResultsWebServicesClient
    public partial class _Default : System.Web.UI.Page
        protected void Page_Load(object sender, EventArgs e)

        private void BindDataToGrid(string CaseNum)
            FG_Results results = new FG_Results();
            DataSet ds1 = new DataSet();
            ds1 = results.Get_FG_Results(CaseNum);
            GridView1.AutoGenerateColumns = true;
            GridView1.DataSource = ds1.Tables[0];

        protected void GetResults(object sender, EventArgs e)


HTTP Post and WebService


I am working on a application which will accept the data in the post request. My application also wants to expose a web service and want to call another web service. Considering all these 3 action that I want to do, can I create a single application which will have a web form which will accept the POST request and expose a web service at the same time.

Although it may be possible to achieve this, Is this a correct way of doing it?

Calling webservice from the server


I have a sample web service and aspx file. I deployed them to an existing website that contains classic asp files.

web-service: --- using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; [WebService(Namespace = "http://localhost/MyWebServices/")] public class MembershipRegisWebService : System.Web.Services.WebService { public MembershipRegisWebService () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string HelloWorld() { return "Hello World."; } }

aspx.cs file: --- using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Services; public partial class CallWebService : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { MembershipRegisWebService mrWs = new MembershipRegisWebService(); Response.Write("Calling web service:" + mrWs.HelloWorld()); } }

It runs locally, but it shows an error when running it from the server:

Server Error in '/' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the follow

C# / Java webservice


I am writting a client applicatin that acesses a webservice written by another company.  I need to test against this webservice but since it is live I need another place to test with.  I don't have access to the code from the webservice but have added a reference to my project.  I would like to create a test platform using C# which will run on IIS and not Java.

I have created a basic webserive using both the NetBeans platform and the VS/C# platform.  The problem I am having is if I dynamically change the web address from one to the other my client application complains that the webservice is invalid.  I have verified all the calls are the same.

Are there any setting with VS/C# that allow me to configure it to behave more like the Java webservice?  I don't have the server support to host the Java application for full testing along with other problems using the Java version.

I have run both services in the "WCF Test Client" and can see where the WCF service uses the varibles for request and the Java uses body/request but can't get the WCF to follow that format.  I read somewhere about changing the OperationContract with SoapRpcMethod but then the mentod is not longer exposed. I also tried a Web Service in .NET 3.5 instead of a WCF server but that seems to be more trouble and does not

Printing crystal report from webservice



I am trying to print crystal repot directly from a C# application, which is calling webservice. I am able to display report in crystalreportviewer by passing the webservice call to datasource. However, is there anyway, I can print directly without showing the report?

Alternatively, I was trying return ReportDocument object from webservice, which would solve my problem, but I was unable to return the ReportDocument because of serialization issue. Is it even possible? Thank you


Json Deserialization is giving error in IronPython



Have anyone tried json deserialization. When I tried:

>>> import json

>>> json.loads('["foo", {"bar":["baz", '"Test", 1.0, 2]}]')

I got following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\IronPython 2.6 for .NET 4.0\Lib\json\__init__.py", line
 307, in loads
  File "C:\Program Files\IronPython 2.6 for .NET 4.0\Lib\json\scanner.py", line
42, in iterscan

Test Run: Web Application HTTP Request-Response Test Automation with JavaScript


Write a simple browser-based request-response test automation using JavaScript that's platform independent and useful when you are working in a highly dynamic environment.

James McCaffrey

MSDN Magazine January 2010

Test Run: Request-Response Testing With F#


This month we show you how to use F# to perform HTTP request-response testing for ASP.NET Web applications.

James McCaffrey

MSDN Magazine July 2009

Test Run: Request/Response Testing with Windows PowerShell


Did you know you can use Windows PowerShell to perform lightweight request/response testing for an ASP.NET Web app? Here's how.

Dr. James McCaffrey

MSDN Magazine May 2008

Talk Back: Voice Response Workflows with Speech Server 2007


Speech Server 2007 lets you create sophisticated voice-response applications with Microsoft .NET Framework and Visual Studio tool integration. Here's how.

Michael Dunn

MSDN Magazine April 2008

Foundations: Build a Queued WCF Response Service


With queued calls in Windows Communication Foundation you can perform work in a disconnected manner by sending messages through Microsoft Message Queuing. Juval Lowy explains.

Juval Lowy

MSDN Magazine February 2007

.NET Matters: Deserialization Progress, and More


Build a standard progress bar that indicates how much deserialization has completed and how much still remains. Plus, System.Collection.Generics performance.

Stephen Toub

MSDN Magazine December 2006

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend