opened
outadoc
username_0
I'm trying to generate a WCF reference to an internal SOAP service into a .NET 4.6 project. I get this error whenever I try to import the WSDL:

```
Importing web service metadata ...
Number of services found: 1
Restoring NuGet packages ...
Building solution ...
Scaffolding service reference code ...

Error: Style Document on header id does not match expected style Rpc.
Error: Style Document on header version does not match expected style Rpc. 
Error: Style Document on header type does not match expected style Rpc.
Error: Style Document on header mode_envoi does not match expected style Rpc.
Error: Style Document on header mode_production does not match expected style Rpc.
Error: Style Document on header format does not match expected style Rpc.
Error: Style Document on header piecesJointes does not match expected style Rpc.
Error: An unknown error occurred while invoking the service metadata component.
Failed to generate service reference.
```

I stumbled upon [this thread](https://stackoverflow.com/questions/22327560/error-generating-c-sharp-proxy-with-svcutil) and since we mostly run Java apps, it doesn't seem unlikely that there's an incompatibility somewhere. Nonetheless, I'm wondering if it should be considered or not as a bug here.
Error: Style on header does not match expected style Rpc
issue
created
outadoc
username_0
More details: it should be of type Document and works correctly if that's fixed. **However**, when adding a service reference with the old system, it works fine; the errors are only considered as warnings. This is only a problem when using the *WCF Web Service Reference Provider* extension.
comment
created
hongdai
username_1
@username_0 Sorry to hear that you are running into an issue! We will try to repro locally and identify the root cause.

Thanks,
Hong Dai
comment
created
hongdai
username_1
@username_0 We are able to reproduce the issue locally and will evaluate the support.

Thanks for reporting it!
-Hong Dai
comment
created
outadoc
username_0
Thank you @username_1!
comment
created
mlacouture
username_2
Hi @username_0 

Visual Studio 15.5 Preview 2 is now available and we provided several fixes to the tool in this update.  Would you be able to try your scenario with this version of VS and if you continue to hit this problem provide us with more details? if possible for you, the service url or wsdl files?

thank you again,
Miguel Lacouture
comment
created
outadoc
username_0
Hi @username_2, unfortunately I won't be able to test this out until at least the 13th; I hope that's okay.

Thank you for the follow-up!
comment
created
mlacouture
username_2
@username_0 , in the meantime if you can provide us with a wsdl file we can use to reproduce this issue that would be great.  thanks,
comment
created
outadoc
username_0
Hi, sorry for the delay. Here's a sample (obfuscated) WSDL:

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2-hudson-752-. -->
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2-hudson-752-. -->
<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://soapservice.company.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://soapservice.company.com/" name="service">
  <types>
    <schema>
      <import namespace="http://soapservice.company.com/" schemaLocation="https://ediris.dev.company.com:443/service/service?xsd=1" />
    </schema>
  </types>
  <message name="serviceMethod">
    <part name="flux" type="tns:flux" />
    <part name="id" element="tns:id" />
    <part name="version" element="tns:version" />
    <part name="type" element="tns:type" />
    <part name="mode_envoi" element="tns:mode_envoi" />
    <part name="mode_production" element="tns:mode_production" />
    <part name="format" element="tns:format" />
    <part name="piecesJointes" element="tns:piecesJointes" />
  </message>
  <message name="serviceMethodResponse">
    <part name="document" type="tns:response" />
  </message>
  <message name="FaultMsg">
    <part name="fault" element="tns:FaultMsg" />
  </message>
  <portType name="service">
    <operation name="serviceMethod" parameterOrder="id version type mode_envoi mode_production format flux piecesJointes">
      <input wsam:Action="http://soapservice.company.com/service/serviceMethodRequest" message="tns:serviceMethod" />
      <output wsam:Action="http://soapservice.company.com/service/serviceMethodResponse" message="tns:serviceMethodResponse" />
      <fault message="tns:FaultMsg" name="FaultMsg" wsam:Action="http://soapservice.company.com/service/serviceMethod/Fault/FaultMsg" />
    </operation>
  </portType>
  <binding name="servicePortBinding" type="tns:service">
    <binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
    <operation name="serviceMethod">
      <operation soapAction="" />
      <input>
        <body use="literal" parts="flux" namespace="http://soapservice.company.com/" />
        <header message="tns:serviceMethod" part="id" use="literal" />
        <header message="tns:serviceMethod" part="version" use="literal" />
        <header message="tns:serviceMethod" part="type" use="literal" />
        <header message="tns:serviceMethod" part="mode_envoi" use="literal" />
        <header message="tns:serviceMethod" part="mode_production" use="literal" />
        <header message="tns:serviceMethod" part="format" use="literal" />
        <header message="tns:serviceMethod" part="piecesJointes" use="literal" />
      </input>
      <output>
        <body use="literal" namespace="http://soapservice.company.com/" />
      </output>
      <fault name="FaultMsg">
        <fault name="FaultMsg" use="literal" />
      </fault>
    </operation>
  </binding>
  <service name="service">
    <port name="servicePort" binding="tns:servicePortBinding">
      <address location="https://ediris.dev.company.com:443/service/service" />
    </port>
  </service>
</definitions>

```
comment
created
mlacouture
username_2
Hi @username_0 

thank you for providing the service wsdl, unfortunately it contains an import reference to a secure site so I cannot download the full schema.  can you use your browser or svcutil.exe to download the metadata as a single wsdl by providing the '?singlewsdl' query?

thanks,
comment
created
outadoc
username_0
Hi, here you go.

`soapservice.company.com.xsd`

```xml
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:tns="http://soapservice.company.com/" targetNamespace="http://soapservice.company.com/" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="FaultMsg" nillable="true" type="tns:CompositionException" />
  <xs:element name="format" nillable="true" type="xs:string" />
  <xs:element name="id" nillable="true" type="xs:string" />
  <xs:element name="mode_envoi" nillable="true" type="xs:string" />
  <xs:element name="mode_production" nillable="true" type="xs:string" />
  <xs:element name="piecesJointes" nillable="true" type="tns:piecesJointes" />
  <xs:element name="type" nillable="true" type="xs:string" />
  <xs:element name="version" type="xs:int" />
  <xs:complexType name="flux">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" name="E" type="tns:enregistrement" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="enregistrement">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" name="C" type="tns:champ" />
    </xs:sequence>
    <xs:attribute name="id" type="xs:string" />
    <xs:attribute name="ordre" type="xs:int" use="required" />
  </xs:complexType>
  <xs:complexType name="champ">
    <xs:simpleContent>
      <xs:extension base="xs:string">
        <xs:attribute name="id" type="xs:string" />
        <xs:attribute name="ordre" type="xs:int" use="required" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  <xs:complexType name="piecesJointes">
    <xs:sequence>
      <xs:element minOccurs="0" maxOccurs="unbounded" name="piecesJointes" type="tns:pieceJointe" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="pieceJointe">
    <xs:sequence>
      <xs:element minOccurs="0" name="extension" type="xs:string" />
      <xs:element minOccurs="0" name="fichier" type="xs:byte" />
      <xs:element minOccurs="0" name="nom" type="xs:string" />
      <xs:element name="nbrPages" type="xs:int" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="response">
    <xs:sequence>
      <xs:element minOccurs="0" name="idDemande" type="xs:string" />
      <xs:element minOccurs="0" name="idComposition" type="xs:string" />
      <xs:element minOccurs="0" name="documentSource" type="xs:base64Binary" />
      <xs:element minOccurs="0" name="extension" type="xs:string" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="CompositionException">
    <xs:sequence>
      <xs:element minOccurs="0" name="message" type="xs:string" />
    </xs:sequence>
  </xs:complexType>
</xs:schema>
```

`soapservice.company.com.wsdl`
```xml
<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:tns="http://soapservice.company.com/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" name="service" targetNamespace="http://soapservice.company.com/" xmlns="http://schemas.xmlsoap.org/wsdl/">
  <types>
    <xsd:schema>
      <xsd:import schemaLocation="https://ediris.dev.company.com:443/service/service?xsd=1" namespace="http://soapservice.company.com/" />
    </xsd:schema>
  </types>
  <message name="serviceMethod">
    <part name="flux" type="tns:flux" />
    <part name="id" element="tns:id" />
    <part name="version" element="tns:version" />
    <part name="type" element="tns:type" />
    <part name="mode_envoi" element="tns:mode_envoi" />
    <part name="mode_production" element="tns:mode_production" />
    <part name="format" element="tns:format" />
    <part name="piecesJointes" element="tns:piecesJointes" />
  </message>
  <message name="serviceMethodResponse">
    <part name="document" type="tns:response" />
  </message>
  <message name="FaultMsg">
    <part name="fault" element="tns:FaultMsg" />
  </message>
  <portType name="service">
    <operation name="serviceMethod" parameterOrder="id version type mode_envoi mode_production format flux piecesJointes">
      <input wsam:Action="http://soapservice.company.com/service/serviceMethodRequest" message="tns:serviceMethod" />
      <output wsam:Action="http://soapservice.company.com/service/serviceMethodResponse" message="tns:serviceMethodResponse" />
      <fault wsam:Action="http://soapservice.company.com/service/serviceMethod/Fault/FaultMsg" name="FaultMsg" message="tns:FaultMsg" />
    </operation>
  </portType>
  <binding name="servicePortBinding" type="tns:service">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
    <operation name="serviceMethod">
      <soap:operation soapAction="" />
      <input>
        <soap:body use="literal" namespace="http://soapservice.company.com/" parts="flux" />
        <soap:header message="tns:serviceMethod" part="id" use="literal" />
        <soap:header message="tns:serviceMethod" part="version" use="literal" />
        <soap:header message="tns:serviceMethod" part="type" use="literal" />
        <soap:header message="tns:serviceMethod" part="mode_envoi" use="literal" />
        <soap:header message="tns:serviceMethod" part="mode_production" use="literal" />
        <soap:header message="tns:serviceMethod" part="format" use="literal" />
        <soap:header message="tns:serviceMethod" part="piecesJointes" use="literal" />
      </input>
      <output>
        <soap:body use="literal" namespace="http://soapservice.company.com/" />
      </output>
      <fault name="FaultMsg">
        <soap:fault use="literal" name="FaultMsg" namespace="" />
      </fault>
    </operation>
  </binding>
  <service name="service">
    <port name="servicePort" binding="tns:servicePortBinding">
      <soap:address location="https://ediris.dev.company.com:443/service/service" />
    </port>
  </service>
</definitions>
```
comment
created
mlacouture
username_2
@username_0, thank you very much for the updated wsdl files.

I just verified and confirmed we have a fix for this issue, it will be available in Visual Studio 2017 15.6 Preview 1 which is to be release in less than a month from now.
comment
closed
mlacouture
username_2
issue
created
mlacouture
username_2
Hi @username_0, please let us know if you still need help with this issue, closing for now.  Thanks again.
comment