473,385 Members | 1,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetPostsResponse xmlns="http://tempuri.org/">
<PostSet>
<TotalRecords>int</TotalRecords>
<Posts>
<anyType />
<anyType />
</Posts>
</PostSet>
</GetPostsResponse>
</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:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetPostsResponse 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>
</GetPostsResponse>
</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 returnRecordCount)
{
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 1157
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 XmlElementAttribute attribute. Code snippnet is below.

[WebMethod]
[return: System.Xml.Serialization.XmlElementAttribute("Post Set",
IsNullable = true)]
public PostSet GetPosts(int postID, int pageIndex, int pageSize, int
sortBy, int sortOrder, int userID, bool returnRecordCount)
{
PostSet _PostSet = new PostSet();
int dt = 0;
_PostSet.TotalRecords = 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
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...
11
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...
6
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...
3
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...
9
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.