我正在尝试解析PHP中方法的XML响应.Below是我的回复。
响应:
<FindIssuesResponse xmlns="http://Service/">
<FindIssuesResult>
<FindIssues xmlns="">
<GetIssue>
</GetIssue>
<GetIssue>
<IssuesIssueNbr>1226</IssuesIssueNbr>
<IssuesIssueDescription>Issue Descreption</IssuesIssueDescription>
<IssuesIssueSolution>Duplicate ticket for Issue #1223</IssuesIssueSolution>
<IssuesIssueTypeID>7</IssuesIssueTypeID>
<IssueNotes>
<NotesIssueNbr>1226</NotesIssueNbr>
<NotesNoteID>16344</NotesNoteID>
<NotesNoteCreatedDate>2013-10-23T01:28:50.383-04:00</NotesNoteCreatedDate>
<NotesNoteText>text</NotesNoteText>
<NotesNotePrivate>false</NotesNotePrivate>
<NotesFirstNote>true</NotesFirstNote>
<NotesDatabaseID>IssueTrak</NotesDatabaseID>
<NotesCreatedBy>user@example.com</NotesCreatedBy>
<NotesNoteTime>0</NotesNoteTime>
<NotesIsRichText>true</NotesIsRichText>
</IssueNotes>
</GetIssue>
<GetIssue>
</GetIssue>
<GetIssue>
</GetIssue>
请帮我解析这个XML以获取第一个标记值“NotesIssueNbr”
我写的是这样的。
代码:
<?php
require_once 'nusoap.php';
$wsdl="D:\PHP\ITAlert.wsdl";
$client=new SoapClient($wsdl);
$searchCriteria='<FindIssues><ReturnSchema>N</ReturnSchema><IssueStatus>Open</IssueStatus><IssuesNextActionBy><UsersUserID>user@example.com</UsersUserID></IssuesNextActionBy></FindIssues>';
$params=array('searchCriteria'=>$searchCriteria,'username'=>'user@example.com','password'=>'password');
$response = $client->__soapCall('FindIssues', array($params));
$issues = simplexml_load_string($response->FindIssuesResult);
$value1=$issues->issues->FindIssues->GetIssue->IssuesIssueNbr;
echo $value1;
?>
我是否知道解析此格式的方法
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<FindIssuesResponse xmlns="http://IssueTrakService/">
<FindIssuesResult>
<FindIssues xmlns="">
<GetIssue>
<IssuesIssueNbr>1223</IssuesIssueNbr>