为什么有时可以得到错误404找不到(soapclient-响应有响应的内容),如何解决

时间:2013-11-29 02:26:46

标签: php soap soap-client nusoap

我有一个NUSOAP网络服务

当我从客户端运行时,它可以解决错误

wsdl error: Getting http://carvilshoe.cz.cc/index.wsdl.php?wsdl - HTTP ERROR: Unsupported HTTP response status 404 Not Found (soapclient->response has contents of the response)

下面是我在客户端的代码 我必须客户(mitra)

mitra = http://pakalolosepatu.cu.cc/
mitra1 = http://carvilshoe.cz.cc/

-     

//wsdl configuration
$wsdl = mitra . 'index.wsdl.php?wsdl';
$ws_client_pakalolo = new nusoap_client ( $wsdl, true );
$wsdl = mitra1 . 'index.wsdl.php?wsdl';
$ws_client_sepatubermerek = new nusoap_client ( $wsdl, true );

//debug if needed
//$ws_client->debugLevel = 1;

//header configuration
$user = "+++";
$pass = "+++";

//encrypt header value
$user = base64_encode ( $user );
$pass = base64_encode ( $pass );

$header = '<AuthSoapHeader>
            <UserName>' . $user . '</UserName>
            <Password>' . $pass . '</Password>
            </AuthSoapHeader>';

//set header
$ws_client_pakalolo->setHeaders ( $header );
$ws_client_sepatubermerek->setHeaders ( $header );


// Function to print Fault
function detect_fault() {
    global $ws_client_pakalolo;

    //detect fault and error
    if ($ws_client_pakalolo->fault) {
        exit ( $ws_client_pakalolo->faultstring );
    } else {
        $err = $ws_client_pakalolo->getError ();
        if ($err) {
            exit ( $err );
        }
    }
}
function detect_fault_mitra2() {
    global $ws_client_sepatubermerek;

    //detect fault and error
    if ($ws_client_sepatubermerek->fault) {
        exit ( $ws_client_sepatubermerek->faultstring );
    } else {
        $err = $ws_client_sepatubermerek->getError ();
        if ($err) {
            exit ( $err );
        }
    }
}

function call_list_barang($limit, $offset, $order_by, $where) {
    global $ws_client_pakalolo,$ws_client_sepatubermerek;
    //parameters configuration
    $params = array ('limit' => $limit, 'offset' => $offset, 'order_by' => $order_by, 'where' => $where);

    //call method service
    $ws_data = $ws_client_pakalolo->call ( 'data_barang', $params);
    detect_fault ();
    //decode data
    $ws_data = unserialize ( base64_decode ( $ws_data ) );

    //call method service
    $ws_data1 = $ws_client_sepatubermerek->call ( 'data_barang', $params);
    detect_fault_mitra2 ();
    //decode data
    $ws_data1 = unserialize ( base64_decode ( $ws_data1 ) );


    $data_paka = $ws_data['data'];
    $data_se = $ws_data1['data'];
    $data = array_merge($data_paka,$data_se);
    return $data;
}
function call_list_stock($mitra,$no_barang) {
    global $ws_client_sepatubermerek, $ws_client_pakalolo;

    //parameters configuration
    $params = array ('no_barang' => $no_barang );

    if($mitra == "Pakalolo"){
        //call method service
        $ws_data = $ws_client_pakalolo->call ( 'list_stock', $params);
        detect_fault ();
        //decode data
    }else{
        //call method service
        $ws_data = $ws_client_sepatubermerek->call ( 'list_stock', $params);
        detect_fault_mitra2 ();
        //decode data
    }
    $ws_data = unserialize ( base64_decode ( $ws_data ) );

    return $ws_data;
}
?>

为什么会发生这个错误以及如何解决, 有人可以帮忙??

感谢

2 个答案:

答案 0 :(得分:2)

尝试设置强制端点

$client = new nusoap_client('http://LOCATION_TO_WSDL','wsdl');

$client -> setEndpoint('http://LOCATION_OF_ENDPOINT'); 

答案 1 :(得分:0)

端点是公开HTML文件或活动服务器页面的连接点。