tags:

views:

59

answers:

1

Hi guys, i have this simple type from an external webservice:

<xsd:element name="card_number" maxOccurs="1"
minOccurs="1">
<xsd:simpleType>
    <xsd:restriction base="tns:PanType">
        <xsd:pattern value="\d{16}"></xsd:pattern>
        <xsd:whiteSpace value="collapse"></xsd:whiteSpace>
    </xsd:restriction>
</xsd:simpleType>
</xsd:element>

but whe i launch wsdl2py -b filename.wsdl i got this error:

ZSI.generate.Wsdl2PythonError: unsupported local simpleType restriction: <schema targetNamespace="https://xxxxx.yyyyy.zz/sss/"&gt;&lt;complexType name="PaymentReq"><sequence><element name="card_number"><simpleType>

How can i fix this? I tried to change from simpleType to compleType and wsdl2py generate python code without problem. In this way i can't be able to use card_number in my python object.

Thanks for helping.

A: 

I'm not sure if this is still the case, but a quick google suggests that simpleTypes with user-defined restriction bases aren't supported by ZSI.

If this is still the case, then you could modify the restriction for "card_number" to remove the base and update the restriction-facets within the simpleType-restriction to reflect what the base would have provided.

If you post the content of restriction facets for PanType, we can tell you what that would be.

MattH
Thank for your response! If i change this line <xsd:restriction base="tns:PanType"> with this <xsd:restriction base="xsd:string"> it works, but it changes data type.I don't know Pantype's content, because it stays on external server: xmlns:tns="https://xxx.yyy.it/sss/"How do you modify above element?Thank you.
diegor
You should be able to resolve `PanType`, is it not referenced by a `location` definition?
MattH
Nop! The locations that i see on wsdl file are location of "service" tag. This wsdl is provided by a bank and i ask them PanType definition. I'm not confident in them positive response. :-|
diegor
Obviously, I'm not seeing the whole picture, but if what you say is true: that you have no access to the schema definition for `PanType` then I don't see how you could be expected to produce valid elements with restrictions based on it.
MattH
Exactly! I hope that the bank give me definition of PanType.Thank you very much, for now! :)
diegor
Bank told me to use xsd:string and ignore Pantype.Thanks for your help!
diegor
You're very welcome! You might want to gently suggest to them that including dependencies to private documents in "published" API's isn't particularly helpful.
MattH
Surely I'll do! :)
diegor