cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1354
Views
0
Helpful
4
Replies

Dynamic Arrays in WebServiceExecute

rruckley
Level 1
Level 1

Team IAC,

I have a integration I'm working on where I have to update data in HP Service Manager using a SOAP call. The operation is an update operation but there's a caveat: To update an array of data, there is no operation to simply add a new item to the array, I have to read the entire array, add the new item and perform the update providing the new array back.

My problem is getting this to work. Whilst I can read the existing array (after some removal of xmlns, xsl transform into simple table, then read into table) and spit out what I think is the correct XML, the web service execute activity doesn't help me when trying to construct the right XML to supply.

The WSDL says my data should look like this:

<ChildCIs type="Array">

        <ChildCIs type="String">existingdevice01</ChildCIs>

</ChildCIs>

I'm trying to generate a new xml fragment like this:

<ChildCIs type="Array">

        <ChildCIs type="String">existingdevice01</ChildCIs>

        <ChildCIs type="String">newdevice01</ChildCIs>

</ChildCIs>

But when I snoop on the traffic to the HP system, the data sent is only this:

<ChildCIs type="Array" />

As the web service execute uses strange proxy types, I'm not sure what I should be supplying. I'm using the 'Specify class using an XML string' option as follows:

<?xml version="1.0" encoding="utf-16"?>

  <RelationshipInstanceTypeChildCIs type="Array">

<RelationshipInstanceTypeChildCIs>existingdevice01</RelationshipInstanceTypeChildCIs>

<RelationshipInstanceTypeChildCIs>newdevice01</RelationshipInstanceTypeChildCIs>

   </RelationshipInstanceTypeChildCIs>

For reference, here's the XML that appears in that same window on a brand new copy of web service execute pointing at the same SOAP call:

<?xml version="1.0" encoding="utf-16"?>

<RelationshipInstanceTypeChildCIs xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" type="Array" />

Looking at that now makes me think perhaps its a namespace issue?

--

Ryan

4 Replies 4

Hi, Ryan!

This could be related to a namespace or it could be related to something else, unfortunately, it is hard to figure this out based on the information you provided so far.

If you can post an example of SOAP response (unmodified) that contains the array with some data in it, it might shed some light onto how the input is supposed to look like.

Svetlana

Another recommendation is...

1) Try constructing calls using SOAPUI utility. This will give you an idea of how "raw" XML supposed to look like for the Web Service methods you are trying to call.

2) The excercise with SOAPUI might provide insight into the right structure/namespaces expected by the calls. You can then try to fix up web service execute activity.

3) Alternatively, you can then replicate these SOAPUI sample calls in PO using "Web HTTP Request" activity, as opposed "Web Service Execute".

Svetlana

Svetlana,

The output that should be sent should look like this:

http://www.w3.org/2001/XMLSchema

" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance

" status="SUCCESS" message="Success" schemaRevisionDate="2013-11-26" schemaRevisionLevel="0" returnCode="0">

  http://schemas.hp.com/SM/7

">

   

      Parent/Child

      parentdevice01

   

   

      u-lumo-vic-xm1-avs-lumo

      Parent/Child

     

        existingdevice01         

        newdevice01

     

      Logical

      Contains

     

   

 

As stated above, the web service call simply ignores what I've tried to put into the XML box. I've used SoapUI extensively and I'm now resigned to using the HTTP POST option as the Web Service execute simply doesn't work as expected. Unless there's some other way to supply a dynamic array using this activity?

Ryan

Given the snippet you posted namespace is required for this to work properly.

xmlns="http://schemas.hp.com/SM/7" declaration in the above snippet says that ChildCIs is part of that namespace.

So, try these 2 versions

xmlns="http://schemas.hp.com/SM/7">

existingdevice01

newdevice01

OR

xmlns:sm="http://schemas.hp.com/SM/7">

existingdevice01

newdevice01

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: