why sometime can get error 404 not found (soapclient- response has contents of the response), how to solve

我与影子孤独终老i 提交于 2019-12-11 16:06:30

问题


i have a NUSOAP webservice

when i run from client it visbile the error

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)

below is my code at client i have to client (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;
}
?>

why can happen this error and how to solve, can someone help??

thanks


回答1:


Try to set forced endpoint

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

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



回答2:


The endpoint is a connection point where HTML files or active server pages are exposed.



来源:https://stackoverflow.com/questions/20277451/why-sometime-can-get-error-404-not-found-soapclient-response-has-contents-of-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!