Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / September 2004

Tip: Looking for answers? Try searching our database.

Problem with WS method returning an array of complex type

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
isbjoern04 - 25 May 2004 16:23 GMT
Hi,

I developped a WS with IBM tools and used the wsdl in Visual Studio
2003 to add a Web Reference in my client.

I have no problems with methods returning a simple type (ex. boolean)
or complexType (ex. AccountInfo (a class defined by myself)).

Though I got en empty object, when I am calling a method returning an
array of complex type (AccountInfo). I checked the SOAP message and
it contains all the informations.

In the wsdl the array is defined by an unbouned element:
<complexType name="AccountInfo">
               <sequence>
                   <element name="number" type="xsd:long"/>
                   <element name="owner" nillable="true"
type="xsd:string"/>
                   <element name="label" nillable="true"
type="xsd:string"/>
                   <element name="rubrique" nillable="true"
type="xsd:string"/>
                   <element name="balance" type="xsd:long"/>
                   <element name="currencyIso" nillable="true"
type="xsd:string"/>
                   <element name="availableAmount"
type="xsd:long"/>
               </sequence>
           </complexType>
           <element name="getAccountsResponse">
               <complexType>
                   <sequence>
                       <element maxOccurs="unbounded"
name="getAccountsReturn" type="impl:AccountInfo"/>
                   </sequence>
               </complexType>
           </element>

Did someone return successfully an array (of simple or complex) type
in a ws method call?

:-)
Anne C.
Mickey Williams - 25 May 2004 17:44 GMT
What does the response look like on the wire? Can you change the web service
to doc/literal? I've seen some rpc/encoded web services written so that the
arrays are returned naked - instead of this:
<foos>
    <foo/>
    <foo/>
    <foo/>
</foos>

You get:
    <foo/>
    <foo/>
    <foo/>

Signature

Mickey Williams
Author, "Microsoft Visual C# .NET Core Reference", MS Press
www.servergeek.com/blogs/mickey

> Hi,
>
[quoted text clipped - 44 lines]
>     ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----------------------------------------------------------
isbjoern04 - 26 May 2004 15:28 GMT
Hi,

It is already in doc/literal.

The repsonse looks like this:

HTTP/1.1 200 OK
Server: WebSphere Application Server/5.0
Content-Type: text/xml; charset=utf-8
Content-Language: fr-CH
Connection: close

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<getAccountsResponse xmlns="NameSpaceName">
<ns-269198536:AccountInfo
xmlns:ns-269198536="NameSpaceName">
<ns-269198536:number>5566</ns-269198536:number>
<ns-269198536:owner>BQUE PIGUET CIE YVERDON
</ns-269198536:owner>
<ns-269198536:label>VOSTRO</ns-269198536:label>
<ns-269198536:rubrique/>
<ns-269198536:balance>15577899</ns-269198536:balance>
<ns-269198536:currencyIso>USD</ns-269198536:currencyIso><ns-269198536:availableAmount>15577899</ns-269198536:availableAmount></ns-269198536:AccountInfo>
<ns-269198536:AccountInfo xmlns:ns-269198536="NameSpaceName">
<ns-269198536:number>9575751</ns-269198536:number><ns-269198536:owner>MUSIO
MICHELE           </ns-269198536:owner>
<ns-269198536:label>BCV RAPID</ns-269198536:label>
<ns-269198536:rubrique/>
<ns-269198536:balance>428346</ns-269198536:balance>
<ns-269198536:currencyIso>CHF</ns-269198536:currencyIso>
<ns-269198536:availableAmount>428346</ns-269198536:availableAmount></ns-269198536:AccountInfo>
</getAccountsResponse>
</soapenv:Body>
</soapenv:Envelope>

------
Anne C.
Richard Sypriano - 27 Sep 2004 01:21 GMT
Does anyone know if this got resolved.  I have the same problem except I
created the client and service with Visual Studio 2003 from a WSDL I
built by hand.  I get back an array with objects in it; but all the
values inside the objects are blank.
Girish bharadwaj - 27 Sep 2004 11:14 GMT
Are the objects that are being pushed into the array serializable? I believe
you need to have public fields within those objects if you dont explicitly
implement ISerializable interface.

Signature

Girish Bharadwaj
http://msmvps.com/gbvb

> Does anyone know if this got resolved.  I have the same problem except I
> created the client and service with Visual Studio 2003 from a WSDL I
> built by hand.  I get back an array with objects in it; but all the
> values inside the objects are blank.
Richard Sypriano - 27 Sep 2004 16:52 GMT
Thanks for your response.

The object is defined as

<s:complexType name="BlanketPOs">
   <s:sequence>
       <s:element maxOccurs="1" minOccurs="1" name="BlanketPONumber"
type="s:string"/>
       <s:element maxOccurs="1" minOccurs="1" name="BlanketPOAmount"
type="s:double"/>
       <s:element maxOccurs="1" minOccurs="1"
name="BlanketPOAmtRemaining" type="s:double"/>
       <s:element maxOccurs="1" minOccurs="1"
name="BlanketPOExpiration" type="s:date"/>
   </s:sequence>
</s:complexType>

in the WSDL.  After adding the web reference to the project I use the
web reference to create one of these objects, populate its properties
them loaded it into the array. Here is the code

public int MaxAccountGetDetail (out WebReference.BlanketPOs[]
blanketPOs)

blanketPOs = new WebReference.BlanketPOs[1];

blanketPO  = new WebReference.BlanketPOs();
blanketPOs.SetValue(blanketPO, 0);

blanketPO.BlanketPOAmount       = 2222.22;
blanketPO.BlanketPOAmtRemaining = 0.0;
blanketPO.BlanketPOExpiration   = DateTime.MaxValue;
blanketPO.BlanketPONumber       = "1234"

return 1;

All of the properties are serializable and public otherwise I wouldn't
have access to them.  I believe if all the properties of a class are
serializable then the class is serializable.  Does this answer your
question or am I missing something?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.