Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Web Services response

Status
Not open for further replies.

ifssolution

Programmer
Mar 17, 2007
5
ES
Dear:

I have a Web Services with a WebMethod:

public ArrayList GetLanguages()
{
ArrayList Lang_Array = ...;
return Lang_Array;
}

and the response is:

<?xml version="1.0" encoding="utf-8" ?>
<ArrayOfAnyType xmlns:xsd=" xmlns:xsi=" xmlns=" <anyType xsi:type="ArrayOfAnyType">
<anyType xsi:type="xsd:string">aa</anyType>
<anyType xsi:type="xsd:string">Afar</anyType>
</anyType>
....

And I would like to change the XML Tags of this response (for example: "langs" instead of "anyType" ). How can I do that?

Thanks
 
Am I asking for Web Services problems in the correct forum?
 
total shot in the dark...

try using a specific object type instead of an arraylist. an array list can hold anything so how can the service know how to translate it?

if results have a fixed length you can use [tt]string[][/tt], if not use [tt]List<string>[/tt].



Jason Meckley
Programmer
Specialty Bakers, Inc.
 
It si not a good idea to have an arraylist serialized for a webservice. User normal arrays and not to complex objects.

can you show the complete wsdl?



Christiaan Baes
Belgium

"My old site" - Me
 
Well I´m using this WebMethod:

[WebMethod]
public language[] GetLanguages()
{
int i=0;
ArrayList Lang_Array = ...
language[] Lang_Info = new language[Lang_Array.Count];
foreach (ArrayList item in Lang_Array)
{
Lang_Info.code = item[0].ToString();
Lang_Info.lang_name = item[1].ToString();
i++;
}
return Lang_Info;
}

and the structure:

public struct language
{
public string code;
public string lang_name;
}

the response look like this:

<?xml version="1.0" encoding="utf-8" ?>
<ArrayOfLanguage xmlns:xsd=" xmlns:xsi=" xmlns="<language>
<code>aa</code>
<lang_name>Afar</lang_name>
</language>
<language>
<code>ab</code>
<lang_name>Abkhazian</lang_name>
</language>
.....

In this case I want to change the "ArrayOfLanguage" tag name for other one like "Languages". How can I do that? and How can I know what is the XML request for this Web Services?

Sorry but I´m a beginner.

Thanks
 
Why would you want to that. if you add a webreference does the wsdl2vbnet create an array arrayoflanguage? most likely not. It is something used internally.

I think you should learn more about the inner workings of webservices. Like what does wsdl do, what has soap got to with it. when is the xml created and when do we use webservices. If you are reading the xml then you are probably not using wsdl2code, you shouldn't need to care about the xml.

Christiaan Baes
Belgium

"My old site" - Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top