Avatar of perlwhite
perlwhite
Flag for United States of America asked on

XML Closing Tags

Hello,
I am constructing XML to make a web service call. I close one of the tags like this:
<tagname isNull="false" />
When I look at the Generated Source (Firefox), it has ignored the closing tag and has generated </tagName>.
For example,
<tag1>
    <tag2>Some Value</tag2>
    <tag3 isNull="false" />
   <tag4>Some other Value</tag4>
</tag1>
becomes
<tag1>
    <tag2>Some Value</tag2>
    <tag3 isNull="false">
   <tag4>Some other Value</tag4>
    </tag3>
    <tag3 isNull="false"></tag3>
</tag1>

Any help is appreciated!
Thanks
Web ServicesPHP

Avatar of undefined
Last Comment
perlwhite

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Pratima

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
perlwhite

ASKER
My View Source is showing the current XML. However, I am still getting an error from the web service. Is there anything else that I am overlooking?
mcnute

Are you declaring your xml document as standards are requiring?

<?xml version="1.0"?>

Open in new window

Ray Paseur

... it has ignored the closing tag ...
What is "it" in that statement?  How exactly are you constructing the XML document?
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
perlwhite

ASKER
It is the generated source.

The web service does not require the <?xml ... tag.

I am constructing xml in a php variable which is then passed to the web method.

$param = '<tag1>';
$param .= .....

I am constructing xml in the same fashion for another web method from the same web service provider and it works flawlessly.
mcnute

Try to construct the variable with double quotes instead of single quotes.

Single quotes could mess up new lines (eol).
perlwhite

ASKER
I believe I tried that but will try it again. Thanks
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Ray Paseur

I want to deconstruct this a little bit (copied from the original question).  How does this happen?  What process is changing the XML document (the becomes verb)?  These documents are not very much alike at all - in meaning or content.

For example,
<tag1>
    <tag2>Some Value</tag2>
    <tag3 isNull="false" />
   <tag4>Some other Value</tag4>
</tag1>
becomes
<tag1>
    <tag2>Some Value</tag2>
    <tag3 isNull="false">
   <tag4>Some other Value</tag4>
    </tag3>
    <tag3 isNull="false"></tag3>
</tag1>

Open in new window

SOLUTION
Ray Paseur

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
perlwhite

ASKER
View Source in Firefox shows the correct XML. View Generated Source in Firefox shows the incorrect XML.
perlwhite

ASKER
Thank you Ray for the visualization
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
Ray Paseur

That sounds like the problem might be in Firefox.  If your program code is creating a valid XML document, it doesn't seem like FF is rendering it correctly with View Generated Source.
perlwhite

ASKER
I sent the XML using the WCFStorm tool and I get a successful response.

I took the exact same XML and sent it via PHP and I get the "Object reference not set to anything" error.
$arg = 'XML sent using WCFStorm tool';
$c->call('Method Name', $arg);
I am using nusoapclient and Zend
Ray Paseur

Sorry -- if it's SOAP I have to sign off.  Nothing personal, but SOAP is an impossibly bad protocol, and now that I know it's SOAP, I can accept any outcome, no matter how ridiculous, as plausible.  Ask the publishers if they have a RESTful interface and use if it they do.  It will most likely work correctly and intuitively the first time.  If they do not have a REST interface, ask them for a PHP example using SOAP.  I wish I could be of some help, but life is too short to use and debug SOAP.  It's like being a blind man in a knife fight.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
perlwhite

ASKER
They don't have a RESTful interface. I am required to use SOAP. Can someone help?
perlwhite

ASKER
Please ignore the delete request. I have accepted 2 answers as solutions.