locked
Why is WS_CONTRACT_DESCRIPTION not supported for Windows Store Apps

    Question

  • I used wsutil to generate the client side proxy files.  I added the files produced by wsutil to my Windows Store App project.  Unfortunately the project failed to compile.  It looks like WS_CONTRACT_DESCRIPTION is not supported for Windows Store Apps, even though the msdn documentation says that it is.

    C:\Program Files (x86)\Windows Kits\8.0\Include\um\WebServices.h

    #pragma region Desktop Family
    #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)

    typedef struct _WS_CONTRACT_DESCRIPTION WS_CONTRACT_DESCRIPTION;

    ...

    1. Is there a reason why WS_CONTRACT_DESCRIPTION is not supported?

    2. Was this an oversight?

    3. Is there another tool that would generate the client side proxy from a wsdl and xsd file that's supported on Windows Store Apps?

    Tuesday, December 17, 2013 3:22 AM

Answers

  • Thanks for the repro.  I will dig in. 

    Ya, my thought is you can create a C# winmd possibly to get around this.  In the mean time I can see if this is all just a problem with the headers.  You could in theory modify the problem header and test but again, probably not supported if something goes awry.

    Jeff


    Jeff Sanders (MSFT)

    @jsandersrocks - Windows Store Developer Solutions @WSDevSol
    Getting Started With Windows Azure Mobile Services development? Click here
    Getting Started With Windows Phone or Store app development? Click here
    My Team Blog: Windows Store & Phone Developer Solutions
    My Blog: Http Client Protocol Issues (and other fun stuff I support)

    Tuesday, December 17, 2013 8:19 PM
    Moderator
  • Thanks Jeff, your suggestion on pulling in the definition of a WS_CONTRACT_DESCRIPTION worked!  I would argue that this should be fixed in the SDK and not the documentation.  I'm hoping that there are no side effects.  For now the problem is solved.
    • Marked as answer by NickDala Wednesday, December 18, 2013 2:16 AM
    Wednesday, December 18, 2013 2:15 AM

