0
nusoap에서 반환되는 데이터 배열에 액세스 할 때 중복 태그가 발생합니다. 복잡한 유형으로 시도했지만 항목 태그 대신 특정 태그로 묶는 등의 방식으로 작동하지 않습니다. 복잡한 유형을 다음과 같이 선언합니다.복합 형 배열 nusoap 및 iPhone 구문 분석
$server->wsdl->addComplexType(
'ProductArray',
'complexType',
'struct',
'all',
'',
array(
'pid' => array('name' => 'pid', 'type' => 'xsd:string'),
'pname' => array('name' => 'pname', 'type' => 'xsd:string')
)
);
나는 내 기능 등록 :
$server->register('ProdInfo', // method name
array('product' => 'tns:product'), // input parameters
array('return' => 'tns:ProductArray'), // output parameters
'urn:productcomplextype', // namespace
'urn:productcomplextype/ProdInfo', // soapaction
'rpc', // style
'encoded', // use
'Product Information' // documentation
을);
기능
function ProdInfo ($product) {
//code
return array('pid'=>$pid,'pname'=>$pname);
}
나는 하드 코드 내가 가치를 하나의 반환 값의 경우. 그러나 배열로 올바른 값을 표시하는 데 문제가 있습니다. 그것은 배열에서 함수에서 데이터를 반환과 관련된 문제 때문
Array
(
[pid] => Array
[pname] => Array
)
이
업데이트를 도와주세요 다음과 같은 출력을 발생합니다. 올바르게 반환 된 후에 해결되었습니다. 이제 데이터는 다음과 같이 나타납니다
Array
(
[ProductInfo] => Array
(
[0] => Array
(
[pid] => 1
[pname] => Steering
)
[1] => Array
(
[pid] => 18
[pname] => Wheel Base
)
)
)
이렇게하면 iPhone 응용 프로그램에서 분석하기가 어렵습니다. iPhone 응답에는 데이터가 없습니다.
단순히 배열을 반환하도록 웹 서비스를 변경하여 문제가 해결되었습니다. 복합 형을 사용하는 것을 피했습니다. – MACMAN