Menu

#112 wsdl2py generates wrong pname parameter

v2.0
closed-fixed
zsi (169)
5
2006-02-08
2006-02-02
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

  • Geoff Talvola

    Geoff Talvola - 2006-02-02

    wsdl file

     
  • Geoff Talvola

    Geoff Talvola - 2006-02-02

    services.py file

     
  • Joshua Boverhof

    Joshua Boverhof - 2006-02-03
    • status: open --> closed
     
  • Joshua Boverhof

    Joshua Boverhof - 2006-02-03
    • assigned_to: nobody --> boverhof
    • status: closed --> closed-works-for-me
     
  • Joshua Boverhof

    Joshua Boverhof - 2006-02-03

    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.

     
  • Joshua Boverhof

    Joshua Boverhof - 2006-02-03
    • status: open --> pending
     
  • Joshua Boverhof

    Joshua Boverhof - 2006-02-03

    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.)

     
  • Geoff Talvola

    Geoff Talvola - 2006-02-03
    • status: pending --> open
     
  • Joshua Boverhof

    Joshua Boverhof - 2006-02-04
    • status: open --> pending-fixed
     
  • Joshua Boverhof

    Joshua Boverhof - 2006-02-04

    Logged In: YES
    user_id=711996

    I changed this so for rpc/enc the client side will not care what the response
    name is. Basic Profile interprets WSDL-1.1 as requiring responses to be
    wrapped with operation name + "Response" but I'll allow maximum slop for rpc/
    encoded.

    If this fixes your problem please respond back so I can close this "bug".

     
  • Geoff Talvola

    Geoff Talvola - 2006-02-08
    • status: pending-fixed --> closed-fixed
     
  • Geoff Talvola

    Geoff Talvola - 2006-02-08

    Logged In: YES
    user_id=88162

    Thank you -- I grabbed the latest code from CVS and it
    solved my problem.

     

Log in to post a comment.