HighTechTalks DotNet Forums  

Returning custom type

ASP.net Web Services microsoft.public.dotnet.framework.aspnet.webservices


Discuss Returning custom type in the ASP.net Web Services forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Robbo
 
Posts: n/a

Default Returning custom type - 08-01-2007 , 03:33 PM






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



Reply With Quote
  #2  
Old   
John Saunders [MVP]
 
Posts: n/a

Default Re: Returning custom type - 08-01-2007 , 06:36 PM






"Robbo" <robinsonpr (AT) aol (DOT) com> wrote

Quote:
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?
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.
--
John Saunders [MVP]



Reply With Quote
  #3  
Old   
Robbo
 
Posts: n/a

Default Re: Returning custom type - 08-21-2007 , 01:27 PM



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:

<wsdlperation name="MI_OUT_customerData">
<soapperation
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>
<wsdlutput>
<soap:body
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" use="literal" />
</wsdlutput>
<wsdl:fault name="CustomError">
<soap:fault
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"
name="CustomError" />
</wsdl:fault>
</wsdlperation>

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


"John Saunders [MVP]" <john.saunders at trizetto.com> wrote

Quote:
"Robbo" <robinsonpr (AT) aol (DOT) com> wrote in message
news:eC61DLH1HHA.1168 (AT) TK2MSFTNGP02 (DOT) phx.gbl...
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?

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.
--
John Saunders [MVP]




Reply With Quote
  #4  
Old   
John Saunders [MVP]
 
Posts: n/a

Default Re: Returning custom type - 08-21-2007 , 07:46 PM



"Robbo" <robinsonpr (AT) aol (DOT) com> wrote

Quote:
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.
--
John Saunders [MVP]



Reply With Quote
  #5  
Old   
Robbo
 
Posts: n/a

Default Re: Returning custom type - 08-22-2007 , 02:36 PM



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

"John Saunders [MVP]" <john.saunders at trizetto.com> wrote

Quote:
"Robbo" <robinsonpr (AT) aol (DOT) com> wrote in message
news:uA$FPiB5HHA.5212 (AT) TK2MSFTNGP04 (DOT) phx.gbl...
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.
--
John Saunders [MVP]




Reply With Quote
  #6  
Old   
John Saunders [MVP]
 
Posts: n/a

Default Re: Returning custom type - 08-22-2007 , 02:48 PM



Yes.
--
John Saunders [MVP]


"Robbo" <robinsonpr (AT) aol (DOT) com> wrote

Quote:
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

"John Saunders [MVP]" <john.saunders at trizetto.com> wrote in message
news:uH9ss1E5HHA.3716 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
"Robbo" <robinsonpr (AT) aol (DOT) com> wrote in message
news:uA$FPiB5HHA.5212 (AT) TK2MSFTNGP04 (DOT) phx.gbl...
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.
--
John Saunders [MVP]





Reply With Quote
  #7  
Old   
Robbo
 
Posts: n/a

Default Re: Returning custom type - 08-23-2007 , 02:06 PM



Ah.

Ok thanks for getting back to me!

"John Saunders [MVP]" <john.saunders at trizetto.com> wrote

Quote:
Yes.
--
John Saunders [MVP]


"Robbo" <robinsonpr (AT) aol (DOT) com> wrote in message
news:OYW%23btO5HHA.2752 (AT) TK2MSFTNGP06 (DOT) phx.gbl...
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

"John Saunders [MVP]" <john.saunders at trizetto.com> wrote in message
news:uH9ss1E5HHA.3716 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
"Robbo" <robinsonpr (AT) aol (DOT) com> wrote in message
news:uA$FPiB5HHA.5212 (AT) TK2MSFTNGP04 (DOT) phx.gbl...
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.
--
John Saunders [MVP]







Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.