سؤال

أنا أستخدم NUSOAP على PHP 5.2.6 وأرى أن حجم رسالة MAX هو 1000 بايت فقط (مما يجعل من الصعب القيام بأي شيء ذي معنى). هل هذه المجموعة في WSDL من نقطة النهاية أم أن هذا شيء يمكنني تكوينه في NUSOAP؟

هل كانت مفيدة؟

المحلول

فيما يتعلق بـ fud حول "حد 1000 بايت" ... بحثت عن sourcecode nusoap_client ووجدت أن الحد فعال فقط ل ناتج التصحيح.

هذا يعني أن جميع البيانات تتم معالجتها ونقلها إلى خدمة الويب (بغض النظر عن حجمها) ، ولكن يتم عرض أول 1000 بايت (أو على وجه التحديد: الأحرف) في سجل التصحيح.

هذا هو الرمز:

$this->debug('SOAP message length=' . strlen($soapmsg) . ' contents (max 1000 bytes)=' . substr($soapmsg, 0, 1000));

// send
$return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_timeout);

كما ترون بوضوح ، getHTTPBody() يستخدم المكالمة الكل $soapmsg, ، فقط ناتج التصحيح يقتصر على 1000 حرف. إذا كنت ترغب في تغيير هذا ، فما عليك سوى تغيير substr() اتصل لتناسب احتياجاتك ، أو ببساطة استبدالها $soapmsg (لذلك يظهر كل شيء في ناتج التصحيح ، أيضًا).

يجب أن يكون لهذا لا علاقة له على الإطلاق بأي حد حقيقي للبيانات المرسلة بالفعل. بالطبع يمكن أن يكون هناك عوامل أخرى تحد فعليًا من حجم ما يمكنك إرساله (على سبيل المثال ، تعيين حد ذاكرة الوصول العشوائي للنص PHP الخاص بك ، أو قيود تنفيذ HTTP ، أو نفاد الذاكرة الافتراضية المتاحة) ، ولكن خذها كأمر مسلم به مثل "حد 1000 بايت" للبيانات التي يمكنك إرسالها باستخدام NUSOAP.

نصائح أخرى

I am only passingly-familiar with PHP, and have never used the NuSOAP package at all. However, a SOAP message's size should only be limited by the transport medium. In the case of HTTP, it should be pretty much unbounded (the limitation of 16384 bytes in form POST requests isn't due to SOAP, it's from browser limitations (which may actually not exist anymore, but I don't know for certain)).

I would recommend finding a contact address for the authors/maintainers of NuSOAP and ask them directly. Unless there's something in the WSDL (and I don't recall anything in the WSDL spec that would limit a whole message-body-size... individual parameters (via XML Schema facets), but not the overall body), then the limitation would seem to be in the toolkit.

On a production box we use the PHP 5.2.5 built-in Soap-functions as server and NuSoap on PHP 4 and have successfully transferred messages larger than 1 MB.

I don't think that there is a limitation in either product, but you should check your settings in php.ini for

max_input_time        (defaults to 60)

This is the time each script is allowed to parse input. If the time is up before parsing is complete, the script will not even run.

A sidenote: If possible, I suggest migrating to the SoapClient/SoapServer PHP extension classes. NuSoap has proved itself not very reliable in heavy-load situations, especially when it comes to the cache. Sometimes we saw NuSoap simply "forgetting" wsdl definitions and working in none-wsdl-mode. Weird...

You haven't said if you're sending or receiving SOAP messages. If you're sending, I'd be checking to see that NuSOAP is sending via POST rather than GET (you'll probably have to dig into the code to see; I've found the documentation sparse). If you're receiving, check your PHP.INI settings for things like memory and data size. Actually, check your memory limits, anyway -- NuSOAP is quite a memory hog, IIRC.

I think message size will be limited rather by a PHP memory limit, than by some hardcoded value. At least I could send a 6.5MB string without any problems. When I tried to send a 8MB string I got an out of memory exception inside nusoap.php (my server has 64MB limit for PHP).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top