Solved

web service return type

Posted on 2008-10-08
6
2,482 Views
Last Modified: 2010-04-21
Hi all,

I am fairly new to web services and have consumed one or two in the past. I have been asked to consume a web service which contains personal details of users such as Title, First name, Surname, Address etc.

Now I have managed to do this and all seems to be working ok. However the data the service is returning is just a string of characters made up of the data. An example of this would be when I call the GetUser method and it returns a string not dissimilar to this:

123435Surname Firstname Title04/03/2008
Addressline1AddressLine2Postcode

Now I understand what the data is but it just seems to be in a complete mess. I have not seen anything like this before as the web services I have consumed in the past have returned a string of xml  that I could loop through.

My question is what is the most common return type for a web service and am I missing something with what is being returned with this one? Also is it common place to have a service return a string of xml like so:

<user><title>Mr</title><forename>fred</forename><surname>blogs</surname></user>

Many thanks as at a complete loss with this one.

Cragly
0
Comment
Question by:Cragly
  • 3
  • 2
6 Comments
 
LVL 13

Accepted Solution

by:
TechTiger007 earned 250 total points
ID: 22669393
When you say you consumed the web service do you mean that you created a proxy for the web service and called this method. A web service can return any serializable data type like string, int, structure, class object, etc.

In this case it seems your web service is returning a string which you have captured. You will have to modify the web service to return the address in your intended format or else you have to find out the algorithm used to form the string and use the same algorithm to retrieve data from the string.
0
 
LVL 26

Assisted Solution

by:Anurag Thakur
Anurag Thakur earned 250 total points
ID: 22670159
is the web service controlled by your team or is it a third party one
if its controlled by your team then you might get the interface modified so that it returns the user object serialized into XML as the example given by you
<user><title>Mr</title><forename>fred</forename><surname>blogs</surname></user>
or else you might want to get some kind of delimiter added to your strings so that you can retrieve your data from the strings
0
 

Author Comment

by:Cragly
ID: 22670402
Thanks guys for the comments.

I forgot to mention that this web service I have to use is a third party service that cannot be modified. I have created the proxy automatically within VS 2008 and can successfully call the methods and return the data. I was just confused at what I was getting back as it is not consistent or delimitated in any way making it hard to do anything with at my end.

I Just wanted to make sure that this what I am thinking (that the web service is a bit crap for returning such data) was not to far of the mark! As I mentioned I have worked with third part services before that have either returned a .net type or custom object or a string of XML that I could do something with.

This just seems very poor and its from quite a large organisation as well not some backstreet company.

If you can confirm this then I will split the points as the feedback is much appreciated.

Cragly
 
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 26

Expert Comment

by:Anurag Thakur
ID: 22670491
i assume that you might be scratching your head to find out how to get the information out of the strings that the web service is returning
is there a format in which the organisation says that its going to return you the data
if yes then your data segregation and putting it into your object might become a little easy
there might be some documentation regarding the same which might be helpful to you
0
 

Author Comment

by:Cragly
ID: 22677603
Unfortunatly it just returns this long undelimited string and the documentation is not very helpful. But yes a lot of head scratching as never seen a sevice return so much data in a string in this way. What about yourself? Have you worked with any services that do this? What types do you normaly work with when using web services?
0
 

Author Closing Comment

by:Cragly
ID: 31504226
Cheers for the help. I have split the points as you are both correct in what you are saying.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
The task of choosing a web design company to build a website for your business should never be taken in a light manner. Provided the fact that your website will act as a representative to your business and will be responsible for imposing an online …
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now