2016-12-16 31 views
16

के पीछे PHP सोपसेवर चलाना मैं प्रॉक्सी के पीछे एक PHP सोप क्लाइंट और एक सोपसेवर (Magento के लिए) चलाने का प्रयास कर रहा हूं, जहां प्रॉक्सी सर्वर के माध्यम से केवल एकमात्र नेटवर्क यातायात की अनुमति है। इस ग्राहक के रूप में इतनी के साथ काम करनेप्रॉक्सी

मैं मिल गया है:

$client = new SoapClient('https://www.domain.co.uk/api/v2_soap/?wsdl=1', [ 
    'soap_version' => SOAP_1_1, 
    'connection_timeout' => 15000, 
    'proxy_host' => '192.168.x.x', 
    'proxy_port' => 'xxxx', 
    'stream_context' => stream_context_create(
     [ 
      'ssl' => [ 
       'proxy' => 'tcp://192.168.x.x:xxxx', 
       'request_fulluri' => true, 
      ], 
      'http' => [ 
       'proxy' => 'tcp://192.168.x.x:xxxx', 
       'request_fulluri' => true, 
      ], 
     ] 
    ), 
]); 

यह अपेक्षा के अनुरूप काम करता है - सभी यातायात प्रॉक्सी सर्वर के माध्यम से जा रहा है।

हालांकि, सोपसेवर क्लास के साथ, मैं साबुन सर्वर के माध्यम से सभी आउटबाउंड ट्रैफिक भेजने के लिए इसे कैसे मजबूर कर सकता हूं, यह काम नहीं कर सकता। ऐसा लगता है कि http://schemas.xmlsoap.org/soap/encoding/ लोड करने की कोशिश कर रहा है, सीधे प्रॉक्सी के माध्यम से नेटवर्क बनाते हैं, जो "http://schemas.xmlsoap.org/soap/encoding/" से स्कीमा आयात नहीं कर सकता है।

मैंने schemas.xmlsoap.org के लिए 127.0.0.1 के लिए मेजबान फ़ाइल प्रविष्टि जोड़ने और स्थानीय रूप से इस फ़ाइल को होस्ट करने का प्रयास किया है, लेकिन मुझे अभी भी एक ही समस्या मिल रही है।

क्या मुझे कुछ याद आ रही है? file_get_contents में तरह

उत्तर

3

कोशिश stream_context_set_default: file_get_contents behind a proxy?

<?php 
// Edit the four values below 
$PROXY_HOST = "proxy.example.com"; // Proxy server address 
$PROXY_PORT = "1234"; // Proxy server port 
$PROXY_USER = "LOGIN"; // Username 
$PROXY_PASS = "PASSWORD"; // Password 
// Username and Password are required only if your proxy server needs basic authentication 

$auth = base64_encode("$PROXY_USER:$PROXY_PASS"); 
stream_context_set_default(
array(
    'http' => array(
    'proxy' => "tcp://$PROXY_HOST:$PROXY_PORT", 
    'request_fulluri' => true, 
    'header' => "Proxy-Authorization: Basic $auth" 
    // Remove the 'header' option if proxy authentication is not required 
) 
) 
); 
//Your SoapServer here 

या गैर डबल्यूएसडीएल मोड में सर्वर चलाने का प्रयास

<?php 
$server = new SoapServer(null, array('uri' => "http://localhost/namespace")); 
$server->setClass('myClass'); 
$data = file_get_contents('php://input'); 
$server->handle($data);