Main Site Documentation

Generate client file from WSDL with MfSvcUtil


#1

Hello all,

I have a problem generating my client files from a flat WSDL with MfSvcUtil. :

  1. I have generated my flat WSDL file, which on some point give me this :

<xsd:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<xsd:element name="test_function">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="0" name="input" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="test_functionResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element xmlns:q1="http://schemas.datacontract.org/2004/07/WcfLioService" minOccurs="0" name="test_functionResult" nillable="true" type="q1:OuputObject"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<xsd:schema xmlns:tns="http://schemas.datacontract.org/2004/07/WcfLioService" elementFormDefault="qualified" targetNamespace="http://schemas.datacontract.org/2004/07/WcfLioService">
<xsd:complexType name="OuputObject">
<xsd:sequence>
<xsd:element minOccurs="0" name="integerMember" type="xsd:int"/>
<xsd:element minOccurs="0" name="stringMember" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="OuputObject" nillable="true" type="tns:OuputObject"/>
</xsd:schema>

=> a function

   
[OperationContract]
OuputObject test_function(int input);

with


    [DataContract]
    public class OuputObject
    {
        [DataMember]
        public int integerMember { get; set; }

        [DataMember]
        public string stringMember { get; set; }
    }

but when I am using MfSvcUtil, I have the following error :
"
c:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Tools>MfSvcUtil c:\TE
MP\LioService.wsdl
MfSvcUtil.exe © Microsoft 2008

Reading WSDL file: c:\TEMP\LioService.wsdl

Generating contract source: LioService.cs…
Failed to generate service code. Le type ‘http://schemas.datacontract.org/2004/0
7/WcfLioService:OuputObject’ n’est pas déclaré.

Program Error: Failed to generate service code.

.Net Micro Framework Dpws Source Code Utility
Copyright © Microsoft Corporation. All rights reserved.

Uses:
Generate C# .Net Micro Framework DPWS source code from a wsdl.
Generate a wsdl from an attributed assembly.

*** Generate code from Wsdl ***
Usage: MFSvcUtil [WsdlFilename] [SchemaFileReferences] Options
Where [WsdlFilename] = A valid WSDL path\filename.
Where [SchemaFileReferences] = Optional path to external schema
file reference(s) (xsd)
Where Options =
/D:[DestinationDirectory] or /Directory:[DestinationDirectory] to
specify the name of a directory where output files are generated.
/O:[ContractSourceName] or /Out:[ContractSourceName] to specify the
name of generated source file(s). Note: The name is used as the
contract source file name and as the prefix for Hosted Service and
Client Proxy source file names. If not specified the name of the
wsdl file is used.
/P:[TargetPlatform] or /Platform:[TargetPlatform] to specify
Microframework or Win32 target runtime platform.
/V or /Verbose to display extended information.

*** Generate a wsdl from an assembly ***
Usage: MFSvcUtil [AssemblyFilename] Options
Where [AssemblyFilename] = A valid assembly path\filename.
Where Options =
/D:[DestinationDirectory] or /Directory:[DestinationDirectory] to
specify the name of a directory where the output files are stored.
/O:[Filename] or /Out:[Filename] to specify the name of the Wsdl
file generated. The default filename is the name of the assembly that
contains the contract used to generate the wsdl.
/R:[ReferencesPath] or /Reference:[ReferencesPath] to specify
a directory used to resolve external type references.
/V or /Verbose to display extended information.

c:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Tools>
"

If I remove completely the OuputObject schema, I have exactly the same error : it seems it is not seen ?

If I make an XML error in the OuputObject schema, it is seen :
“Program Error: Il existe une erreur dans le document XML (155, 1).”

I tryed also to remove the specific schema of OuputObject and to define it in the same schema as test_function, and after in the same schema as all others types (int, string, etc), but I have exactly the same error.

I tryed to modified my test_function to return just a string : then the generation is ok.
I modifiy my test_function to return just a string but taking an OuputObject as input parameter, I have the error again.

It seems I cannot use a complex type in m function ?

Can you tell me if you already had this problem ? And/Or what can I do to resolve it ?


#2

[ just saying this ]

DPWS and WSDL in netmf seem to be scarcely referred / discussed here.


#3

Not just here, everywhere. It would be nice if someone made some tutorials around it.


#4

I’ve got a response from another forum :

http://www.netmf.com/forum/default.aspx?g=posts&m=8472&#post8472

The flat wsdl that I used is not well flatten…

I know will search how to flatten the wsdl correctly…