Forum Discussion

princetd001's avatar
princetd001
New Contributor
15 years ago

how do I pass subclass in soap ui?

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cred="http://xmlschema.tmi.telus.com/srv/CMO/OrderMgmt/CreditAssessmentServiceRequestResponse_v1" xmlns:cred1="http://xmlschema.tmi.telus.com/xsd/Customer/Customer/CreditAssessmentRequestTypes_v1">
<soapenv:Header/>
<soapenv:Body>
<cred:searchCreditAssessmentReports>
<cred:userId>T000381</cred:userId>
<cred:creditAssessmentRequestId>1867</cred:creditAssessmentRequestId>
<cred:creditAssessmentReportRequest>
<cred1:reportType>CORP_REGISTRY</cred1:reportType>
</cred:creditAssessmentReportRequest>
</cred:searchCreditAssessmentReports>
</soapenv:Body>
</soapenv:Envelope>


PARENT CLASS :
<!-- Credit Assessment Request complex types -->
<xs:complexType name="CreditAssessmentReportRequest">
<xs:sequence>
<xs:element name="reportType" type="tns:CreditAssessmentReportType"/>
</xs:sequence>
</xs:complexType>


SUB CLASS :
<xs:complexType name="CorporateCreditAssessmentReportRequest">
<xs:complexContent mixed="false">
<xs:extension base="tns:CreditAssessmentReportRequest">
<xs:sequence>
<xs:element name="businessName" type="xs:string" minOccurs="0"/>
<xs:element name="incorporationNumber" type="xs:string" minOccurs="0"/>
<xs:element name="jurisdiction" type="tns:JurisdictionType"/>
<xs:element name="jurisdictionCountryCode" type="tns:JurisdictionCountryType"/>
<xs:element name="otherJurisdictionDescription" type="xs:string" minOccurs="0"/>
<xs:element name="creditAddress" type="tns:CreditAddress" minOccurs="0"/>
<xs:element minOccurs="0" maxOccurs="100" name="phoneNumber" type="tns:PhoneNumber" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>


CorporateCreditAssessmentReportRequest is sub class of CreditAssessmentReportRequest.

In soap ui , the interface, searchCreditAssessmentReports, accepts parent class CreditAssessmentReportRequest as input parameter.

But input parameter can be sub classes of CreditAssessmentReportRequest, so I need to pass or make type as subclass.

How do I do that?
  • Hello,

    You need to do something like this( in groovy test step):

    request = testRunner.testCase.testSteps["IsValidEmail"].properties["Request"].value
    //modify xml in request
    testRunner.testCase.testSteps["IsValidEmail"].properties["Request"].value = request


    How to process XML groovy see: http://groovy.codehaus.org/Processing+XML

    Hope this helps,
    robert
  • currently Iam creating a soap ui project and passing the wsdl url.It creates the project like this
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cred="http://xmlschema.tmi.telus.com/srv/CMO/OrderMgmt/CreditAssessmentServiceRequestResponse_v1" xmlns:cred1="http://xmlschema.tmi.telus.com/xsd/Customer/Customer/CreditAssessmentRequestTypes_v1">
    <soapenv:Header/>
    <soapenv:Body>
    <cred:searchCreditAssessmentReports>
    <cred:userId>T000381</cred:userId>
    <cred:creditAssessmentRequestId>1867</cred:creditAssessmentRequestId>
    <cred:creditAssessmentReportRequest>
    <cred1:reportType>CORP_REGISTRY</cred1:reportType>
    </cred:creditAssessmentReportRequest>
    </cred:searchCreditAssessmentReports>
    </soapenv:Body>
    </soapenv:Envelope>

    and the there is a green button [submit request to specified end point]
    this will execute my searchCreditAssessmentReports method in the webservice.
    and the result will be shown in the right pane.

    But if I want to pass the subclass what I have to do ?
    subclass structure in my xsd as shown below
  • PARENT CLASS = creditAssessmentReportRequest
    SUBCLASS = CorporateCreditAssessmentReportRequest

    Pass subclass to parent class by using xsi:type="ns2:

    <ns5:creditAssessmentReportRequest 
    xsi:type="ns2:CorporateCreditAssessmentReportRequest"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <ns2:reportType>CORP_REGISTRY</ns2:reportType>