Returning custom type

R

Robbo

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
 
J

John Saunders [MVP]

Robbo said:
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.
 
R

Robbo

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

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 said:
Robbo said:
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.
 
J

John Saunders [MVP]

Robbo said:
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.
 
R

Robbo

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
 
J

John Saunders [MVP]

Yes.
--
John Saunders [MVP]


Robbo said:
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
 

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

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,142
Latest member
arinsharma
Top