我需要创建一个使用 asp.net 网络服务的 php soapclient。我已经阅读了手册页,但我承认我对 PHP 相当陌生。20 年的打字语言可能会让我陷入愚蠢。
我已经尝试过soapvar、数组、类。它们通常都以“调用...的非对象上的成员函数 CreatePurchase() 结束”
ASP.net 代码工作正常,并在使用 Fiddler 时产生此代码。
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><CreatePurchase xmlns="http://licensing.mancosoftware.com/webservices/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><axCustomer><Customer Name="Ron Howard" EMail="RH@Anysite.com" FirstName="Ron E" LastName="Howard" Salutation="Mr." Company="RHP" Address="1313 Mockingbird Rd." Address2="1" City="Los Angles" StateCode="CA" CountryISOCode="USA" PostCode="99999-9999" Phone="888.888.8888" Fax="888.888.8888" Comments="Now is time for all good men to come to the aid of their country" xmlns=""><Purchase LicenseID="0" PurchaseDate="9/23/2012" Income="0.00" Comments="AOTC"></Purchase></Customer></axCustomer></CreatePurchase></s:Body></s:Envelope>
那么 CreatePurchase 在我缺少的参数字段中寻找什么?
问候,
PHP 版本 5.3.21 Apache 2.2.22
这是 WSDL:
http://www.mancosoftware.com/ActivationService/ActivationService.asmx?WSDL
<s:element name="CreatePurchase"><s:complexType><s:sequence><s:element minOccurs="0" maxOccurs="1" name="axCustomer"><s:complexType><s:sequence><s:any/></s:sequence></s:complexType></s:element><s:element minOccurs="1" maxOccurs="1" name="returnFullSaleInfo" type="s:boolean"/></s:sequence></s:complexType></s:element>
<s:element name="CreatePurchaseResponse"><s:complexType><s:sequence><s:element minOccurs="1" maxOccurs="1" name="CreatePurchaseResult" type="s:boolean"/><s:element minOccurs="0" maxOccurs="1" name="aoUnlockKeyList" type="tns:ArrayOfString"/></s:sequence></s:complexType></s:element>
CreatePurchase { axCustomer axCustomer; boolean returnFullSaleInfo; }" [5]=> string(36) "struct axCustomer { any; }"
POST /ActivationService/ActivationService.asmx HTTP/1.1
Host: www.mancosoftware.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://licensing.mancosoftware.com/webservices/CreatePurchase"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<CreatePurchase xmlns="http://licensing.mancosoftware.com/webservices/">
<axCustomer>xml</axCustomer>
<returnFullSaleInfo>boolean</returnFullSaleInfo>
</CreatePurchase>
</soap:Body>
</soap:Envelope>
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<CreatePurchaseResponse xmlns="http://licensing.mancosoftware.com/webservices/">
<CreatePurchaseResult>boolean</CreatePurchaseResult>
<aoUnlockKeyList>
<string>string</string>
<string>string</string>
</aoUnlockKeyList>
</CreatePurchaseResponse>
</soap:Body>
</soap:Envelope>
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$params['trace'] = true;
$soapURL = "http://www.mancosoftware.com/ActivationService/ActivationService.asmx?WSDL";
$client = new SoapClient($soapURL, $params);
$result = $client->Login(array(
"asUserName" => "xxx",
"asPassword" => "xxx"
));
$name = "Ron Howard";
$email = "rh@abc.com";
$firstname = "Ron";
$lastname = "Howard";
$salutation = "Mr.";
$company = "RHP";
$address = "1313 Mockingbird Lane";
$address2 = "";
$city = "LA";
$statecode = "CA";
$countryISOcode = "USA";
$postcode = "99999";
$phone = "8888888";
$fax = "8888888";
$comments = "test 1";
$purchasedate = date("m/d/Y");
$writer = new XMLWriter();
$writer->openMemory();
$writer->setIndent(4);
$writer->startElement('Customer');
$writer->writeAttribute('Name', $name);
$writer->writeAttribute('EMail', $email);
$writer->writeAttribute('FirstName', $firstname);
$writer->writeAttribute('LastName', $lastname);
$writer->writeAttribute('Salutation', $salutation);
$writer->writeAttribute('Company', $company);
$writer->writeAttribute('Address', $address);
$writer->writeAttribute('Address2', $address2);
$writer->writeAttribute('City', $city);
$writer->writeAttribute('StateCode', $statecode);
$writer->writeAttribute('CountryISOcode', $countryISOcode);
$writer->writeAttribute('PostCode', $postcode);
$writer->writeAttribute('Phone', $phone);
$writer->writeAttribute('Fax', $fax);
$writer->writeAttribute('Comments', $comments);
$writer->startElement('Purchase');
$writer->writeAttribute('LicenseID', '0');
$writer->writeAttribute('PurchaseDate', $purchasedate);
$writer->writeAttribute('Income', '0');
$writer->writeAttribute('Comments', 'Test');
$writer->endElement();
$writer->endElement();
$Customer1 = ($writer->outputMemory(True));
$result = $Client->CreatePurchase(this is where I break down and cry and beg for help)
$result1 = $client->Logout();
?>