By each SOAP agent am getting this response «error 500».
I am using SOAP v2 with WS-I compliance mode.
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>SOAP-ERROR: Encoding: object has no 'results' property</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
WSDL.xml looks like
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* my
*
* @category my
* @package my AP-Plus
*/-->
<definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
<message name="myApplusSyncParseRequest">
<part name="sessionId" type="xsd:string" />
<part name="xmlString" type="xsd:string" />
</message>
<message name="myApplusSyncParseResponse">
<part name="results" type="xsd:string" />
</message>
<portType name="{{var wsdl.handler}}PortType">
<operation name="myApplusSyncParse">
<documentation>List of products</documentation>
<input message="typens:myApplusSyncParseRequest" />
<output message="typens:myApplusSyncParseResponse" />
</operation>
</portType>
<binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="myApplusSyncParse">
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
<input>
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
<service name="{{var wsdl.name}}Service">
<port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
<soap:address location="{{var wsdl.url}}" />
</port>
</service>
</definitions>
wsi.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* my
* @category my
* @package my AP-Plus
*/-->
<wsdl:definitions xmlns:typens="urn:{{var wsdl.name}}"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
name="{{var wsdl.name}}"
targetNamespace="urn:{{var wsdl.name}}">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:{{var wsdl.name}}">
<xsd:element name="myApplusSyncParseRequestParam">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="sessionId" type="xsd:string"/>
<xsd:element minOccurs="1" maxOccurs="1" name="xmlString" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="myApplusSyncParseResponseParam">
<xsd:complexType>
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="results" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
<wsdl:message name="myApplusSyncParseRequest">
<wsdl:part name="parameters" element="typens:myApplusSyncParseRequestParam"/>
</wsdl:message>
<wsdl:message name="myApplusSyncParseResponse">
<wsdl:part name="parameters" element="typens:myApplusSyncParseResponseParam"/>
</wsdl:message>
<wsdl:portType name="{{var wsdl.handler}}PortType">
<wsdl:operation name="myApplusSyncParse">
<wsdl:documentation>Parse data provided by APPlus</wsdl:documentation>
<wsdl:input message="typens:myApplusSyncParseRequest"/>
<wsdl:output message="typens:myApplusSyncParseResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="myApplusSyncParse">
<soap:operation soapAction=""/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="{{var wsdl.name}}Service">
<wsdl:port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
<soap:address location="{{var wsdl.url}}"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
api.xml
<?xml version="1.0"?>
<!--
/**
* my
* @category my
* @package my AP-Plus
*/-->
<config>
<api>
<resources>
<my_applus translate="title" module="my_applus">
<model>my_applus/sync_api</model>
<title>my AP-Plus</title>
<acl>my_applus/sync</acl>
<methods>
<parse translate="title" module="my_applus">
<title>Parse Xml</title>
<method>parseXml</method>
</parse>
</methods>
</my_applus>
</resources>
<resources_alias>
<sync>my_applus</sync>
</resources_alias>
<v2>
<resources_function_prefix>
<sync>myApplusSync</sync>
</resources_function_prefix>
</v2>
<acl>
<resources>
<my_applus translate="title" module="my_applus">
<title>Sync AP-Plus</title>
<sort_order>5</sort_order>
<product translate="title" module="my_applus">
<title>Sync AP-Plus</title>
</product>
</my_applus>
</resources>
</acl>
</api>
</config>
app/code/local/My/Applus/Model/Sync/Api/v2.php
<?php
class My_Applus_Model_Sync_Api_V2 extends my_Applus_Model_Sync_Api
{
const XML_NODE_Articles = 'Articles';
const XML_NODE_Categories = 'CATEGORIES';
const XML_NODE_Customers = 'Customers';
/**
* here we start
* @param $xmlString
* @return bool|string
*/
public function parseXml($xmlString)
{
Mage::log($xmlString, Zend_Log::DEBUG, 'My_Sync_Api_parseXml.log');
$xml = simplexml_load_string($xmlString);
$ids = $this->checkDataType($xml);
return $ids;
}
}
where $this->checkDataType($xml)
returns a string value of comma separated updated or added products’ IDs.
This has been driving me mad for 2 days now. Seems like the object i am creating is not working for the soap class.
I get the following error.
Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object has no 'CreditCard' property in /var/www/vhosts/mysite.com/httpdocs/Felagakerfi/mysoap.php:114 Stack trace: #0 /var/www/vhosts/mysite.com/httpdocs/Felagakerfi/mysoap.php(114): SoapClient->__call('CreateMemberFee', Array) #1 /var/www/vhosts/mysite.com/httpdocs/Felagakerfi/signup.php(327): create_member_fee(Object(TMemberFee), '_ActionInsertEd...') #2 /var/www/vhosts/mysite.com/httpdocs/templates/ja_opal/index.php(200): include('/var/www/vhosts...') #3 /var/www/vhosts/mysite.com/httpdocs/libraries/joomla/document/html/html.php(338): require_once('/var/www/vhosts...') #4 /var/www/vhosts/mysite.com/httpdocs/libraries/joomla/document/html/html.php(246): JDocumentHTML->_loadTemplate('/var/www/vhosts...', 'index.php') #5 /var/www/vhosts/mysite.com/httpdocs/includes/application.php(168): JDocumentHTML->render('0', Array) #6 /var/www/vhosts/mysite.com/httpdocs/index.php(79): JSite->render() #7 {main} thrown in /var/www/vhosts/mysite.com/httpdocs/Felagakerfi/mysoap.php on line 114
Sometimes it is object has no ‘RecordId’, depending on some random changes i make.
Im not an experinenced PHP programmer so i dont really know whats going on after i send the parameters into the soap call function. It would be great if someone could take a look and see what im doing wrong.
Here is my PHP code
class TMemberV2 { public $RecordID; public $Number; public $Name; public $SSNumber; public $Address1; public $Address2; public $Address3; public $Address4; public $ZipCode; public $City; public $CountryCode; public $CountryName; public $CountyCode; public $Phone; public $PhoneLocal; public $PhoneMobile; public $PhoneFax; public $Telex; public $Email; public $Password; public $Group; public $Tag; public $SalesPerson; public $Discount; public $ItemReceivers; public $Contacts; public $PaymentType; public $CurrencyCode; public $NoVat; public $LedgerCode; public $RecordCreated; public $RecordModified; public $Blocked; public $Dead; public $Retierd; public $Disabled; public $Points; public $BankCode; public $BankAccGroup; public $BankAccount; public $MemberSubGroups; public $Carrer; public $Membership; public $Education; public $Applications; public $Funds; } class TCreditCard { public $TComboBox_ARCreditCardType; public $CardNumber; public $ExpDate; public $SSNumber; public $Name; } class TMemberFee { public $RecordID; public $Member; public $Payer; public $ItemCode; public $Amount; public $CreditCard; public $Saleperson; public $ContactName; public $DiscountPercent; public $DiscountValidUntil; public $PaymentTerm; public $PaymentMode; public $Memo; } $member = new TMemberV2(); $member->RecordID = $id; $member->Number = $kennitala; $member->Name = $nafn; $member->SSNumber = $kennitala; $member->Address1 = $heimilisfang; $member->Address2 = ''; $member->Address3 = ''; $member->Address4 = ''; $member->ZipCode = $postnumer; $member->City = $sveitarfelag; $member->CountryCode = 'IS'; $member->CountryName = 'Ísland'; $member->CountryCode = 'IS'; $member->Phone = $simanumer; $member->PhoneLocal = ''; $member->PhoneMobile = $farsimi; $member->PhoneFax = ''; $member->Telex = ''; $member->Email = $netfang; $member->Password = ''; $member->Group = ''; $member->Tag = ''; $member->SalesPerson = ''; $member->Discount = '$'; $member->ItemReceivers = ''; $member->Contacts = ''; $member->PaymentType = 'test'; $member->CurrencyCode = ''; $member->NoVat = ''; $member->LedgerCode = ''; $member->RecordCreated = ''; $member->RecordModified = ''; $member->Blocked = ''; $member->Dead = ''; $member->Retierd = ''; $member->Disabled = ''; $member->Points = ''; $member->BankCode = ''; $member->BankAccGroup = ''; $member->BankAccount = ''; $member->MemberSubGroups = ''; $member->Carrer = ''; $member->Membership = ''; $member->Education = ''; $member->Applications = ''; $member->Funds = '' $creditCard = new TCreditCard(); $creditCard->TComboBox_ARCreditCardType = $_POST['cardType']; $creditCard->CardNumber = $_POST['ccNumber']; $creditCard->ExpDate = mktime(0,0,0,$_POST['cardMonth'],1,$_POST['cardYear']); $creditCard->SSNumber = $kt_forradamanns; $memberFee = new TMemberFee(); $memberFee->Member = $member; $memberFee->Payer = ''; $memberFee->ItemCode = ''; $memberFee->Amount = $namskeid_verd; $memberFee->CreditCard = $creditCard; $memberFee->Saleperson = ''; $memberFee->ContactName = ''; $memberFee->DiscountPercent = ''; $memberFee->ReductionPayment = ''; $memberFee->DiscountValidUntil = strtotime("now"); $memberFee->PaymentTerm = ''; $memberFee->PaymentMode = ''; $memberFee->Memo = ''; $wsdl = 'SOME SOAP SERVICE'; $client = new mySoap($wsdl, array('trace' => 1)); $param = new SoapParam($memberFee, 'ns1:TMemberFee'); $param1 = new SoapParam('_ActionInsertEdit', 'ns1:TMemberFeeOptions'); $result = $client->__call('CreateMemberFee',array('obj'=>$param, 'opt'=>$param1)); return $result;
And here is the soap part i am using
<message name="CreateMemberFee85Request"> <part name="obj" type="ns1:TMemberFee"/> <part name="opt" type="ns1:TMemberFeeOptions"/> </message> <xs:complexType name="TMemberFee"> <xs:sequence> <xs:element name="Member" type="ns1:TMemberV2"/> <xs:element name="Payer" type="ns1:TPerson"/> <xs:element name="ItemCode" type="xs:string"/> <xs:element name="Amount" type="xs:double"/> <xs:element name="CreditCard" type="ns1:TCreditCard"/> <xs:element name="Saleperson" type="xs:string"/> <xs:element name="ContactName" type="xs:string"/> <xs:element name="DiscountPercent" type="xs:double"/> <xs:element name="ReductionPayment" type="xs:double"/> <xs:element name="DiscountValidUntil" type="xs:dateTime"/> <xs:element name="PaymentTerm" type="xs:string"/> <xs:element name="PaymentMode" type="xs:string"/> <xs:element name="Memo" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="TMemberV2"> <xs:sequence> <xs:element name="RecordID" type="xs:int"/> <xs:element name="Number" type="xs:string"/> <xs:element name="Name" type="xs:string"/> <xs:element name="SSNumber" type="xs:string"/> <xs:element name="Address1" type="xs:string"/> <xs:element name="Address2" type="xs:string"/> <xs:element name="Address3" type="xs:string"/> <xs:element name="Address4" type="xs:string"/> <xs:element name="ZipCode" type="xs:string"/> <xs:element name="City" type="xs:string"/> <xs:element name="CountryCode" type="xs:string"/> <xs:element name="CountryName" type="xs:string"/> <xs:element name="CountyCode" type="xs:string"/> <xs:element name="Phone" type="xs:string"/> <xs:element name="PhoneLocal" type="xs:string"/> <xs:element name="PhoneMobile" type="xs:string"/> <xs:element name="PhoneFax" type="xs:string"/> <xs:element name="Telex" type="xs:string"/> <xs:element name="Email" type="xs:string"/> <xs:element name="Password" type="xs:string"/> <xs:element name="Group" type="xs:string"/> <xs:element name="Tag" type="xs:string"/> <xs:element name="SalesPerson" type="xs:string"/> <xs:element name="Discount" type="xs:double"/> <xs:element name="ItemReceivers" type="ns1:ArrayOfItemReceiver"/> <xs:element name="Contacts" type="ns1:ArrayOfContacts"/> <xs:element name="PaymentType" type="xs:string"/> <xs:element name="CurrencyCode" type="xs:string"/> <xs:element name="NoVat" type="xs:boolean"/> <xs:element name="LedgerCode" type="xs:string"/> <xs:element name="RecordCreated" type="xs:dateTime"/> <xs:element name="RecordModified" type="xs:dateTime"/> <xs:element name="Blocked" type="xs:boolean"/> <xs:element name="Dead" type="xs:boolean"/> <xs:element name="Retierd" type="xs:boolean"/> <xs:element name="Disabled" type="xs:boolean"/> <xs:element name="Points" type="xs:double"/> <xs:element name="BankCode" type="xs:string"/> <xs:element name="BankAccGroup" type="xs:string"/> <xs:element name="BankAccount" type="xs:string"/> <xs:element name="MemberSubGroups" type="ns1:ArrayOfMemberSubGroups"/> <xs:element name="Carrer" type="ns1:ArrayOfMemberCarrer"/> <xs:element name="Membership" type="ns1:ArrayOfMemberMemberships"/> <xs:element name="Education" type="ns1:ArrayOfMemberEducations"/> <xs:element name="Applications" type="ns1:ArrayOfMemberApplication"/> <xs:element name="Funds" type="ns1:ArrayOfMemberFunds"/> <xs:element name="CreditCard" type="ns1:TCreditCard"/> </xs:sequence> </xs:complexType> <xs:complexType name="TPerson"> <xs:sequence> <xs:element name="Number" type="xs:string"/> <xs:element name="Name" type="xs:string"/> <xs:element name="SSNumber" type="xs:string"/> <xs:element name="Address1" type="xs:string"/> <xs:element name="Address2" type="xs:string"/> <xs:element name="Address3" type="xs:string"/> <xs:element name="Address4" type="xs:string"/> <xs:element name="ZipCode" type="xs:string"/> <xs:element name="City" type="xs:string"/> <xs:element name="CountryCode" type="xs:string"/> <xs:element name="CountryName" type="xs:string"/> <xs:element name="CountyCode" type="xs:string"/> <xs:element name="Phone" type="xs:string"/> <xs:element name="PhoneLocal" type="xs:string"/> <xs:element name="PhoneMobile" type="xs:string"/> <xs:element name="PhoneFax" type="xs:string"/> <xs:element name="Email" type="xs:string"/> <xs:element name="RecordCreated" type="xs:dateTime"/> <xs:element name="RecordModified" type="xs:dateTime"/> <xs:element name="Blocked" type="xs:boolean"/> <xs:element name="Gender" type="ns1:TGender"/> </xs:sequence> </xs:complexType> <xs:complexType name="TCreditCard"> <xs:sequence> <xs:element name="CardType" type="ns2:TComboBox_ARCreditCardType"/> <xs:element name="CardNumber" type="xs:string"/> <xs:element name="ExpDate" type="xs:dateTime"/> <xs:element name="SSNumber" type="xs:string"/> <xs:element name="Name" type="xs:string"/> </xs:sequence> </xs:complexType> <xs:complexType name="TMemberFeeOptions"> <xs:sequence> <xs:element name="MemberAction" type="ns1:TActionMethod"/> </xs:sequence> </xs:complexType> <xs:simpleType name="TActionMethod"> <xs:restriction base="xs:string"> <xs:enumeration value="_ActionUse"/> <xs:enumeration value="_ActionInsert"/> <xs:enumeration value="_ActionEdit"/> <xs:enumeration value="_ActionInsertEdit"/> <xs:enumeration value="_ActionInsertMerge"/> <xs:enumeration value="_ActionUseInsert"/> </xs:restriction> </xs:simpleType>
Answer by Lorelai Cummings
As you can see, I tried 2 ways to send the $args to getBookingList, as far I know both of then is valid and yet both of then (with array or object) return the same error. On the code commented at first you can see that I tried to define all does properties that the web service asks but after defining all of then I get a empty result.,
yes, I’m trying to check the difference with wireshark now. The incredible support from that webservice just says is working and the problem is with you app :@ I know that it is, but really, not even then have a clue? Annoying.
– Lucas Serafim
Jan 23 ’15 at 20:47
,
Stack Overflow for Teams
Where developers & technologists share private knowledge with coworkers
,Before starting, I know, this errors means that I should have defined the property FinalBookingDate, but just keep reading and you will understand my point of view.
Can you try this more direct approach:
try {
$params = array('soap_version' => SOAP_1_2, 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP, 'encoding'=>'UTF-8', 'trace' => 1, 'exceptions' => true, 'cache_wsdl' => WSDL_CACHE_NONE, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS);
$client = new SoapClient('http://bestbuyhotel1.cangooroo.net/ws/2013/ClientBackOffice_b.asmx?wsdl',$params);
} catch (SoapFault $E) {
echo $E->faultstring;
}
if ($client) {
$req_params = array('credential' =>
array('userName' => 'XXXXXXX',
'Password' => 'XXXXXXX'),
'searchBookingCriteria' =>
array('BookingNumber' => array('int' => 'XXXXXXXXX'),
'ServiceTypes' => array('eServiceType' => 'HOTEL'),
'PassengerName'=> 'XXXXXXXX',
'InitialBookingDate'=> '2015-01-16',
'FinalBookingDate'=> '2015-01-16',
'InitialServiceDate' => '2015-01-18',
'FinalServiceDate' => '2015-01-18',
'BookingStatus'=> array('eStatus' => 'ACTIVATED'),
'PaymentStatus'=> array('ePaymentStatus' => 'Payed'),
'CreationUserId'=> 'XXX',
'CityId'=> 'XXXX',
'ExternalReference'=> '')
);
$response = $client->__soapCall('getBookingList',array($req_params));
var_dump($response);
}
Answer by Colt Yates
Hello!
I have a complex object with an array of other complex objects (several hundred). It is generated automatically once per day and saved serialised into a file. And I have web-service based on yii2-soap-server, which serves this object from the file to clients. Sometimes it returns following error:,The problem is with Array of objects,However, it looks like the object you are passing doesn’t have all the required properties.,That, or use logging at the debug level to record the object about to be encoded.
public class sampleController
{
/**
* @return Foo[]
* @soap
*/
public function foo() {
$foo = new Foo();
$foo->message = 'test';
return [ $foo; ]
}
}
public class Foo
{
public $message;
}
Answer by Elizabeth Orozco
Я получаю сообщение об ошибке SOAP-ERROR: Encoding: object hasn’t ‘first_name’ property в проекте .NET, когда пытаюсь вызвать веб-метод, написанный в веб-службе PHP. Веб-метод возвращает массив PHP…
,
Фатальная ошибка : Uncaught SoapFault исключение: [клиент] SOAP-ошибка: кодировка: SoapVar не имеет свойства ‘enc_type’
Я делаю регистрационную форму онлайн, которая подключается к веб-сервису soap и должна иметь возможность сохранять платежную информацию через него.
PHP выглядит так
function create_member_fee()
{
$wsdl = 'WSDL LOCATION';
$client = new mySoap($wsdl, array('trace' => 1));
$request = array(
'obj'=>array(
'Member'=>array('Number'=>$NUMBER),
'Amount'=>$PRICE,
'CreditCard'=>array(
'TComboBox_ARCreditCardType'=>$_POST['CT'],
'CardNumber'=>$_POST['CN'],
'ExpDate'=>mktime(0,0,0,$_POST['CM'],1,$_POST['CY']),
'SSNumber'=>$NUMBER_PAYER
)
),
'opt'=>array('MemberAction'=>new SoapParam('_ActionInsert','ns1:TActionMethod'))
);
$result = $client->__call('CreateMemberFee',$request);
return $result;
}
Ошибка, сгенерированная при вызове create_member_fee(), выглядит следующим образом
Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object has no 'RecordID' property in...
Answer by Haylee Mercado
I could not get Report Service request for «FILTEROPTIONS» from SOAP client. I am using PHP SOAP client. ,In other words, it looks to me like you’ve left out all of the ReportServiceRequest’s mandatory fields. ,Thanks, for the reply. I added ReportServiceRequest’s mandatory fields, and it seems working fine now. ,Yellowfin launches analytics industry’s first virtualized integrated Data Preparation Module
<?php
ini_set('soap.wsdl_cache_enabled', 0);
ini_set('soap.wsdl_cache_ttl', 900);
ini_set('default_socket_timeout', 15);
$wsdl_reporturl = 'http://example.com/services/ReportService?wsdl';
$report = new SoapClient($wsdl_reporturl);
$webserviceAdmin = '[email protected]';
$webserviceAdminPassword = '[email protected]';
//report service call
function showReport() {
$ReportServiceRequest['loginId'] = $GLOBALS['webserviceAdmin'];
$ReportServiceRequest['password'] = $GLOBALS['webserviceAdminPassword'];
$ReportServiceRequest['orgId'] = 1;
$ReportServiceRequest['reportRequest'] = "FILTEROPTIONS";
$ReportServiceRequest['reportId'] = "72136";
$ReportServiceRequest['objectName'] = "72202";
$response = doWebserviceReportCall($ReportServiceRequest);
if ($response != null and strcmp($response->statusCode, 'SUCCESS') == 0)
return true;
return false;
}
function doWebserviceReportCall($rsr) {
try {
$rs = $GLOBALS['report']->remoteReportCall($rsr);
} catch (Exception $e) {
echo "Error! <br>";
echo $e->getMessage();
echo 'Last response: ' . $GLOBALS['report']->__getLastResponse();
return null;
}
return $rs;
}
showReport();
Answer by Bella Newman
我正在开发一个视频共享iOS应用程序,并使用Firebase5
作为后端。它允许用户选择视频并将其发送到存储器。当我尝试时,视频无法推送到database
服务器。以下是我的代码:
static func uploadVideoToFirebaseStorage(videoUrl: URL, onSuccess: @escaping (_ videoUrl: String) -> Void) {
let videoIdString = NSUUID().uuidString
//Config.STORAGE_ROOT_REF is var STORAGE_ROOT_REF = "gs://****-cdc3c.appspot.com"
let storageRef = Storage.storage().reference(forURL: Config.STORAGE_ROOT_REF).child("posts").child(videoIdString)
storageRef.putFile(from: videoUrl, metadata: nil) { (metadata, error) in
if error != nil {
ProgressHUD.showError(error!.localizedDescription)
return
}
}
storageRef.downloadURL(completion: { (url, error) in
if let error = error {
return
}else {
let videoUrl = url!.absoluteString
onSuccess(videoUrl)
}
})
}
调用此函数将视频上载到firebase存储器
func uploadTOFireBaseVideo(url: URL,
success : @escaping (String) -> Void,
failure : @escaping (Error) -> Void) {
let name = "(Int(Date().timeIntervalSince1970)).mp4"
let path = NSTemporaryDirectory() + name
let dispatchgroup = DispatchGroup()
dispatchgroup.enter()
let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
let outputurl = documentsURL.appendingPathComponent(name)
var ur = outputurl
self.convertVideo(toMPEG4FormatForVideo: url as URL, outputURL: outputurl) { (session) in
ur = session.outputURL!
dispatchgroup.leave()
}
dispatchgroup.wait()
let data = NSData(contentsOf: ur as URL)
do {
try data?.write(to: URL(fileURLWithPath: path), options: .atomic)
} catch {
print(error)
}
let storageRef = Storage.storage().reference().child("Videos").child(name)
if let uploadData = data as Data? {
storageRef.putData(uploadData, metadata: nil
, completion: { (metadata, error) in
if let error = error {
failure(error)
}else{
let strPic:String = (metadata?.downloadURL()?.absoluteString)!
success(strPic)
}
})
}
}
func convertVideo(toMPEG4FormatForVideo inputURL: URL, outputURL: URL, handler: @escaping (AVAssetExportSession) -> Void) {
try! FileManager.default.removeItem(at: outputURL as URL)
let asset = AVURLAsset(url: inputURL as URL, options: nil)
let exportSession = AVAssetExportSession(asset: asset, presetName: AVAssetExportPresetHighestQuality)!
exportSession.outputURL = outputURL
exportSession.outputFileType = .mp4
exportSession.exportAsynchronously(completionHandler: {
handler(exportSession)
})
}
Answer by Lance Baldwin
By each SOAP agent am getting this response «error 500».,I am using SOAP v2 with WS-I compliance mode.,Thanks for contributing an answer to Magento Stack Exchange!,Asking for help, clarification, or responding to other answers.
I am using SOAP v2 with WS-I compliance mode.
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>SOAP-ERROR: Encoding: object has no 'results' property</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
WSDL.xml looks like
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* my
*
* @category my
* @package my AP-Plus
*/-->
<definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
<message name="myApplusSyncParseRequest">
<part name="sessionId" type="xsd:string" />
<part name="xmlString" type="xsd:string" />
</message>
<message name="myApplusSyncParseResponse">
<part name="results" type="xsd:string" />
</message>
<portType name="{{var wsdl.handler}}PortType">
<operation name="myApplusSyncParse">
<documentation>List of products</documentation>
<input message="typens:myApplusSyncParseRequest" />
<output message="typens:myApplusSyncParseResponse" />
</operation>
</portType>
<binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="myApplusSyncParse">
<soap:operation soapAction="urn:{{var wsdl.handler}}Action" />
<input>
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</input>
<output>
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
</output>
</operation>
</binding>
<service name="{{var wsdl.name}}Service">
<port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
<soap:address location="{{var wsdl.url}}" />
</port>
</service>
</definitions>
api.xml
<?xml version="1.0"?>
<!--
/**
* my
* @category my
* @package my AP-Plus
*/-->
<config>
<api>
<resources>
<my_applus translate="title" module="my_applus">
<model>my_applus/sync_api</model>
<title>my AP-Plus</title>
<acl>my_applus/sync</acl>
<methods>
<parse translate="title" module="my_applus">
<title>Parse Xml</title>
<method>parseXml</method>
</parse>
</methods>
</my_applus>
</resources>
<resources_alias>
<sync>my_applus</sync>
</resources_alias>
<v2>
<resources_function_prefix>
<sync>myApplusSync</sync>
</resources_function_prefix>
</v2>
<acl>
<resources>
<my_applus translate="title" module="my_applus">
<title>Sync AP-Plus</title>
<sort_order>5</sort_order>
<product translate="title" module="my_applus">
<title>Sync AP-Plus</title>
</product>
</my_applus>
</resources>
</acl>
</api>
</config>
app/code/local/My/Applus/Model/Sync/Api/v2.php
<?php
class My_Applus_Model_Sync_Api_V2 extends my_Applus_Model_Sync_Api
{
const XML_NODE_Articles = 'Articles';
const XML_NODE_Categories = 'CATEGORIES';
const XML_NODE_Customers = 'Customers';
/**
* here we start
* @param $xmlString
* @return bool|string
*/
public function parseXml($xmlString)
{
Mage::log($xmlString, Zend_Log::DEBUG, 'My_Sync_Api_parseXml.log');
$xml = simplexml_load_string($xmlString);
$ids = $this->checkDataType($xml);
return $ids;
}
}
Answer by Reign Hartman
I am doing a registration form online that connects to a soap web service and should be able to save payment information through it.
The PHP is like this,The best way without having to declare classes is to use the stdClass. To make it work, preserve the name of the fields in your object and object properties.,I was once puzzeled by an error like this. It turned out the property wasn’t missing in the request but in the response. The error message did not contain any specification.,I just solved the problem, it was a matter of using objects instead of the huge and confusing array. You must hoewer not forget to map the objects exactly as they appear in the wsdl. And you must assign value to all of them in your instance, if emty just use ». Here is my code.
I am doing a registration form online that connects to a soap web service and should be able to save payment information through it.
The PHP is like this
function create_member_fee()
{
$wsdl = 'WSDL LOCATION';
$client = new mySoap($wsdl, array('trace' => 1));
$request = array(
'obj'=>array(
'Member'=>array('Number'=>$NUMBER),
'Amount'=>$PRICE,
'CreditCard'=>array(
'TComboBox_ARCreditCardType'=>$_POST['CT'],
'CardNumber'=>$_POST['CN'],
'ExpDate'=>mktime(0,0,0,$_POST['CM'],1,$_POST['CY']),
'SSNumber'=>$NUMBER_PAYER
)
),
'opt'=>array('MemberAction'=>new SoapParam('_ActionInsert','ns1:TActionMethod'))
);
$result = $client->__call('CreateMemberFee',$request);
return $result;
}
The error generated when calling create_member_fee() is like this
Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object has no 'RecordID' property in...
Bug #74984 | [Client] SOAP-ERROR: Encoding: object has no XXX property | |||
---|---|---|---|---|
Submitted: | 2017-07-25 03:03 UTC | Modified: | 2017-07-25 03:31 UTC | |
From: | peter_liang at vtech dot com | Assigned: | ||
Status: | Closed | Package: | SOAP related | |
PHP Version: | 7.0.21 | OS: | CentOS 7.3 | |
Private report: | No | CVE-ID: | None |
[2017-07-25 03:03 UTC] peter_liang at vtech dot com
Description: ------------ When I call a webservice, it works on Java and SoapUI, fails in PHP. Java & SoapUI return a list, PHP return a stdClass with nothing. // SoapUI <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:man="#namespace#"> <soapenv:Header/> <soapenv:Body> <man:fetchCustomerDevices> <caller-id>#called-id#</caller-id> <customer-id>#customer-id#</customer-id> </man:fetchCustomerDevices> </soapenv:Body> </soapenv:Envelope> // Java service.fetchCustomerDevices( #called-id#, new BigInteger(#customer-id#), null, false); // PHP $arguments = array( 'caller-id' => '#called-id#', 'customer-id' => #customer-id#, 'device-serial' => null, 'sendEmail' => false ); $soapClient = new SoapClient($wsdl, null); $result = $soapClient->fetchCustomerDevices($arguments);
Patches
Add a Patch
Pull Requests
Add a Pull Request
History
AllCommentsChangesGit/SVN commitsRelated reports
[2017-07-25 03:31 UTC] peter_liang at vtech dot com
-Status: Open
+Status: Closed
[2017-07-25 03:31 UTC] peter_liang at vtech dot com
I change the PHP SoapUI call as follow, the issue resolves. $arguments = array (); $arguments[] = new SoapVar("#caller-id#",XSD_STRING,null,null, "caller-id"); $arguments[] = new SoapVar(#customer-id#,XSD_INTEGER,null,null, "customer-id"); $soapClient = new SoapClient(#WSDL#, null); $result = $soapClient->fetchCustomerDevices(new SoapVar($arguments,SOAP_ENC_OBJECT)); Thus I closed the bug.