Solved

web service return type

Posted on 2008-10-08
6
2,476 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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

758 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

12 Experts available now in Live!

Get 1:1 Help Now