donz365 42 Light Poster

Hi Cereal,

Thanks once again for taking the time to help. I can use that array of course ids to loop the GetIndividualCourseDetail request, I just need to get the below code working, and returning the data in xml format.

$wsdl   = "http://service.fetchcourses.ie/service/FetchCourse.svc?wsdl"; 
$client = new SoapClient($wsdl, ['trace' => TRUE]);
$search = new stdClass;
$search->criteria = new stdClass;
$search->criteria->CourseId = 12262;
$values = $client->GetIndividualCourseDetail($search);

# get response message
print $values->GetIndividualCourseDetailResult->ResponseInfo->ResponseMessage;

This is the request in SoapUI

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
   <soapenv:Header></soapenv:Header>
   <soapenv:Body>
      <tem:GetIndividualCourseDetail>
         <!--Optional:-->
         <tem:CourseId>12262</tem:CourseId>
     </tem:GetIndividualCourseDetail>
   </soapenv:Body>
</soapenv:Envelope>

and it should return teh following

s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <GetIndividualCourseDetailResponse xmlns="http://tempuri.org/">
         <GetIndividualCourseDetailResult xmlns:a="http://schemas.datacontract.org/2004/07/Solas.FetchCourses.DataContract" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <a:AccessTransferAndProgression>Progress to working within industry or continue on to
complete major award in Security 4M1976</a:AccessTransferAndProgression>
            <a:CategoryDescription>Evening Training</a:CategoryDescription>
            <a:CentreName>ccccccccccccccccccccc</a:CentreName>
            <a:CertificationRequirements>Door 
Guarding Skills 4N1118
Communications 4N0689</a:CertificationRequirements>
            <a:CourseCapacity>20</a:CourseCapacity>
            <a:CourseCode>q8651</a:CourseCode>
            <a:CourseContactEmail>xxxx</a:CourseContactEmail>
            <a:CourseContactFirstName>Carol</a:CourseContactFirstName>
            <a:CourseContactLastName>xxxx</a:CourseContactLastName>
            <a:CourseContactPhone>xxxxx</a:CourseContactPhone>
            <a:CourseDescription>Description
On successful completion of the programme, learners may progress to further education and training.</a:CourseDescription>
            <a:CourseFee>200.0000</a:CourseFee>
            <a:CourseId>12262</a:CourseId>
            <a:CourseTitle>Door Security </a:CourseTitle>
            <a:DateActualFinish>2016-11-20T00:00:00</a:DateActualFinish>
            <a:DateActualStart>2016-09-06T00:00:00</a:DateActualStart>
            <a:DateClosing i:nil="true"></a:DateClosing>
            <a:DeliveryMode>Classroom</a:DeliveryMode>
            <a:DeliveryTime>Evening</a:DeliveryTime>
            <a:DeliveryType>Parttime</a:DeliveryType>
            <a:DurationDays>0</a:DurationDays>
            <a:DurationWeeks>11</a:DurationWeeks>
            <a:HoursPerWeek>08 Hrs 00 Mins</a:HoursPerWeek>
            <a:ISCEDDescription>Services</a:ISCEDDescription>
            <a:LearnerAge>Statutory School Leaving Age</a:LearnerAge>
            <a:LearnerAptitude>Good numerical skills and verbal and written command of the English language along with good communication skills are essential.</a:LearnerAptitude>
            <a:LearnerEducation>Applicants must have achieved a FETAC Level 3 Major Award or its equivalent.</a:LearnerEducation>
            <a:LearnerPreviousExperience>None required</a:LearnerPreviousExperience>
            <a:LearningOutcomes>DOutline the training location's safety guidelines, rules/regulations, and the course objectives and certification.
Demonstrate the skills and related knowledge required to perform door security duties. 
Demonstrate the skills and related knowledge required to perform security guarding duties. 
Plan and achieve realistic work goals.</a:LearningOutcomes>
            <a:Notes></a:Notes>
            <a:OnlineApplicationURL></a:OnlineApplicationURL>
            <a:RegistrationFee>0.0000</a:RegistrationFee>
            <a:TargetAwardAchievable>Yes</a:TargetAwardAchievable> …
