Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6705739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:26:20+00:00 2026-05-26T07:26:20+00:00

I’m currently experiencing an error when connecting to a webservice. Here is my PHP

  • 0

I’m currently experiencing an error when connecting to a webservice. Here is my PHP script:

<?php

//initialise test SOAP client
$wdsl = myaddress;
$soapClient = new SoapClient("$wdsl");
$apiKey = myapikey;
$clientID = myclientid;

//assign customer information that would normally be pulled from database
$strVendorTxCode = "thepartyshack-0000000001-0000000001";
$strEmail = "cutomer@email.com";
$strPhone = "07901888408";
$strDelivery = "ZZRML_NDSD";

//Build the XML string that will be sent to Smiffys
$strXML = $strXML . "<?xml version='1.0' encoding='Windows-1252'?><Order>";
//Customer Reference Number.
$strXML = $strXML . "<YourOrderNumber>" . $strVendorTXCode . "</YourOrderNumber>";
//More XML That does not change
$strXML = $strXML . "<Recipient>";
//Add in customer email
$strXML = $strXML . "<Email>" . $strEmail . "</Email>";
//Add in our customer telepone number
$strXML = $strXML . "<Telephone>" . $strPhone . "</Telephone>";
//Add in customer name
$strXML = $strXML . "<Recipient>" . "Mrs Customer" . "</Recipient>";
//Add in customer address line
$strXML = $strXML . "<AddressLine>" . "1 High Street" . "</AddressLine>";
//Add in customer city
$strXML = $strXML . "<City>" . "Anyplace" . "</City>";
//Add in customer postcode
$strXML = $strXML . "<PostCode>" . "AA1 1AA" . "</PostCode>";
//Add in customer county
$strXML = $strXML . "<County>" . "Anywhere" ."</County>";
//Add in customer country
$strXML = $strXML . "<CountryCode>" . "GB" . "</CountryCode>";
//Another line not to be changed
$strXML = $strXML . "</Recipient>";
//Add delivery
$strXML = $strXML . "<DeliveryCode>" . $strDelivery . "</DeliveryCode>";
//Another line not to be changed
$strXML = $strXML . "<Lines>";
//Add in the basket in the form of 'line'
$strXML = $strXML . "<Line><ProductCode>25402</ProductCode><ProductQuantity>1</ProductQuantity></Line>";
//Close all remaing tags XML done.
$strXML = $strXML . "</Lines></Order>";

//Make the SOAP request and get the response
$stockParameters = array('apiKey'=>$apiKey,'clientID'=>$clientID,'orderXml'=>$strXML);
$SubmitOrder=GetXml($soapClient,'SubmitOrder',$stockParameters,'Order');
$ResultSets = array( array('name' =>'SubmitOrder','ResultSet' => $SubmitOrder) );
$myresults = array();
foreach($ResultSets as $result){ printTableRecords($result,10); };

function GetXml($soapClient,$method,$parameters,$resultSetTag){
    try {
        $methodResultName = $method."Result";
        $result = $soapClient->$method($parameters);
        $simpleresult = $result->$methodResultName;
    return getElementsFromResult($resultSetTag,$simpleresult);
    }catch (SoapFault $exception) {
        echo $exception;
    }
}
function getElementsFromResult($elementName,$simpleresult){
    $dom = new DOMDocument;
    $dom->preserveWhiteSpace = FALSE;
    if($simpleresult==null) {
        echo 'null';
        return null;
    }else{
        $dom->loadXML($simpleresult->any);
        return $dom->getElementsByTagName($elementName);
    }
}
function printTableRecords($xmlNodeList,$count) {
    foreach ($xmlNodeList['ResultSet'] as $node) {
        $myvar = 0;
        foreach($node->childNodes as $childNode){
            $entity = htmlentities($childNode->nodeValue);
            $myresults[$myvar] = $entity;
            $myvar ++;
        }
    }
    echo $myresults[1];
}
?>

I use a near identical SOAP request successfully in other areas of the site however when making the above request I receive this error:

Warning: DOMDocument::loadXML() [domdocument.loadxml]: Empty string supplied as input in /home/content/89/8236789/html/test.php on line 72

The response I am requesting should be:

<OrderResultBase>
    <ReturnCode>Successful</ReturnCode>
    <YourOrderNumber>thepartyshack-0000000001-0000000001</YourOrderNumber>
    <Lines>
        <Line>
            <ProductCode>25402</ProductCode>
            <ProductQuantity>1</ProductQuantity>
            <Status>Confirmed</Status>
        </Line>
    </Lines>
    <DeliveryCode>ZZRML_NDSD</DeliveryCode>
</OrderResultBase>

The line I need to retrieve is the contents of <ReturnCode>.

Thanks for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:26:20+00:00Added an answer on May 26, 2026 at 7:26 am
        $simpleresult = $result->$methodResultName;
    

    Check that this line is actually producing something, and that $methodResultName actually exists in your $result object. if it doesn’t exist, PHP will simply assign a null to $simpleresult, which you then try to feed into DOM with $simpleresult->any, which would also come out null.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,
I am currently running into a problem where an element is coming back from
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.