2016-02-04 130 views
0

我正在使用SOAP PHP創建客戶端Sage X3,但我的請求SOAP失敗。這裏是我的代碼:使用PHP SOAP從Web服務創建客戶端Sage X3

$xml='<PARAM> 
    <GRP ID="BPC0_1" > 
    <FLD NAME="BCGCOD" TYPE="Char" >CUS</FLD> 
    <FLD MENULAB="Oui" MENULOCAL="1" NAME="BPCSTA" TYPE="Integer" >2</FLD> 
    <FLD NAME="BPCNAM" TYPE="Char" >'.$shorte_name.'</FLD> 
    </GRP> 
    <GRP ID="BPRC_1" > 
    <FLD NAME="CRY" TYPE="Char" >MA</FLD> 
    <FLD NAME="LAN" TYPE="Char" >FRA</FLD> 
    <FLD NAME="CRN" TYPE="Char" >tnrte</FLD> 
    <FLD NAME="CUR" TYPE="Char" >MAD</FLD> 
    </GRP> 
    <TAB DIM="30" ID="BPAC_1" SIZE="1" > 
    <LIN NUM="1" > 
     <FLD NAME="CODADR" TYPE="Char" >addr</FLD> 
     <FLD NAME="BPADES" TYPE="Char" >'.$ville.'</FLD> 
     <FLD NAME="BPACRY" TYPE="Char" >MA</FLD> 
     <FLD NAME="CRYNAM" TYPE="Char" >Maroc</FLD> 
     <FLD NAME="ADDLIG1" TYPE="Char" >'.$adresse.'</FLD> 
     <FLD NAME="ADDLIG2" TYPE="Char" ></FLD> 
     <FLD NAME="ADDLIG3" TYPE="Char" ></FLD> 
     <FLD NAME="POSCOD" TYPE="Char" >'.$code_postal.'</FLD> 
     <FLD NAME="CTY" TYPE="Char" >'.$ville.'</FLD> 
     <FLD NAME="SAT" TYPE="Char" ></FLD> 
     <FLD NAME="TEL1" TYPE="Char" >'.$phone_fixe.'</FLD> 
     <FLD NAME="WEB1" TYPE="Char" >'.$web_site.'</FLD> 
     <FLD NAME="WEB3" TYPE="Char" ></FLD> 
     <FLD MENULAB="Non" MENULOCAL="1" NAME="BPAADDFLG" TYPE="Integer" >1</FLD> 
    </LIN> 
    </TAB> 
    <GRP ID="BPC3_1" > 
    <FLD NAME="ZACCCOD" TYPE="Char" ></FLD> 
    </GRP> 
    <GRP ID="BPC3_2" > 
    <FLD NAME="VACBPR" TYPE="Char" >AF</FLD> 
    </GRP> 
    <GRP ID="BPC3_3" > 
    <FLD NAME="PTE" TYPE="Char" >CH30D60D_1020</FLD> 
    </GRP> 
</PARAM>'; 

$soapclient=new SoapClient($WSDL); 
$callContext = array('codeLang'=>$CODE_LANG, 'codeUser'=>$CODE_USER, 'password'=>$PASSWORD, 'poolAlias'=>$POOL_ALIAS, 'requestConfig'=>$REQUEST_CONFIG);       
$response = $soapclient->__soapCall('save', array($callContext, "YWSBPC", $xml), array('uri' => 'http://www.adonix.com/WSS', 'soapaction' => ''));} 

不幸的是我的請求失敗,並返回此錯誤:

stdClass Object (
    [messages] => Array (
    [0] => stdClass Object (
     [message] => Niveau d'accés insuffisant 
     [type] => 3 
    ) 
) 
    [resultXml] => [status] => 0 
    [technicalInfos] => stdClass Object (
    [busy] => 
    [changeLanguage] => 
    [changeUserId] => 
    [flushAdx] => 
    [loadWebsDuration] => 0.055482 
    [nbDistributionCycle] => 1 
    [poolDistribDuration] => 1.134829 
    [poolEntryIdx] => 0 
    [poolExecDuration] => 383.223727 
    [poolRequestDuration] => 385.851035 
    [poolWaitDuration] => 1.492052 
    [processReport] => 
    [processReportSize] => 0 
    [reloadWebs] => 
    [resumitAfterDBOpen] => 
    [rowInDistribStack] => 1 
    [totalDuration] => 391.547802 
    [traceRequest] => 
    [traceRequestSize] => 0 
) 
) 

我敢肯定,WSDL和上下文是正確的,因爲我使用相同的代碼讀取客戶端和有用。

另外我試圖使用SoapUI 5.2.1 - 我使用了一個有效的XML請求,但我得到了同樣的錯誤。

回答

0

錯誤消息是法文的,意味着訪問級別不足。 這link解釋得很好。

歸結爲檢查您用於處理請求的用戶的用戶權限。還提供了有關更改Web服務語言的提示。