donz365 42 Light Poster

Hi again :)

My college have changed their web service, I am trying to apply same technique as above but getting bool(false). It ssuppsoed to be a more flexible service but I cant get a grip of it, any help appreciated.

    $wsdl = "http://service.fetchcourses.ie/service/FetchCourse.svc?wsdl"; 
    $client = new SoapClient($wsdl);
    $ref = "25";
    $parameters= array("ProviderId"=>$ref);
    $values = $client->SearchCourseReturnCourseId($parameters);
    $xml = simplexml_load_string($values->SearchCourseReturnCourseIdResult->any);
    $json = json_encode($xml);
    $array = json_decode($json,TRUE);
    print "<pre>\n";
    print_r($array['CourseIds']);
    print "</pre>";
    var_dump($xml);

This is the request in SoapUI

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:sol="http://schemas.datacontract.org/2004/07/Solas.FetchCourses.DataContract">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:SearchCourseReturnCourseId>
           <tem:criteria>
                <sol:ProviderId>25</sol:ProviderId>
         </tem:criteria>
      </tem:SearchCourseReturnCourseId>
   </soapenv:Body>
</soapenv:Envelope>

and it returns the following...

`

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <SearchCourseReturnCourseIdResponse xmlns="http://tempuri.org/">
         <SearchCourseReturnCourseIdResult xmlns:a="http://schemas.datacontract.org/2004/07/Solas.FetchCourses.DataContract" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <a:ResponseInfo>
               <a:ResponseCode>0</a:ResponseCode>
               <a:ResponseMessage>Return CourseIds Successful</a:ResponseMessage>
               <a:ResponseStatus>Success</a:ResponseStatus>
            </a:ResponseInfo>
            <a:courses>
               <a:CourseIds>
                  <a:CourseId>1562</a:CourseId>
               </a:CourseIds>
               <a:CourseIds>
                  <a:CourseId>1604</a:CourseId>
               </a:CourseIds>
              ..........
            </a:courses>
         </SearchCourseReturnCourseIdResult>
      </SearchCourseReturnCourseIdResponse>
   </s:Body>
</s:Envelope>

`

donz365 42 Light Poster

Thank you so much cereal I will give that a try.

donz365 42 Light Poster

Thank Cereal, Can you point me to any tutorials on how I go about setting up this type of
test?

donz365 42 Light Poster

Hi Cereal. thanks for your reply :)

I should of mentioned previously the only way I can get form details to email to the client is by using a SMTP plugin configured to a gmail account. I tried setting the the smtp with their email settings but it fails to connect?

Is there any way of checking which end it is failing at?

donz365 42 Light Poster

Hi,

I am having trouble getting my clients website to send the form details to their email. Their email is not handled by their hosting but externally using Office 365.

I have tested the site forms and they send succeffully to a wide variety of test email accounts ALL except the Office365 email accounts. The sites IP address has been added to the emails white list. Ive tried using a SMTP plugin but still no joy.

Has anyone ever had this issue and know how to resolve it, I have ran out of ideas???

donz365 42 Light Poster

Thanks, I am going to park it for now and get back to it. Think I need to learn a whole lot more before going any further with it.

donz365 42 Light Poster

Would setting the folder and file permission to 711 suffice?

donz365 42 Light Poster

Ive set this to run daily via my host cpanel cron tab.

lynx -dump http://digitalmediasolutions.ie/course-updates/testCronJobLIVE.php

testCronJobLIVE.php contains functions I want to run to update my sites database. It does exactly what I need I'm just not confident its secure enough where it is.

donz365 42 Light Poster

Thanks Cereal, I added the above code and ran the cron job but it returned the Error: 403 Forbidden message rather than running it?

donz365 42 Light Poster

Hi,

I have created cron job that runs a php file once a day. Its working exactly as I want it I am just enquiring where I should save it in my site? Its a wordpress website and while testing it I have it saved in my public_html file. Im new to this so not sure its proper procedure to save it here or not?

Any advice would be really appreciated.

Donna :)

donz365 42 Light Poster

Thanks Cereal for helping with this.

