Complex type as a return value

F

Fredy Villa

I have read the .net documentation about custom soap messages and
using xml and soap attributes to deal with this problem, but after
almost 2 days I find myself staring at code that should work, but
doesn't.

The following is the SOAP response I get (which btw is correct)

<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns0:getVendorListResponse xmlns:ns0="urn:local"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<ns0:return xsi:type="SOAP-ENC:Array" xmlns:bean="java:com.ggt.core"
SOAP-ENC:arrayType="bean:VendorHeader[1]">
<item xsi:type="bean:VendorHeader"
xmlns:bean="java:com.ggt.core">
<shortName xsi:type="xsd:string">Westin Stonebriar Resort,
North Dallas</shortName>
<vendorId xsi:type="xsd:int">13526</vendorId>
<name xsi:type="xsd:string">The Westin Stonebriar
Resort</name>
<contactId xsi:type="xsd:int">593922</contactId>
</item>
</ns0:return>
</ns0:getVendorListResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


This is the method from my proxy class:

<System.Web.Services.Protocols.SoapdocumentMethodAttribute("getVendorList",
ResponseNamespace:="urn:local",
ResponseElementName:="getVendorListResponse",Use:=SoapBindingUse.Literal,
ParameterStyle:=SoapParameterStyle.Wrapped)> _
Public Function getVendorList(ByVal arg0 As Session) As
VendorHeader()
Dim results() As Object = Me.Invoke("getVendorList", New
Object() {arg0})
Return CType(results(0),VendorHeader())
End Function


My VendorHeader class definition:

<System.Xml.Serialization.SoapTypeAttribute("item",
"java:com.ggt.core")> _
Public Class VendorHeader

Public shortName As String
Public vendorId As Integer
Public name As String
Public contactId As Integer

end class


I get a response and when I serialized to a file I get:

<?xml version="1.0" encoding="utf-8" ?>
<ArrayOfVendorHeader xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" />


Notice that it doesn't return null, but the array has no items!


What Xml or SOAP Attributes do I need to get the result to correctly
populate
my array of VendorHeaders? I got a soap response but I can't get it to
deserialize into an array of my class VendorHeader.


I will apprecitate any help,

Fredy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top