473,785 Members | 2,824 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Data Type to implement ?

I am using the SOAP 1.1 request and response to create a corresponding web
method for it.
SOAP 1.1 response looks like as follows :

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelop e xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:soap="htt p://schemas.xmlsoap .org/soap/envelope/">
<soap:Body>
<GetPostsRespon se xmlns="http://tempuri.org/">
<PostSet>
<TotalRecords>i nt</TotalRecords>
<Posts>
<anyType />
<anyType />
</Posts>
</PostSet>
</GetPostsRespons e>
</soap:Body>
</soap:Envelope>

However the SOAP 1.1 response generated for the web method I am writing is
as follows:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelop e xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema"
xmlns:soap="htt p://schemas.xmlsoap .org/soap/envelope/">
<soap:Body>
<GetPostsRespon se xmlns="http://tempuri.org/">
<GetPostsResult >
<PostSet>
<TotalRecords xmlns="http://namespace.org/">int</TotalRecords>
<Posts xmlns="http://namespace.org/">
<anyType />
<anyType />
</Posts>
</PostSet>
<PostSet>
<TotalRecords xmlns="http://namespace.org/">int</TotalRecords>
<Posts xmlns="http://namespace.org/">
<anyType />
<anyType />
</Posts>
</PostSet>
</GetPostsResult>
</GetPostsRespons e>
</soap:Body>
</soap:Envelope>

The dummy web method I have written is as follows

[WebMethod]
public PostSet[] GetPosts(int postID, int pageIndex, int pageSize, int
sortBy, int sortOrder, int userID, bool returnRecordCou nt)
{
PostSet[] _ArrPostSet = new PostSet[0];
int dt = 0;
_ArrPostSet[0].TotalRecords = dt;
object[] test = new object[1];
_ArrPostSet[0].Posts = test;
return _ArrPostSet;

}
where PostSet is a class
What Data Type should I implement to generate a soap response as above.?

Dec 29 '05 #1
2 1176
do you want to return only one post set? if so then don't return an
array and you'll basically get the response you listed above with the
exception of the getpostsresult tag....i removed this before....if i
find the code i'll post it here

Dec 29 '05 #2
Thanks .. I implemented a Partial class as PostSet and changed the return
type to PostSet .
added XmlElementAttri bute attribute. Code snippnet is below.

[WebMethod]
[return: System.Xml.Seri alization.XmlEl ementAttribute( "PostSet",
IsNullable = true)]
public PostSet GetPosts(int postID, int pageIndex, int pageSize, int
sortBy, int sortOrder, int userID, bool returnRecordCou nt)
{
PostSet _PostSet = new PostSet();
int dt = 0;
_PostSet.TotalR ecords = dt;
object[] test = new object[1];
_PostSet.Posts = test;
return _PostSet;
}

"reez" wrote:
do you want to return only one post set? if so then don't return an
array and you'll basically get the response you listed above with the
exception of the getpostsresult tag....i removed this before....if i
find the code i'll post it here

Dec 30 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
5411
by: sedefo | last post by:
I ran into this Microsoft Patterns & Practices Enterprise Library while i was researching how i can write a database independent data access layer. In my company we already use Data Access Application Block (DAAB) in our .Net projects. We use SqlHelper in SQL based projects, and OracleHelper in Oracle based ones. OracleHelper was not published officially by Microsoft as part of the DAAB but it was given as a helper code in a sample .Net...
11
4196
by: Lorenzo Villari | last post by:
I premise I don't know C++ well but... I wondered what is this data hiding thing... I mean, if I can look at the header (and i need it beacuse of the class), then what's hidden? Can someone give me an example of something hidden from the user?
6
1632
by: LordHog | last post by:
Hello all, My lead wants to implement a data range monitor for a project that we are coding. Basically it performs a boundry checking that will take three parameters. I am/was trying to implement a generic data range monitor, but it doesn't quite work. I am trying to create one method that will accept any type of parameter and use those values whether they be int, unsigned int, float, double etc.... I am not sure if this can be done...
3
4759
by: Simon Harvey | last post by:
Hi, In my application I get lots of different sorts of information from databases. As such, a lot of information is stored in DataSets and DataTable objects. Up until now, I have been passing around chunks of data in DataTables/DataSets, simply because that was the format that they were in when the data was taken from the database. Now, I know this maybe a pretty silly question with a standard "it depends" answer, but I'm going to...
9
6653
by: MR | last post by:
I get the following Exception "The data at the root level is invalid. Line 1, position 642" whenever I try to deserialize an incoming SOAP message. The incoming message is formed well and its length is 642 bytes ( I have appended it to the end of this message). I suspect that the reason may have something to do with an incorrect declaration of which class to de-serialize to. In the attached code I substituted @@@@@@@ in the code below with...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10324
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10090
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4050
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.