views:

52

answers:

1

Hey guys! I have been given a WSDL with all the method requests and responses, and all the objects I'll need to use for creating a few webmethods.

The thing is, I don't know what to do with it. I've added the WSDL as a Service Reference. I can see the methods and structures, I can instantiate them, it's all there, but the project doesn't build as soon as I add the WSDL.

"Error 2 The type name 'ServiceReference1' does not exist in the type 'WSPELab.WSPELab' C:\Users\JJ\Documents\Visual Studio 2008\Projects\WSPELab\WSPELab\Service References\ServiceReference1\Reference.cs 21 111 WSPELabSLN

Is it a stupid namespace error on my part?

EDIT : Forgot to add this. With the WSDL added, can I used the structures it contains directly? Or are they just "listings" for me to implement?

Thanks!

+3  A: 

A WSDL is a machine-readable file that describes the methods and types exposed by a web service. Many IDEs, including Eclipse and Visual Studio, can import these and create programming language classes that match the definitions given in the WSDL.

For example, importing a WSDL in a Visual Studio C# project will create a Reference.cs file that contains these definitions. You have to instantiate and call these definitions the same as you do for any classes.

var webServiceReference = new WsdlNamespace.ClassDefinedInWsdl();
WsdlNamespace.ParamClassDefinedInWsdl dataToGet;
WsdlNamespace.ReturnCodeTypeDefinedInWsdl retCode = webServiceReference.MethodDefinedInWsdl("params expected by method", out dataToGet);
if (retCode == WsdlNamespace.ReturnCodeValueMeaningAllIsWell)
{
    // use properties of dataToGet
}

Giving any more detail would require showing us the actual WSDL.

Dour High Arch
Thanks! I was going in the right direction but there was some weird namespace error.I started a new project and added the reference, I can now use all the existing classes.Thanks again!
Johnny