Ben neden gönderir PHP SOAP istemci oluşturmak zorunda, ama ben daha önce SOAP ile hiç çalışmamış, ve benim XML büyük değil, burada şimdiye kadar yazmak için yönetilen kod. . .
<?php
try {
$client = new SoapClient(null, array(
'location' => "https://wwa.website.co.za/CallmasterTes/LeadService.asmx",
'uri' => "urn:Website:Callmaster:InTuch/CreateLead",
'login' => "username",
'password' => "password"
));
$sysName = ' ';
$clientCode = ' ';
$expTimestamp = ' ';
$schedTimestamp = ' ';
$client->CreateLead("ExternalLead",
new SoapParam($sysName, "BusinessSystemName"),
new SoapParam($clientCode, "BusinessSystemClientCode"),
new SoapParam($_POST['Title'], "Title"),
new SoapParam($_POST['FirstName'], "FirstName"),
new SoapParam($_POST['Surname'], "Surname"),
new SoapParam($_POST['IdNumber'], "IdNumber"),
new SoapParam($_POST['Gender'], "Gender"),
new SoapParam($_POST['DateOfBirth'], "DateOfBirth"),
new SoapParam($_POST['Language'], "Language"),
new SoapParam($_POST['EmailAddress'], "EmailAddress"),
new SoapParam($_POST['HomeTelNumber'], "HomeTelNumber"),
new SoapParam($_POST['BusinessTelNumber'], "BusinessTelNumber"),
new SoapParam($_POST['MobileTelNumber'], "MobileTelNumber"),
new SoapParam($_POST['OtherTelNumber'], "OtherTelNumber"),
new SoapParam($_POST['PreferredTelNumberCode'], "PreferredTelNumberCode"),
new SoapParam($_POST['CampaignName'], "CampaignName"),
new SoapParam($_POST['ProductName'], "ProductName"),
new SoapParam($_POST['Comments'], "Comments"),
new SoapParam($expTimestamp, "ExpiryTimestamp"),
new SoapParam($schedTimestamp, "ScheduledTimestamp"),
);
}
catch (SoapFault $fault) {
trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
}
?>
Aşağıdaki Ben şeyler sunucu tarafında geliştiriciler tarafından verildiğini örnekte bir SOAP 1.2 isteği ve yanıtı yer alıyor.
POST /CallmasterTest/LeadService.asmx HTTP/1.1
Host: wwa.website.co.za
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>
<CreateLead xmlns="urn:Website:Callmaster:InTuch">
<Lead>
<BusinessSystemName>string</BusinessSystemName>
<BusinessSystemClientCode>int</BusinessSystemClientCode>
<Title>Mr or Ms or Mrs or Miss...etc</Title>
<FirstName>string</FirstName>
<Surname>string</Surname>
<IdNumber>string</IdNumber>
<Gender>Male or Female</Gender>
<DateOfBirth>date</DateOfBirth>
<Language>string</Language>
<EmailAddress>string</EmailAddress>
<HomeTelNumber>string</HomeTelNumber>
<BusinessTelNumber>string</BusinessTelNumber>
<MobileTelNumber>string</MobileTelNumber>
<OtherTelNumber>string</OtherTelNumber>
<PreferredTelNumberCode>Business or Home or Mobile or Other</PreferredTelNumberCode>
<CampaignName>string</CampaignName>
<ProductName>string</ProductName>
<Comments>string</Comments>
<ExpiryTimestamp>dateTime</ExpiryTimestamp>
<ScheduledTimestamp>dateTime</ScheduledTimestamp>
</Lead>
</CreateLead>
</soap12:Body>
</soap12:Envelope>
Tepkisi:
HTTP/1.1 200 OK
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>
<CreateLeadResponse xmlns="urn:Website:Callmaster:InTuch">
<CreateLeadResult>
<Success>boolean</Success>
<StatusMessage>string</StatusMessage>
<LeadGuid>guid</LeadGuid>
<Errors>
<LeadError ErrorLevel="Information or Warning or Error">
<Message>string</Message>
<Field>string</Field>
</LeadError>
<LeadError ErrorLevel="Information or Warning or Error">
<Message>string</Message>
<Field>string</Field>
</LeadError>
</Errors>
</CreateLeadResult>
</CreateLeadResponse>
</soap12:Body>
</soap12:Envelope>
Ben gerçekten her şeyi denedim, ve yüksek göğe googled, ama ben sadece o iş için alınamıyor, ben o ben eksik muhtemelen küçük bir şey olduğunu eminim, ben gerçekten thanx, yardım bekleriz!