The problem was my client was sending back extra charaters which were causing errors. These articles explain it in detail...

qa-byte-order-mark
detecting-utf-bom-byte-order-mark

I was still struggling to get the result I needed but the following solution from Cereal worked perfect, it emulates a Soap client and although it may not be an ideal solution for everyone because it requires more code its works for me!!!

<?php
    $wsdl   = "https://your-WSDL-address.com/courseinfo/courseinfo.asmx";
    $soap   = <<<EOD
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://your-WSDL-address.com/"><SOAP-ENV:Body><ns1:getCourseInfo><ns1:centre>CO</ns1:centre></ns1:getCourseInfo></SOAP-ENV:Body></SOAP-ENV:Envelope>
EOD;
    $length = strlen($soap);
    $header = array(
        "Host: your-WSDL-address.com",
        "Connection: Keep-Alive",
        "User-Agent: PHP-SOAP/5.5.9-1ubuntu4.9",
        "Content-type: text/xml;charset=utf-8",
        "Accept: text/xml",
        "Cache-Control: no-cache",
        "Pragma: no-cache",
        "SOAPAction: \"http://your-WSDL-address.com/getCourseInfo\"",
        "Content-Length: ".$length,
        );
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL,            $wsdl);
    curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 10);
    curl_setopt($curl, CURLOPT_TIMEOUT,        10);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true );
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($curl, CURLOPT_POST,           true );
    curl_setopt($curl, CURLOPT_POSTFIELDS,     $soap);
    curl_setopt($curl, CURLOPT_HTTPHEADER,     $header);
    # show request and response headers
    curl_setopt($curl, CURLOPT_VERBOSE,        true);
    $response = curl_exec($curl);
    if($response === false) {
        $err = 'Curl error: ' . curl_error($curl);
        curl_close($curl);
        print PHP_EOL;
        print $err;
        print PHP_EOL;
    } else {
        curl_close($curl);
        print 'Operation completed without any errors';
        print PHP_EOL;
        $load = simplexml_load_string($response);
        # loading the namespace
        $resp = $load->children("http://schemas.xmlsoap.org/soap/envelope/");
        print_r($resp->Body->children());
    }
cereal commented: you're welcome! +13
donz365 42 Light Poster

Thanks Cereal, pm just sent :)

donz365 42 Light Poster

Hi,

I am working on a wbsite for a training centre.
I am querying a web service for the list of their courses.
There are three parametres in the query: centre, coursetype and courselocation.
When querying it directly or using SoapUI it can be queried using 1, 2, 3 or none of the parametres (none returns all courses). However, when I query it from within php I can only get a result if I use the first two parametres, but I want to only use the first "centre" so I can get a full list of all the courses for that centre.

This is my php code but instead of returning all courses for selected centre it will only return coursetype 1's for that centre, again, I need ALL courses returned.

<?php

$wsdl = "https://pm_for_link/courseinfo/courseinfo.asmx?WSDL";    
$client = new SoapClient($wsdl);
$centre = 'CO';   
$parameters = array(
    "centre" => $centre,
    "coursetype" => "1",
    "courselocation" => " ",);  
$values = $client->getCourseInfo($parameters);  
$xml = $values->getCourseInfoResult->any;
print_r($xml);
?>

If I omit the coursetype parametre i get this error message:

Fatal error:  Uncaught SoapFault exception: [Client] looks like we got no XML document in /location_of_file/test.php:15
Stack trace:
#0 /home/digi1816/public_html/test.php(15): SoapClient->__call('getCourseInfo', Array)
#1 /home/digi1816/public_html/test.php(15): SoapClient->getCourseInfo(Array)
#2 {main}
  thrown in /location_of_file/test.php on line 15

this is the SOAP Request and Response:

POST /courseinfo/courseinfo.asmx HTTP/1.1
Host: PM For Host Address
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <getCourseInfo …
donz365 42 Light Poster

Slight tweak and its working... thanks Diafol :/

LOAD XML LOCAL INFILE 'C:/courses.xml' 
INTO TABLE wp_posts ROWS IDENTIFIED BY '<Course>'
(@ReferenceNo, @ProviderCode, @ProviderName, @CourseID, @CourseName, @LocationCode, @LocationName, @StartDate, @FinishDate)
SET ID = @ReferenceNo,
    post_title = @CourseName,
    post_type = 'course';
diafol commented: Great! Thanks for sharing +15
donz365 42 Light Poster

The last thing I am trying to do is "Waste everybodies time", my sincere apologies if this is how I have come across. If anything I am overly-conscious of the time someone offers and do not want to keep badgering them once they have taken the time to help.

I have being reprimanded, lesson learnt thanks for the heads up.

donz365 42 Light Poster

Hi Diafol,

Thanks for your reply. I have applied the SET clause like so:

LOAD XML LOCAL INFILE 'C:/courses.xml' 
INTO TABLE wp_posts ROWS IDENTIFIED BY '<Course>'
SET ID = ReferenceNo,
    post_title = CourseName,
    post_type = 'course';

And I get the following error:

1054 - Unknown column 'ReferenceNo' in 'field list'

This is a snippet of the xml

<?xml version="1.0" encoding="utf-8"?>
    <Course>
    <ReferenceNo>64055</ReferenceNo>
    <ProviderCode>CO</ProviderCode>
    <ProviderName>name deleted</ProviderName>
    <CourseID>CO43Z</CourseID>
    <CourseName>IT Maintenance - Short Course</CourseName>
    <CourseTypeID>1</CourseTypeID>
    <CourseTypeName>1</CourseTypeName>
    <LocationCode>70203</LocationCode>
    <LocationName>name deleted </LocationName>
    <StartDate>2015.12.07</StartDate>
    <FinishDate>2016.03.04</FinishDate>
  </Course>
iamthwee commented: I'd hit it +14
donz365 42 Light Poster

I am sorta new to MySQL and not 100% sure of what I can and can not do with it yet. I have an xml file with course information such as ReferenceNo. CourseName, CourseType, CourseLocation, and I want to load in into a database table that has column names such as ID, post_title, term_taxonomy_id etc

I am updating the site by uploading the xml to MySQL (I am using Worpress by the way). The table I am loading it into has different named columns to that of the elements I want to load into it. So for instance I want to load the
ReferenceNo on the xml into the ID column in the database table or the
CourseName on the xml into a column called post_title n the database table

At the moment I am just doing a good ol manual"find and replace" before uploadig it to change the field names to match the column names, but this is not a long term solution. Is there a way to assign the elements of the xml to the db table columns without having to change names to match??

donz365 42 Light Poster

Hi Dave,

I am relatively new to MySQL, so lesson learnt!

donz365 42 Light Poster

Hi,

I am working on a test site locally. I am loading an xml file into my database with teh following sql query:

LOAD XML LOCAL INFILE 'C:/courseInfo18.xml' 
INTO TABLE wp_courses ROWS IDENTIFIED BY '<Course>' (ReferenceNo, ProviderCode, ProviderName, CourseID, CourseName, 
    CourseTypeID, CourseTypeName, LocationCode, LocationName, StartDate, 
    FinishDate) ;

It works fine locally but not on the live site. I have checked the MySQL version of the live site and it is running only 5.0.8 could this be the reason or does anyone know if there is an alterative way to do this on an older version of MySQL.

Thanks in advance,

Donna :)

donz365 42 Light Poster

Cereal, you have made my life so much easier thank you so much :)

donz365 42 Light Poster

Thank you so much Cereal, that had my head spinning for the last week. I was just about to throw in the towel.

I am used to creating and working with objects in php, can I access the properties of this object in the same way?

donz365 42 Light Poster

Can anyone tell me why I am getting Null for this:

<?php
    $wsdl = "https://namedeleted/courseinfo/courseinfo.asmx?WSDL"; 
    $client = new SoapClient($wsdl);
    $ref = 64566;
    $parameters= array("reference"=>$ref);
    $values = $client->getCourseDetail($parameters);
    $xml = simplexml_load_string($values->getCourseDetailResult);
    $json = json_encode($xml);
    $array = json_decode($json,TRUE);
    print "<pre>\n";
    print_r($array['Course']);
    print "</pre>";

    var_dump($array);
?>

I need to get an array of the course details something like this. It is a multidimentional array.

Array(
                  [ReferenceNo] =>64566
                  [CourseID] => COQ69
                  [CourseName] => Course Name
                  [DeliveryMethod] => Evening Course                 
                  [StartDate] => 2015-04-13
                  [FinishDate] =>2015-04-24
                  [Duration] => 2 weeks
                  [Capacity] =>16
                  [CourseLocation] = > Location Details
                  [Modules] =>   **This an array within the array?**
)

Thanks in advacne for any time of help given :)

donz365 42 Light Poster
donz365 42 Light Poster

uum theres an idea for an App :)

If the white is part of the image you will have to edit it in Photoshop by selecting and deleting the background and save as a .png.

If the white part is the color of the div the image is in did you try setting the background color to transparent in css

.nameOfDivClass{background-color: transparent;}

donz365 42 Light Poster

Great your taking the leap, the internet can have its pros and cons when it comes to learing online. You want to make sure the stuff is relevant and up to date. I would recommend Code Accademy

Best way to learn is by doing so as soon as you get the basics you should start trying to answer some of the questions on here to help you improve on your newly learnt skills.

Best of luck with it :)

donz365 42 Light Poster

Hi,

At the moment they are stacked on top of each other rather then "within"
Is this what you are looking for

<div class="box">
   <div class="TopContainer">
    <div class="Container1">
      <div class="Container2">
        <div class="Container3">
            <div class="Container4"></div>
        </div>
      </div>
   </div>   
  </div>
 </div>  
donz365 42 Light Poster

Hi,

Would using lists be an option for you...

add this to css
.container li{display: inline; padding: 10px;}

<body>
    <nav class="navbar navbar-default navbar-fixed-top">
  <div class="container">
    <div class= ".navbar-brand">
    <li>Booking</li>
    <li>Back</li>
   </div>
  </div>
</nav>
</body>
</html>
donz365 42 Light Poster

Hi,

<h1>A header with Alpha &alpha; and Beta &beta; Symbol</h1>

A header with Alpha α and Beta β Symbol

You can use this site for reference

donz365 42 Light Poster

Hi,

I have been trying to research something similar (i think), I found this tut very good to help me understand SOAP better.

Donna :)

donz365 42 Light Poster

Oh sorry, Im in Ireland (9.30am!).
That'd be great no rush at all :)

donz365 42 Light Poster

Thanks hericles and pixelsoul, that was a huge help.

I applied the same to my Courses case and did a var_dump,

var_dump($xml)i get bool(false)

var_dump($values) i get....
object(stdClass)#1 (1) { ["getCourseInfoResult"]=> object(stdClass)#6 (1) { ["any"]=> string(56666) "......and a big long string of what I want to be the array elements!!!"

I am starting to think maybe the wsdl file is flawed? Is it possible to PM the actual details to you?

donz365 42 Light Poster

Hi,

I am gone crosseyed from trying to figure this out. I dont ususally post on this site I am half scared of getting told off for being out of my league!!!

I am creating a website for a training company and I need to get the course info from their Client Services System using SOAP request and response. For client confidentiality I can not put the wsdl file up. I have been testing how to do this by following this tutorial and using this as an example http://www.webservicex.net/stockquote.asmx?WSDL

I can not create the same results as in that tut my results are coming back as a string rather than an array? Any help or advice would be amazing. This is my code:

<?php

        $wsdl = "http://www.webservicex.net/stockquote.asmx?WSDL";    
        $client = new SoapClient($wsdl);
        $stock = "bmi";    
        $parameters= array("symbol"=>$stock);    
        $values = $client->GetQuote($parameters);

    $xml = $values->GetQuoteResult;

    print "<pre>\n";
        print_r($xml);
        print "</pre>";

    ?>

and this is the output I am getting

BMI58.402/27/20154:01pm+0.0958.4058.8358.1134145836.2M58.31+0.15%46.47 - 61.352.0628.31Badger Meter

I think if I can manage this basic task I can work it around my clients request.
Hope I have given enough info, and thanks in advance I do appreciate any time given to help :)