5
Vote

Cannot use xs:extension in WSCF blue

description

Since moving to VisualStudio2010 & WSCF blue I can no longer generate server side code. No problems with previous versions.
From the XSD I can generate the WSDL without any issues.
Choosing the wsdl -Generate Web Service Code. Select Server Side I get the following errors...
 
 
Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: These members may not be derived.

XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.***.com/oGIPI']/wsdl:portType[@name='iGIPIInterface']

Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='http://www.***.com/oGIPI']/wsdl:portType[@name='iGIPIInterface']

XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.***.com/oGIPI']/wsdl:binding[@name='BasicHttpBinding_iGIPIInterface']

Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://www.***.com/oGIPI']/wsdl:binding[@name='BasicHttpBinding_iGIPIInterface']

XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.***.com/oGIPI']/wsdl:service[@name='iGIPIPort']/wsdl:port[@name='iGIPIPort']

 
Any help appreciated

comments

ybdub wrote Nov 11, 2010 at 12:06 PM

This issue is down to the use of xs:extension in my XSD.
Removing the xs:extension fixes the issue, server code is generated without issue. but obviously it generates different code which would be a breaking change for my component & all clients...
I'll keep looking for a workaround...

E.G.
<xs:element name="registerPunterRequest" type="RegisterPunterRequest" />
<xs:complexType name="RegisterPunterRequest">
<xs:complexContent>
  <xs:extension base="myco:GenericRequest" >
    <xs:sequence>
      <xs:element name="Username" type="myco:UsernameType" minOccurs="1" maxOccurs="1" />
....
    </xs:sequence>
  </xs:extension>
</xs:complexContent>

</xs:complexType>

in a seperate XSD (putting them in the same xsd give the same error)

<xs:complexType name="GenericRequest" abstract="true">
<xs:sequence>
  <xs:element name="header" type="Header" minOccurs="1" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
<!--GenericResponse--> <xs:complexType name="GenericResponse" abstract="true">
<xs:sequence>
  <xs:element name="returnCode" type="ReturnCode" minOccurs="1" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
....

wrote Nov 11, 2010 at 12:09 PM

wrote May 12, 2011 at 11:59 AM

wrote Sep 5, 2011 at 6:44 PM

roboguy wrote Oct 31, 2011 at 1:03 AM

I'm striking this exact same problem. Did you find a work around?

Cheers,
James

wrote Oct 31, 2011 at 1:04 AM

ybdub wrote Nov 1, 2011 at 10:25 AM

Hi James,

I'm afraid I never did find a satisfactory workaround. The last time I needed to update my xsd I did so in VS2005 and then copied the generated code to my VS2010/WSCF blue solution. (I have not had to change this component since.)
If you need to update your XSD or component on a regular basis I doubt this would be acceptable.

Regards,
Yvonne

wrote Feb 7, 2012 at 8:07 PM

RoboJ1M wrote Oct 3, 2012 at 2:03 PM

Disaster!
I just found this project yesterday after being asked to produce a SOAP wrapper for our business layer which is all built around a set of schemas.
Thought this was the answer but we use extensions everywhere!
Tried changing my element to a type and wrapping that in an element but that also fails:
<xs:complexType name="CreateFormInput">
    <xs:complexContent>
        <xs:extension base="wst:MethodInput">
            <xs:sequence>

snip

            </xs:sequence>
        </xs:extension>
    </xs:complexContent>
</xs:complexType>
<xs:element name="CreateEventsFormInputWrapped" type="CreateEventsFormInput" substitutionGroup="wst:WS2MethodInput"/>

RoboJ1M wrote Oct 3, 2012 at 2:46 PM

In other news, if you change the following line in the wsdl:
<part name="parameters" element="import0:CreateFormInput" />
to this:
<part name="anythingEXCEPTparameters" element="import0:CreateFormInput" />
It now works. Extensions and all.

See:

public partial class CreateFormInput1 : MethodInput
{
//blah
}

RoboJ1M wrote Oct 3, 2012 at 3:25 PM

More useful information:

http://pzf.fremantle.org/2007/05/handlign.html

If we're lucky, we can change the XSD/WSDL in a way that allows you to force .NET to drop out of "unwrapping" the parameters

wrote Feb 21, 2013 at 11:16 PM