.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

Assigning XML Tag Names Within ASP Web Service Returning Jagged Array

Posted By:      Posted Date: October 01, 2010    Points: 0   Category :ASP.Net


I am using an ASP webservice to return a jagged array.  I need to be able to define the tags names in the XML which is returned.  How do I do this?


Code and Example XML follow.




        orderListId = new string[100];
        orderListTime = new string[100];
        orderListEmail = new string[100];
        orderListStatus = new string[100];
        orderListSubtotal = new string[100];

        int orderCount = 0;
        foreach (DataRow drRow in dtResult.Rows)
            orderListId[orderCount] = (drRow["SubmittedFormId"].ToString());
            orderListTime[orderCount] = (drRow["SubmitTime"].ToString());
            orderListEmail[orderCount] = (drRow[&quo

View Complete Post

More Related Resource Links

How to create an extremely large array/object (> 2 GB) without using jagged arrays ?

Hello,I had implemented a matrix scaling algorithm in Java (64-bit) for a university project and have now implemented the code in C# with .NET 3.5 64-bit. One of the operations I did in Java was creating a rectangular array with double[][] = ... (in C# this is a jagged array!) to store a symmetric matrix which is used as input for the algorithm. Since I was using matrices with n up to 30720, memory usage for the single matrix object was around 8 GB in it's maximum and with matrix multiplication around 20 GB.So... now I implemented this in C# and I am shocked to see that double[,] (rectangular arrays) can only be 2 GB in size even on 64-bit! That means that for matrices with n larger than ~15000 I will get OutOfMemory Exceptions although there is a huge amount of free memory (I have two quad core systems with 12 GB and 24 GB Ram). When I use jagged arrays in C# (i.e. double[][]) I can create larger matrices. That is because I have one small array with the size of the row number (i.e. n) and then for each row an array of size n, but they are all single objects so I don't reach the 2 GB per object limit. The problem with jagged arrays is that they are horribly slow for matrice calculations compared to rectangular arrays and even slower compared to single dimension arrays.Actually I intended to rewrite my code and simulate the matrices in single arrays (see sample code below) bec

Error calling WCF service that is returning list.".Debugging resource strings are unavailable ......

Ok.this is just making me frustrated... Here is step by step of what I am trying to do (& not able to) 1. I am calling WCF service hosted in a SharePoint 2010 site from a silverlight app in same domain (So no cross doman I guess). 2. I use Linq to Sharepoint for querying the DB. 3. I am having a list "machines" in Sharepoint 2010 that is having a lookup column from Other list called "part" 4. My WCF method GetAllMachines() works perfectly well when it skips the lookup column "partname" & returns List of type machineitem. 5. But problem occurs when I add machineitemobject.parts.partsname in my Linq to Sharepoint query . My service gives the error not found Async_ExceptionOccurred] Arguments: Debugging resource strings are unavailable." 6. Note that return type of my Method is List<machinesitem> 7. The point to note here is that I use SPMETAL tool to generate the LINQ class that maps the lists . So When I try to query the lookup column it tries to add List item of the type class & that is what causing the error. Is it because I am not using datacontract in my service (but it returns the strings & all private members of machines list e.g. name,title etc) Is it making the attribute Serialisable will solve the error ??? I am kind of lost in it ...Plss help!!   Thanks

assigning spn to service account

I have installed MOSS 2007 to use Kerberos. Prior to the installation I assigned SPN HTTP/servername.domain to each of my service accounts: Farm Account, Content Pool, Shared Services Pool and Shared Services Account. I did this knowing that I would have to add / drop SPNs later, according to port numbers. (I followed guides by Scott Hillier and Martin Kearn). My question is: what specific service/app pool do I assign to these accounts? When all have the same generic SPN that I assigned originally everything works, but I receive KDC error #4 every 30 minutes or so. KDC error 4 states that there are 'multiple accounts with name HTTP/*****.*** of type DS_SERVICE_PRINCIPAL_NAME. I have been using trial and error in assigning variations of the HTTP service (using port numbers from my MOSS instance).Is there a better way? Because this is not working so well.

Why is GetListItems returning rubbish as field names?

Always wondered, why? I need to write a complex SSIS package that will copy all of the sharepoint lists into sql database (because M$ were too stupid to let users do rich reporting on the sharepoint server, you have to dupe the lists into another database to do reports on them) Problem is, if i query for list, i get something like this: <Field Type="User" DisplayName="??? ??????????" List="UserInfo" Required="FALSE" ShowField="ImnName" UserSelectionMode="PeopleOnly" UserSelectionScope="0" Group="??????????м?? ???????" ID="{888f100e-1488-4662-af86-413a05dc3506}" SourceID="{bfad9184-4660-4714-a773-b2803c9941f3}" StaticName="???_x0020_??????????" Name="_x0424__x0418__x041e__x0020__x04" Hidden="FALSE" Customization="" ReadOnly="FALSE" PITarget="" PrimaryPITarget="" PIAttribute="" PrimaryPIAttribute="" Aggregation="" Node="" ColName="int1" RowOrdinal="0" /> <Field Type="DateTime" DisplayName="?????? ?" Required="TRUE" Format="DateOnly" Group="??????????м?? ???????" ID="{635dd517-ab59-4cd3-91eb-54a1f679a07b}" SourceID="{bfad9184-4660-4714-a773-b2803c9941f3}" StaticN

Parameter names ending with "specified" added to web service method call

Hello,I am new to WCF. I created a wcf web service and the generated web method exposed by wcf has some additional boolean parameters with names that end with "Specified".I am trying to understand why are these additional parameters necessary and how to get rid of them. Thanks!David

WCF service returning old values

Hi. I am developing an application with WCF services. The basic functionaloty of a screen is to provide an entry screen to add particular entity. Once save even fired It will save the data to the database and call the bind method to bind into the grid by refreshing the latest data. When I am running the site from my source (Visual Studio) , it works perfectly. When the client calls method to fetch the data the WCF service, it returns latest (added) data. But the issue comes in the server when it works with IIS. I deployed the code in the server, once the data added I am getting the old data only. But after two refresh I am getting the latest data. Could you please let me know what required to be done to get the latest record. Many Thank, Kelvin Kumar

wcf returning a list from wcf service - I have lots of locations and I want to return the locations


How is it possible to return some kind of list from a wcf serivce, this the method in my wcf service 
my interface:

    [WebInvoke(Method = "GET",
        ResponseFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Wrapped,
        UriTemplate = "Locations")]
    IList<Location> GetLocations();

 public IList<Location> GetLocations()
        Pazar.Data.Repositories.LocationRepository locRepository = new Pazar.Data.Repositories.LocationRepository();
        return locRepository.GetRootLocations().ToList<Location>();

and this how my GetRootLocations looks like, It returns IQueryable, I wounder if I can maybee return Iqueryable from my svc-service?

public IQueryable<Location> GetRootLocations()
        IQueryable<Location> locations = GetAll().Where(p => !p.ID_Parent.HasValue).OrderBy(p => p.Sequence);
        return locations;

User Profile Service not returning security groups


I just got the User Profile Service working, and tried using GetCommonMemberships but I am only getting Distro lists and Sharepoint groups.  No security groups (Domain Local, Global, Universal) are showing up.

I did come across one post where someone was not running in Native mode AD, its possible since I *JUST* ADPrepped and added a 2008 DC today that I'm back in a mixed mode and that is the problem...?  Seems weird tho.   Just checked on the new 2008 DC it says Windows 2003 mode or something along those lines

Sharepoint itself is able to see and use the security groups.  If I change permissions on a List or library, I am able to select security groups.  It seems specific to the User Profile Service.

A little more looking... it seems that DL's show up, and Universal security groups show up.  Domain Local and Domain Global security groups do not.




TableAdapter Fill() not returning result over WCF Service


Firstly I must mention I'm new to WCF and relatively new to .NET Development - so what I'm doing might not be the best way to do it.


My problem is that when I indirectly use a table adapter's Fill() over a WCF Service connection to fill a strongly typed DataTable - it fills the table, but in the calling function, the table remains empty.


I’m busy creating a proof-of-concept using Visual Studio 2010 Professional on Windows 7 Professional accessing MS SQL 2008.

I’m trying to create an n-tier setup and thus have the following 5 projects:

1. "MsSqlDataAccess" - a project containing the TableAdapters from a strongly typed dataset.

2. "Entity" - I've separated my DataSet from the "MsSqlDataAccess" to be in this project.

3. "Comm" - WCF Service using netTCPBinding.

 - This makes available GetUsers() and FillUsers().

 - FillUsers() can either take a dataset or a datatable.

 - Above mentioned methods call the applicable TableAdapter methods.

4. "Service" - a Windows Service hosting the WCF Service.

5. "WpfTestClient" - a WPF client consuming the service.


I can return a filled DataTable when I use the TableAdapter's Get() method via the WCF service's GetUsers() method.<

WCF client for axis2 web service (same element names for different elements in different complex typ



we want to consume a axis2 web wervice. We can't influence the web service definition.

the wsdl looks like:

<?xml version="1.0" encoding="utf-8"?>
        <xs:element name="BAPI_COMPANYCODE_GETLIST">
            <xs:element minOccurs="0" maxOccurs="1" name="OUTPUT">
                  <xs:element minOccurs="0" maxOccurs="1" name="RETURN" type="psi:BAPIRETURN">

WCF Service returning DataTable for silverlight client



I am creating a WCF 3.0 service which will fetch data from the database and return mostly in DataTable and DataSet format. I am building a Silverlight client for consuming this service. But what I found is Silverlight 3.0 does not support datatable or dataset. Unfortunately most of my datas are returned in the datatable format. Is there any way to consume datatable in silver light or converting datatable to generic list or LINQ before returning them? If it is possible to convert datatable to generic collection, does it possible without iteration? This is because converting hundreds of records by iterating will affect my performance.

Thanks in Advance!!!!

Best regards,
Subalakshmi Vijayarajan.

Subalakshmi Vijayarajan.

WCF service over https returning error


I am trying to deploy a wcf service. I have created a simple service, basically I have created a new wcf service and tried to deploy it however I get this error

The type 'WCF_Application.Service1', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.


I am trying to deploy my service to a subdomain like https://services.mydomain.com/business


My config looks like this


      <service name="WCF_Application.Service1">
        <endpoint address="Business" binding="wsHttpBinding" contract="WCF_Application.IService1"
            <dns value="services.mydomain.com" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
            <add baseAddress="https://services.mydomain.com/" />

WCF service hosted in IIS 7 returning error "Security settings for this service require 'Anonymous'

Using the CalculatorService provided as a WCF sample from MSDN, I tried to host it as an application in IIS 7. The virtual folder in IIS is configured as Basic Authentication enabled and Anonymous Authentication disabled. I don't have any certificates setup. This is all hosted in a single machine setting. Each time I access the service through a browser, I'm getting the error "Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service".

Below is my web.config --

Can someone please provide some answer, I don't want to enable Anonymous authentication in IIS. I even set the 

aspNetCompatibilityEnabled = true.

<?xml version="1.0"?>


Service returning Object fails when object is complex class


Hi. I have created a WPF client and a self-hosted WCF Service based on an interface, in wich alle methods returns a standard response class. An example of one such method definition is:

Response CreateAccount(AccountCreationParams accountParams);


The response object is defined as:



public class Response



public string ResponseText;


public bool CompletedSuccesfully;



Problem with reading byte array from stream in WCF Service


Hello i have WCF Service and at some point of my program i am getting pointer to byte array. I want to copy bytes from this byte array/pointer to another byte array and send it to client.


// EDIT : THis code is TOTALLY wrong  please see post under to see code and proper problem. Sorry for mistake.

 byte[] arrbyt = new byte[params.ActualSize + 1];
 int isize = Marshal.SizeOf(typeof(byte))*arrbyt.Length;
 IntPtr pt = Marshal.AllocHGlobal(isize);

 int ind = 0;
 while (read != 0)
 str.RemoteRead(out *(byte*)pt, size, out read);

 Marshal.Copy(pt, arrbyt, 0, isize);

//after that arrbyt is still empty but pt has good values in it. I tryied also with stackalloc and then IntPtr to it and then Marshal.Copy but the result was the same.

//Does any one had similar problem or have an idea how to copy bytes from pt to other array?

//edit RemoteRead is like ISequentialStream::Read M

Web Services - Returning a Cookie from the web service im calling after authentication



I am trying to call an authentication method on a web service that returns a cookie, however when i call the web service, I just get the SOAP object returned, how do i get the cookie back after I have been authenticated ?

Any help or pointers appriciated

Kindest regards


Windows Service Applications Tutorials

You can easily create services by creating an application that is installed as a service. For example, suppose you want to monitor performance counter data and react to threshold values. You could write a Windows Service application that listens to the performance counter data, deploy the application, and begin collecting and analyzing data.
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