2013-10-15 68 views
0
<?xml version="1.0" encoding="utf-8"?> 
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soap:Body> 
    <GetPracticeInformation xmlns="http://tempuri.org/"> 
     <sUserName>string</sUserName> 
     <sUserPassword>string</sUserPassword> 
     <iPatientId>int</iPatientId> 
     <bDocument>boolean</bDocument> 
     <iDocumentId>int</iDocumentId> 
     <abCypherTextBytes>base64Binary</abCypherTextBytes> 
    </GetPracticeInformation> 
    </soap:Body> 
</soap:Envelope> 

誰能幫我傳遞的SOAP字符串布爾值,整數值和base64Binary的價值...在SOAP消息中傳遞Boolean,Int和base64Binary?

我試着像

NSString *uName = @"Name"; 
NSString *uPassWord = @"PassWord"; 
BOOL y = TRUE; 
BOOL n = FALSE; 
int val = 0; 
NSMutableData *myData = [[NSMutableData alloc]initWithCapacity:65000]; 

NSString *soapMessage =[NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" 
"<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" 
"<soap:Body>\n" 
"<GetPracticeInformation xmlns=\"http://tempuri.org/\">\n" 
"<sUserName>%@</sUserName>\n" 
"<sUserPassword>%@</sUserPassword>\n" 
"<iPatientId>%d</iPatientId>\n" 
"<bDocument>%c</bDocument>\n" 
"<iDocumentId>%d</iDocumentId>\n" 
"<abCypherTextBytes>%@</abCypherTextBytes>\n" 
"</GetPracticeInformation>\n" 
"</soap:Body>\n" 
"</soap:Envelope>",uName,uPassWord,val,n,val,myData]; 

但在這種情況下,我得到0字節響應..

2013-10-15 15:19:34.262 SoapXML[1438:11303] DONE. Received Bytes: 0 
2013-10-15 15:19:34.263 SoapXML[1438:11303] out put: (null) 
2013-10-15 15:19:34.265 SoapXML[1438:11303] Error while parsing the document: Error Domain=SMXMLDocumentErrorDomain Code=1 "Malformed XML document. Error at line 1:1." UserInfo=0x7690650 {LineNumber=1, ColumnNumber=1, NSLocalizedDescription=Malformed XML document. Error at line 1:1., NSUnderlyingError=0x7690540 "The operation couldn’t be completed. (NSXMLParserErrorDomain error 5.)"} 

這是正確的方式來傳遞值?如何傳遞布爾值和base64Binary? ..請幫幫我。

回答

0

改變這一行,因爲布爾值需要int值這麼

<bDocument>%c</bDocument>\n to <bDocument>%d</bDocument>\n 
+0

仍然沒有得到輸出...它應該像<?xml version =「1.0」encoding =「utf-8」?> 字符串 base64Binary的 Leena

+0

響應仍然是0字節...我通過base64Binary錯誤...請給我一些解決方案.. – Leena

+0

我認爲你的base64Binary不正確,你需要先檢查base64Binary裏面的值是什麼? –

0

我通過傳遞結果(MYDATA的ASCIIEncoding)

NSMutableData *mydata = [[NSMutableData alloc]initWithCapacity:65000]; 
    NSString *result= [[NSString alloc]initWithData:mydata encoding:NSASCIIStringEncoding]; 

代替base64Binary的的得到了解決,我通過了結果字符串我得到了正確的答覆...