Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#112 wsdl2py generates wrong pname parameter

v2.0
closed-fixed
zsi (169)
5
2006-02-08
2006-02-02
Geoff Talvola
No

I used wsdl2py from ZSI-2.0-rc1 and I wound up having
to make a modification to the generated services.py
file in order to use the web service. I had to edit
the line:

OAMCommandExecResult.typecode =
Struct(pname=("urn:SoapOAM","OAMCommandExecResult"),
ofwhat=[ZSI.TC.Boolean(pname="m-bExecSuccess",
aname="_m_bExecSuccess", encoded=None, minOccurs=1,
maxOccurs=1, nillable=True),
ZSI.TC.String(pname="m-strStatusText",
aname="_m_strStatusText", encoded=None, minOccurs=1,
maxOccurs=1, nillable=True)],
pyclass=OAMCommandExecResult, encoded="urn:SoapOAM")

to:

OAMCommandExecResult.typecode =
Struct(pname=("urn:SoapOAM","executeCommandResponse"),
ofwhat=[ZSI.TC.Boolean(pname="m-bExecSuccess",
aname="_m_bExecSuccess", encoded=None, minOccurs=1,
maxOccurs=1, nillable=True),
ZSI.TC.String(pname="m-strStatusText",
aname="_m_strStatusText", encoded=None, minOccurs=1,
maxOccurs=1, nillable=True)],
pyclass=OAMCommandExecResult, encoded="urn:SoapOAM")

I've attached the wsdl and the incorrect generated
service.py file.

Discussion

1 2 > >> (Page 1 of 2)
  • Geoff Talvola
    Geoff Talvola
    2006-02-02

    wsdl file

     
    Attachments
  • Geoff Talvola
    Geoff Talvola
    2006-02-02

    services.py file

     
    Attachments
    • status: open --> closed
     
    • assigned_to: nobody --> boverhof
    • status: closed --> closed-works-for-me
     
  • Logged In: YES
    user_id=711996

    Running the command:
    %wsdl2py.py -f Service.wsdl

    correctly generated the code. I'm not sure what is going on here.

    class OAMCommandExecResult:
    def __init__(self):
    self._m_bExecSuccess = None
    self._m_strStatusText = None
    return
    OAMCommandExecResult.typecode = Struct(pname=
    ("urn:SoapOAM","executeCommandResponse"), ofwhat=[ZSI.TC.Boolean
    (pname="m-bExecSuccess", aname="_m_bExecSuccess", encoded=None,
    minOccurs=1, maxOccurs=1, nillable=True), ZSI.TC.String(pname="m-
    strStatusText", aname="_m_strStatusText", encoded=None, minOccurs=1,
    maxOccurs=1, nillable=True)], pyclass=OAMCommandExecResult,
    encoded="urn:SoapOAM")

     
  • Geoff Talvola
    Geoff Talvola
    2006-02-03

    • status: closed-works-for-me --> open
     
  • Geoff Talvola
    Geoff Talvola
    2006-02-03

    Logged In: YES
    user_id=88162

    I'm sorry, I accidentally pasted the lines in the wrong
    order above. The second line (with
    "executeCommandResponse") is what wsdl2py generated, as you
    confirmed. The first line (with "OAMCommandExecResult"
    instead) is what I had to edit it to in order to get it to
    work. These is still a bug in there, I just described it wrong.

     
    • status: open --> pending
     
  • Logged In: YES
    user_id=711996

    Looks like gSOAP-2.7.0d doesn't follow conventional style. An rpc style
    service should use the operation name "executeCommand" as the wrapper,
    and it's convention to have the response name be the request name with
    "Response" appended to it.

    So the generation is correct, but the response wrapper name shouldn't be
    enforced.

    From WSDL-1.1

    If the operation style is rpc each part is a parameter or a return value and
    appears inside a wrapper element within the body (following Section 7.1 of
    the SOAP specification). The wrapper element is named identically to the
    operation name and its namespace is the value of the namespace attribute.
    Each message part (parameter) appears under the wrapper, represented by an
    accessor named identically to the corresponding parameter of the call. Parts
    are arranged in the same order as the parameters of the call.

    From SOAP-1.1 Note:

    Each parameter accessor has a name corresponding to the name of the
    parameter and type corresponding to the type of the parameter. The name of
    the return value accessor is not significant. Likewise, the name of the struct is
    not significant. However, a convention is to name it after the method name
    with the string "Response" appended.

    Here is the relevant WSDL:

    <binding name="Service" type="tns:ServicePortType">
    <SOAP:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/
    http"/>
    <operation name="getOM">
    <SOAP:operation soapAction=""/>
    <input>
    <SOAP:body use="encoded" namespace="urn:SoapOAM"
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    </input>
    <output>
    <SOAP:body use="encoded" namespace="urn:SoapOAM"
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    </output>
    </operation>
    <operation name="executeCommand">
    <SOAP:operation soapAction=""/>
    <input>
    <SOAP:body use="encoded" namespace="urn:SoapOAM"
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    </input>
    <output>
    <SOAP:body use="encoded" namespace="urn:SoapOAM"
    encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
    </output>

     
  • Geoff Talvola
    Geoff Talvola
    2006-02-03

    Logged In: YES
    user_id=88162

    I'm new to SOAP, but I take it from your response that this
    part of the WSDL, which does refer to the non-standard
    response name "OAMCommandExecResult," isn't relevant:

    <portType name="ServicePortType">
    <operation name="getOM">
    <documentation>Service definition of function
    SoapOAM__getOM</documentation>
    <input message="tns:getOMRequest"/>
    <output message="tns:getOMResponse"/>
    </operation>
    <operation name="executeCommand">
    <documentation>Service definition of function
    SoapOAM__executeCommand</documentation>
    <input message="tns:executeCommandRequest"/>
    <output message="tns:OAMCommandExecResult"/>
    </operation>
    <operation name="getPSTNChannelStatus">
    <documentation>Service definition of function
    SoapOAM__getPSTNChannelStatus</documentation>
    <input message="tns:getPSTNChannelStatusRequest"/>
    <output message="tns:getPSTNChannelStatusResponse"/>
    </operation>
    </portType>

    (It is kind of odd that only one of the three functions
    doesn't follow the convention, but I'm just trying to use
    the service, I didn't write it.)

     
1 2 > >> (Page 1 of 2)