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 / ASP.NET / Web Services / August 2007

Tip: Looking for answers? Try searching our database.

Returning custom type

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Robbo - 01 Aug 2007 20:33 GMT
Hi,

I am creating a webservice which will be consumed by a 3rd party, non dotnet
client.

I want to return a custom datatype from my webservice.  It's a relatively
simple Customer object which just contains strings.

eg:

[WebMethod]
public Customer GetCustomer(int custId)
{
   return new Customer();
}

now, my Customer class is defined as follows:

[Serializable]
public class Customer
{
   // properties are forename, surname, title, address etc (all strings)
}

My question is this...when I expose this webmethod the clients do not see
any of the Customer type definition in the WDSL, so they don't actually know
what data they are getting back.

Am I missing something here?  I was expecting the Customer object structure
to be present in the WDSL?

Thanks,

Rob
John Saunders [MVP] - 01 Aug 2007 23:36 GMT
> Hi,
>
[quoted text clipped - 26 lines]
> Am I missing something here?  I was expecting the Customer object
> structure to be present in the WDSL?

Have you looked at the generated WSDL? It will contain a definition of a
complex type which is equivalent to the Customer type that you are
returning.
Signature

John Saunders [MVP]

Robbo - 21 Aug 2007 18:27 GMT
Thanks John, it was indeed!

I wonder if you can help regarding webservices and exceptions?  I have given
the WSDL to my integration team and they are saying it needs a "fault"
element.

I.e: something like:

<wsdl:operation name="MI_OUT_customerData">
           <soap:operation
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
soapAction=http://blah.com/get />
           <wsdl:input>
               <soap:body
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" use="literal" />
           </wsdl:input>
           <wsdl:output>
               <soap:body
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" use="literal" />
           </wsdl:output>
           <wsdl:fault name="CustomError">
               <soap:fault
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"
name="CustomError" />
           </wsdl:fault>
</wsdl:operation>

However, I only have the input & output elements under my operation.

Can I get the fault in there somehow?

Actually I think I'll post this as a new thread!

Thanks,

Paul

>> Hi,
>>
[quoted text clipped - 30 lines]
> complex type which is equivalent to the Customer type that you are
> returning.
John Saunders [MVP] - 22 Aug 2007 00:46 GMT
> Thanks John, it was indeed!
>
> I wonder if you can help regarding webservices and exceptions?  I have
> given the WSDL to my integration team and they are saying it needs a
> "fault" element.

Already answered.
Signature

John Saunders [MVP]

Robbo - 22 Aug 2007 19:36 GMT
Hi there John I couldn't see an answer to the "fault" query, apart from a
reply from Nathan Anderson on the webforum saying it is not supported by
ASPX.

Is this the answer you are referring to?

Thanks,

Paul

>> Thanks John, it was indeed!
>>
[quoted text clipped - 3 lines]
>
> Already answered.
John Saunders [MVP] - 22 Aug 2007 19:48 GMT
Yes.
Signature

John Saunders [MVP]

> Hi there John I couldn't see an answer to the "fault" query, apart from a
> reply from Nathan Anderson on the webforum saying it is not supported by
[quoted text clipped - 13 lines]
>>
>> Already answered.
Robbo - 23 Aug 2007 19:06 GMT
Ah.

Ok thanks for getting back to me!

> Yes.
>> Hi there John I couldn't see an answer to the "fault" query, apart from a
[quoted text clipped - 14 lines]
>>>
>>> Already answered.

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.