All replies

  • Hi Nick,

    The headers exclude it so no it is not supported.  I will file a documentation bug.  I am a bit rusty on WSDL.  Is that a unique property?  Can you create a reference in C#?

    Jeff


    Jeff Sanders (MSFT)

    @jsandersrocks - Windows Store Developer Solutions @WSDevSol
    Getting Started With Windows Azure Mobile Services development? Click here
    Getting Started With Windows Phone or Store app development? Click here
    My Team Blog: Windows Store & Phone Developer Solutions
    My Blog: Http Client Protocol Issues (and other fun stuff I support)

    Tuesday, December 17, 2013 6:35 PM
    Moderator
  • Thanks Jeff for the reply. You can use the wsdl from the msdn site http://msdn.microsoft.com/en-us/library/windows/desktop/dd430514(v=vs.85).aspx to generate the proxy classes. 

    Steps to reproduce.

    1. Copy the following to a file named example.wsdl


    <?xml version="1.0" encoding="utf-8"?>
    <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://Example.org"
    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" targetNamespace="http://Example.org"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
     <wsdl:types>
      <xs:schema xmlns:tns="http://Example.org" elementFormDefault="qualified"
      targetNamespace="http://Example.org" xmlns:xs="http://www.w3.org/2001/XMLSchema">
       <xs:element name="SimpleMethod">
        <xs:complexType>
         <xs:sequence>
          <xs:element name="a" type="xs:int" />
          <xs:element name="b" type="xs:int" />
         </xs:sequence>
        </xs:complexType>
       </xs:element>
       <xs:element name="SimpleMethodResponse">
        <xs:complexType>
         <xs:sequence>
          <xs:element name="b" type="xs:int" />
          <xs:element name="c" type="xs:int" />
         </xs:sequence>
        </xs:complexType>
       </xs:element>
      </xs:schema>
     </wsdl:types>
     <wsdl:message name="ISimpleService_SimpleMethod_InputMessage">
      <wsdl:part name="parameters" element="tns:SimpleMethod" />
     </wsdl:message>
     <wsdl:message name="ISimpleService_SimpleMethod_OutputMessage">
      <wsdl:part name="parameters" element="tns:SimpleMethodResponse" />
     </wsdl:message>
     <wsdl:portType name="ISimpleService">
      <wsdl:operation name="SimpleMethod">
       <wsdl:input wsaw:Action="http://Example.org/ISimpleService/SimpleMethod"
       message="tns:ISimpleService_SimpleMethod_InputMessage" />
       <wsdl:output wsaw:Action="http://Example.org/ISimpleService/SimpleMethodResponse"
       message="tns:ISimpleService_SimpleMethod_OutputMessage" />
      </wsdl:operation>
     </wsdl:portType>
     <wsdl:binding name="DefaultBinding_ISimpleService" type="tns:ISimpleService">
      <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
      <wsdl:operation name="SimpleMethod">
       <soap:operation soapAction="http://Example.org/ISimpleService/SimpleMethod"
       style="document" />
       <wsdl:input>
        <soap:body use="literal" />
       </wsdl:input>
       <wsdl:output>
        <soap:body use="literal" />
       </wsdl:output>
      </wsdl:operation>
     </wsdl:binding>
     <wsdl:service name="SimpleService">
      <wsdl:port name="ISimpleService" binding="tns:DefaultBinding_ISimpleService">
       <soap:address location="http://Example.org/ISimpleService" />
      </wsdl:port>
     </wsdl:service>
    </wsdl:definitions>

    2. Run wsutil from a Visual Studio 2012 Command Prompt.

    C:\temp\wsdl>wsutil /wsdl:example.wsdl /noservice

    Microsoft (R) Windows Web Services Tool, version 1.0095
    Copyright (c) Microsoft Corporation.  All rights reserved.
    Compiler finished successfully.
    Description for Schema information, WSDL information, policy information has been generated.

    C:\temp\wsdl>dir

    12/17/2013  02:43 PM             2,488 example.wsdl
    12/17/2013  02:47 PM            17,461 example.wsdl.c
    12/17/2013  02:47 PM            11,711 example.wsdl.h

    3.  Rename example.wsdl.c to example.wsdl.cpp.

    4. Edit example.wsdl.cpp and #include the precompiled header.

    #include "pch.h" 

    5. Create a C++ Windows Runtime Component and add example.wsdl.h and example.wsdl.cpp to the project.

    6. Compile and observe the error.

    I was hoping that wsutil would generate proxy classes that can be consumed in Windows Store App projects. 

    I will try to create a C# reference to work around this issue.

    Tuesday, December 17, 2013 8:15 PM
  • Thanks for the repro.  I will dig in. 

    Ya, my thought is you can create a C# winmd possibly to get around this.  In the mean time I can see if this is all just a problem with the headers.  You could in theory modify the problem header and test but again, probably not supported if something goes awry.

    Jeff


    Jeff Sanders (MSFT)

    @jsandersrocks - Windows Store Developer Solutions @WSDevSol
    Getting Started With Windows Azure Mobile Services development? Click here
    Getting Started With Windows Phone or Store app development? Click here
    My Team Blog: Windows Store & Phone Developer Solutions
    My Blog: Http Client Protocol Issues (and other fun stuff I support)

    Tuesday, December 17, 2013 8:19 PM
    Moderator
  • Thanks Jeff, your suggestion on pulling in the definition of a WS_CONTRACT_DESCRIPTION worked!  I would argue that this should be fixed in the SDK and not the documentation.  I'm hoping that there are no side effects.  For now the problem is solved.
    • Marked as answer by NickDala Wednesday, December 18, 2013 2:16 AM
    Wednesday, December 18, 2013 2:15 AM
  • Excellent!  I did find a bug on this for Windows 8.0 and I am not sure why this has not been fixed.  I am in contact with the SDK team to determine why the fix was not deployed (there may be another reason other than an oversight).

    Jeff Sanders (MSFT)

    @jsandersrocks - Windows Store Developer Solutions @WSDevSol
    Getting Started With Windows Azure Mobile Services development? Click here
    Getting Started With Windows Phone or Store app development? Click here
    My Team Blog: Windows Store & Phone Developer Solutions
    My Blog: Http Client Protocol Issues (and other fun stuff I support)

    Wednesday, December 18, 2013 1:27 PM
    Moderator