Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

SOAP Client Form XML

LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in SOAtest
SOAP Client Form XML with XML Data Bank
Hi,

We're using the "Form XML" view to construct our SOAP Client test request message. We also use a method to format the data input from our excel datasource and store with XML Data Bank (with XPath). Our datasource column sometimes would contain a list of data seperated by a comma like: A, B, C. If we have a column which contains three values (A,B,C), then we would like to construct the message element repeat three times.
Such as:
<Type>A</Type>
<Type>B</Type>
<Type>C</Type>

But right now, using the method, we have the message like:
<Type>
<Type>A</Type>
<Type>B</Type>
<Type>C</Type>
</Type>
Which has an extra <Type> parent element.

Is there a way to construct this kind of message using 'Form XML" view. We have to use "Form XML" view because of some other constraints. Thanks in advance for your help.

Thanks,
Qionghua
Tagged:

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Hello,

    I'm assuming that this type of behavior is not tied to the number 3. I'm assuming you could have any number N of comma separated values and want N type elements correct? If it is tied to 3, then this is quite simple with Form XML

    I think using the method tool is the best way to approach this.
    So, we should look into why there is the extra <type> parent element, and working to take it out.

    If you could explain a little bit more about you current setup, and the code you are using in your method, I can try to help you get what you are looking for.

    ~Joe
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Thanks Joe for your reply.

    We do use the Method tool with Return Value->XML Data Bank. In the XML Data Bank for this method, we use the XPath as below:
    /*[local-name(.)="root" and namespace-uri(.)=""]/*[local-name(.)="z0" and namespace-uri(.)=""][1]/child::node()

    And in our SOAP Client, we have the Type node parameterized with the XML Data Bank datasource.

    Thanks for your help and please let me know if it's not clear to you.

    Thanks,
    Qionghua
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Hello,

    Perhaps a better approach would be to have this type of setup.

    In your SOAP client, set Type to be some placeholder( a unique string that won't appear else where)
    Attach a method tool to the Request( this will pass the Request as a string as the "input" parameter of the Method).
    Copy in your code that read the Data Source and generates the XML and stores it in a string.
    Use the String Classes replace function to replace "<type>PLACEHOLDER_STRING</type>" with the string that was generated.
    Then return that new string after the replacement.


    ~Joe
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Thanks Joe for your suggestion. We use this solution combined with other method tool and now it works fine.

    Thanks,
    Qionghua

Tagged