Bonjour,
J'arrive à me connecter au webservice.
J'ai besoin d'envoyer un xml au WS. Le problème c'est que j'obtiens l'erreur suivante
Code :
Exception occured: SoapFault exception: [HTTP] Could not connect to host in C:\wampServer2\www\WS\index.php:139 Stack trace: #0 [internal function]: SoapClient->__doRequest('
Voici mon code :
Code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
| try {
$wsdl_url = 'http://xxxxxxxxx/WSFonction.gold?WSDL';
$client = new SOAPClient($wsdl_url);
$params = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<GetWSAuto>
<ContextAutoRequest>
<CompleteTariffRequest>
<Policy>
<ContractType>0</ContractType>
<EffectiveDate>01/10/2010</EffectiveDate>
<ExpirationDate>01/10/2011</ExpirationDate>
<TypeEcheanceContrat>1</TypeEcheanceContrat>
<ReferenceContratParrain/>
</Policy>
<Product>
<ProductCode>PA01</ProductCode>
</Product>
<Vehicule>
<Make>MARQUE</Make>
<Model>MODEL</Model>
<VehicleVersion>VERSION</VehicleVersion>
<MineType>VNR</MineType>
<VehicleUse>A1</VehicleUse>
<VehicleClass>A</VehicleClass>
<VehicleGroup>10</VehicleGroup>
<LicencePlate>L12</LicencePlate>
<DateFirstUsed>01/01/2009</DateFirstUsed>
<OwnerName>TESTWS</OwnerName>
<OwnerFirstName>TESTWS</OwnerFirstName>
<Categorie>A1</Categorie>
<NombreDePlace>5</NombreDePlace>
<ValeurVenale>130000</ValeurVenale>
<ValeurANeuf>130000</ValeurANeuf>
<ValeurDesGlasses>7500</ValeurDesGlasses>
<NombreDePassager>0</NombreDePassager>
<Supply>E</Supply>
<ZoneCirculation>CASABLANCA</ZoneCirculation>
<HorsePower>5</HorsePower>
</Vehicule>
<Subscriber>
<PersonIdentity>
<Sex>0</Sex>
<PersonTitle>0</PersonTitle>
<Name>TESTWS</Name>
<FirstName>TESTWS</FirstName>
<BirthDate>01/01/1975</BirthDate>
</PersonIdentity>
</Subscriber>
<OfferedFormulas>
<Item>
<FormulaCode>F34</FormulaCode>
<OfferedCoverages>
<Item>
<CoverageCode>G14</CoverageCode>
<CoverageOptions>
<Item>
<Option/>
<IsSubscribed/>
</Item>
</CoverageOptions>
</Item>
<Item>
<CoverageCode>G03</CoverageCode>
<CoverageOptions>
<Item>
<Option>OP04</Option>
<IsSubscribed>TRUE</IsSubscribed>
</Item>
</CoverageOptions>
</Item>
<Item>
<CoverageCode>G15</CoverageCode>
<CoverageOptions>
<Item>
<Option/>
<IsSubscribed/>
</Item>
</CoverageOptions>
</Item>
<Item>
<CoverageCode>G13</CoverageCode>
<CoverageOptions>
<Item>
<Option/>
<IsSubscribed/>
</Item>
</CoverageOptions>
</Item>
<Item>
<CoverageCode>G12</CoverageCode>
<CoverageOptions>
<Item>
<Option>OP79</Option>
<IsSubscribed>TRUE</IsSubscribed>
</Item>
</CoverageOptions>
</Item>
</OfferedCoverages>
</Item>
</OfferedFormulas>
<Drivers>
<Item>
<PersonIdentity>
<Sex>0</Sex>
<PersonTitle>0</PersonTitle>
<Name>TESTWS</Name>
<FirstName>TESTWS</FirstName>
</PersonIdentity>
<DateOfIssue>01/01/2005</DateOfIssue>
<CRM>100</CRM>
<BirthDate>01/01/1975</BirthDate>
</Item>
</Drivers>
</CompleteTariffRequest>
</ContextAutoRequest>
</GetWSAuto>
</soapenv:Body>
</soapenv:Envelope>';
$return = $client->GetWS();
print_r($return);
} catch(Exception $e) {
echo "Exception occured: ".$e;
}
?> |
Je ne sais pas si mon flux est mal fait ou faut il rajouté autre chose. J'ai cherché l'erreur sur google mais je n'ai pas trouvé grande chose.
Merci pour votre aide