简体   繁体   中英

facing issue in XML to WSDL

when I create XML for web service in php I return send array to SOAP UI, but SOAP UI create reference in XML automatically eg

<s:something name='test' id='ref1'>
<s:something name='h1' />
<s:something name='h2' />
</s:something>

for next same XML

<s:something name='test' href='#ref1'>

what I want is

<s:something name='test'>
<s:something name='h1' />
<s:something name='h2' />
</s:something>

<s:something name='test'>
<s:something name='h1' />
<s:something name='h2' />
</s:something>

You're returning the same objects twice. What PHP produces in the result therefore is* :

Ok, I have an object here. I call it #1

Oh, I have to return it again. Look at #1 for details

When you want separate arrays, you have to copy the array values before returning it. So instead of

$resultArray2[] = $resultArray1[0];

You would need to clone the object:

#resultArray2[] = clone $resultArray1[0];

(Your code might differ, as I've not seen any of your code yet)


* at least, that's how I would imagine an internal monologue would sound like :-)

我发现这不是问题...它会自动将id ='ref1'赋予正在重复的元素....所以当href ='#ref1'出现时,这意味着它必须从id ='ref1进行引用元素

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM