PHP Nusoap - SAVON de la Demande de travail

Bonjour, je suis très nouveau à webservice en php avec code ci-dessous je suis en train de fabriquer du savon à la demande, comme indiqué dans le code XML ci-dessous, mais il est dit d'Erreur

HTTP Error: Unsupported statut de la réponse HTTP 405 method not Allowed (soapclient->réponse a contenu de la réponse)

Questions:

  1. Comment passer des en-têtes?
  2. Comment passer FetchCalendarRequest avec demande comme en XML?

J'ai utilisé Nusoap ici, mais si vous avez un SAVON classe PHP de la solution, il est également invité.

Mon code:

<?php

require_once('../lib/nusoap.php');

$client = new nusoap_client("http://webservices.test.com/ows/5.1/Availability.wsdl");
$err    = $client->getError();

if ($err)
{
    client_debug_error_message('Constructor error', $err, $client);
    exit;
}

//Call the SOAP method
$result = $client->call(
    'FetchCalendar', 
    array(
        'StayDateRange' => array(
            'StartDate' => '2013-10-01', 
            'EndDate'   => '2013-10-10',
        ),
    ),
);

//Check for a fault
if ($client->fault) 
{
    debug_preformatted('Fault', $result);
} 
else 
{
    //Check for errors
    $err = $client->getError();

    if ($err) 
    {
        debug_preformatted('Error', $err);
    }
    else 
    {
        debug_preformatted('Result', $result);
    }
}

//Display the request and response
client_debug_dump($client);

XML :

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <OGHeader transactionID="005435" timeStamp="2008-12-09T13:26:56.4056250-05:00" xmlns="http://webservices.test.com/og/4.3/Core/">
      <Origin entityID="OWS" systemType="WEB" />
      <Destination entityID="WEST" systemType="ORS" />
    </OGHeader>
  </soap:Header>
  <soap:Body>
    <FetchCalendarRequest xmlns:a="http://webservices.test.com/og/4.3/Availability/" xmlns:hc="http://webservices.test.com/og/4.3/HotelCommon/" xmlns="http://webservices.test.com/ows/5.1/Availability.wsdl">
      <HotelReference chainCode="AXA" hotelCode="AXAMUM" />
      <StayDateRange>
        <hc:StartDate>2013-10-01</hc:StartDate>
        <hc:EndDate>2013-10-10</hc:EndDate>
      </StayDateRange>
      <GuestCount>
        <hc:GuestCount ageQualifyingCode="ADULT" count="1" />
        <hc:GuestCount ageQualifyingCode="CHILD" count="0" />
      </GuestCount>
    </FetchCalendarRequest>
  </soap:Body>
</soap:Envelope>


    Post Url :http://000.000.000.00:8080/ows_ws_51/Availability.asmx 
Soap Action :  http://webservices.test.com/ows/5.1/Availability.wsdl#FetchCalendar

Edit: Solution De Travail 16 Sep 2013

Cette solution est avec du Savon Classe PHP seulement je veux qu'il fonctionne avec Nusoap arc.

<?php
$wsdl   = "http://###.###.###.##:8080/ows_ws_51/Availability.asmx?wsdl"; 
$client = new SoapClient($wsdl, array(  'soap_version' => SOAP_1_1,'trace' => true,)); 
//=========== Header Setting ============
$ns                         = 'http://webservices.micros.com/og/4.3/Availability/'; //Namespace of the WS.//Body of the Soap Header.
$strHeaderComponent_Session = <<<XML
<OGHeader transactionID="005435" timeStamp="2008-12-09T13:26:56.4056250-05:00" xmlns="http://webservices.micros.com/og/4.3/Core/">
<Origin entityID="OWS" systemType="WEB" />
<Destination entityID="WEST" systemType="ORS" />
</OGHeader>
XML;
$objVar_Session_Inside      = new SoapVar($strHeaderComponent_Session, XSD_ANYXML, null, null, null);
$objHeader_Session_Outside  = new SoapHeader($ns , 'SessionHeader', $objVar_Session_Inside);
//More than one header can be provided in this array.
$client->__setSoapHeaders(array($objHeader_Session_Outside));
//============== Request ================
$xml = <<<XML
<FetchCalendarRequest xmlns:a="http://webservices.micros.com/og/4.3/Availability/" xmlns:hc="http://webservices.micros.com/og/4.3/HotelCommon/" xmlns="http://webservices.micros.com/ows/5.1/Availability.wsdl">
<HotelReference chainCode="AXA" hotelCode="{$DdlHotels}" />
<StayDateRange>
<hc:StartDate>{$Arrive}</hc:StartDate>
<hc:EndDate>{$Depart}</hc:EndDate>
</StayDateRange>
<GuestCount>
<hc:GuestCount ageQualifyingCode="ADULT" count="1" />
<hc:GuestCount ageQualifyingCode="CHILD" count="0" />
</GuestCount>
</FetchCalendarRequest>
XML;
$args = array(new SoapVar($xml, XSD_ANYXML));
try 
{
$response = $client->__soapCall( 'FetchCalendar', $args );
}
catch (SoapFault $e) 
{
echo "Error: {$e}"; exit;
}
  • Si vous collez l'exemple de code, de prendre soin, il est bien prévu, lisible et il ne contient pas de morts inutiles ou de débogage de code, mais plus idéalement être entièrement autonome qui travaillent par exemple. Voir mon edit. Aussi Stackoverflow fonctionne mieux si vous posez une question à la fois.
InformationsquelleAutor Bhavin Rana | 2013-08-08